PC Review


Reply
Thread Tools Rate Thread

Can Borderless forms have a context menu in the start bar?

 
 
ThunderMusic
Guest
Posts: n/a
 
      20th Nov 2006
Hi
I'm currently developping a skinnable form by using a borderless form
(Form.FormBorderStyle=None). Is it the right way to go in the first place?
if it is. Assuming that when there is no border to the form there is no
context menu when you right-click on your form in the start bar too (the one
with Restore, Move, Size, Close et al.)... How can I make this context menu
work again? Is there a way to tell the form to make it work even if the form
is borderless?

thanks

ThunderMusic


 
Reply With Quote
 
 
 
 
ThunderMusic
Guest
Posts: n/a
 
      21st Nov 2006
I found the answer on this page http://www.dotnetrix.co.uk/menus.html


"ThunderMusic" <(E-Mail Removed)> wrote in message
news:%(E-Mail Removed)...
> Hi
> I'm currently developping a skinnable form by using a borderless form
> (Form.FormBorderStyle=None). Is it the right way to go in the first place?
> if it is. Assuming that when there is no border to the form there is no
> context menu when you right-click on your form in the start bar too (the
> one with Restore, Move, Size, Close et al.)... How can I make this
> context menu work again? Is there a way to tell the form to make it work
> even if the form is borderless?
>
> thanks
>
> ThunderMusic
>



 
Reply With Quote
 
Mick Doherty
Guest
Posts: n/a
 
      21st Nov 2006
"ThunderMusic" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
>I found the answer on this page http://www.dotnetrix.co.uk/menus.html
>


That would be http://www.dotnetrix.co.uk/misc.html

I have been working on better examples, but have put them aside for the
moment as I work on other stuff, but if you want to make the form resizable,
then I would suggest that you leave the FormBorderstyle as is and set the
Caption to "" and ControlBox to False. This will leave you with a 3d border
around the form which needs to be trimmed off when building the region, but
it will enable the Size option in the Window Menu.

If you then define a Border Region you can send WM_NCLBUTTONDOWN messages,
in response to mousedown within the region, with one of the following
NCHITTEST flags as the wParam in order to get window sizing when dragging by
an edge.

HTLEFT
HTRIGHT
HTTOP
HTTOPLEFT
HTTOPRIGHT
HTBOTTOM
HTBOTTOMLEFT
HTBOTTOMRIGHT

Also make sure you disable Visual Styles on the window as this will increase
painting performance and you won't be using them on a skinned window. The
following is the method that I use to disable Visual Styles on the form,
whilst still allowing them on the controls:

<DllImport("uxtheme.dll")> _
Public Shared Function SetWindowTheme(ByVal hwnd As IntPtr, _
ByVal pszSubAppName As String, ByVal pszSubIdList As String) As IntPtr
End Function

Protected Overrides Sub CreateHandle()
MyBase.CreateHandle()
If OSFeature.Feature.IsPresent(OSFeature.Themes) Then
SetWindowTheme(Me.Handle, String.Empty, "")
End If
End Sub


--
Mick Doherty
http://dotnetrix.co.uk/nothing.html


 
Reply With Quote
 
ThunderMusic
Guest
Posts: n/a
 
      21st Nov 2006
thanks a lot... I'll look into it...
Right now, I'm managing resizing by hand by looking where the cursor is and
displaying the good cursor at the right time and sizing when I have to size
by modifying Left, Top, Width and Height... I have a bug tought when I'm
sizing from Left or Top, The window start to move around when it's width and
height = 0. That was the only way I found I could do it with borderless
windows... for now, I will try to use the "more standard way" you explain
here and fill the blanks with what is explained on the site... For the
3D Border I must get rid of it because I use the TransparencyKey of the .Net
Form, so even if my background it completely transparent, the border still
show because I don't have to use region by now... But the example on the
site already get rid of the border even if the window is sizable.

if you have better examples for this exact same purpose, would you be so
kind as to post them here or on my e-mail please? (just get rid of the
NoSpAm at the beginning, the @NoSpAm.com at the end and decode...) and
please indicate in the subjet you are from the newsgroups because your
message will probably end up in my junk folder, so I must be able to
recognize you...

thanks again...

ThunderMusic

"Mick Doherty"
<EXCHANGE#(E-Mail Removed).[mdaudi100#ntlworld.com]> wrote in
message news:(E-Mail Removed)...
> "ThunderMusic" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
>>I found the answer on this page http://www.dotnetrix.co.uk/menus.html
>>

>
> That would be http://www.dotnetrix.co.uk/misc.html
>
> I have been working on better examples, but have put them aside for the
> moment as I work on other stuff, but if you want to make the form
> resizable, then I would suggest that you leave the FormBorderstyle as is
> and set the Caption to "" and ControlBox to False. This will leave you
> with a 3d border around the form which needs to be trimmed off when
> building the region, but it will enable the Size option in the Window
> Menu.
>
> If you then define a Border Region you can send WM_NCLBUTTONDOWN messages,
> in response to mousedown within the region, with one of the following
> NCHITTEST flags as the wParam in order to get window sizing when dragging
> by an edge.
>
> HTLEFT
> HTRIGHT
> HTTOP
> HTTOPLEFT
> HTTOPRIGHT
> HTBOTTOM
> HTBOTTOMLEFT
> HTBOTTOMRIGHT
>
> Also make sure you disable Visual Styles on the window as this will
> increase painting performance and you won't be using them on a skinned
> window. The following is the method that I use to disable Visual Styles on
> the form, whilst still allowing them on the controls:
>
> <DllImport("uxtheme.dll")> _
> Public Shared Function SetWindowTheme(ByVal hwnd As IntPtr, _
> ByVal pszSubAppName As String, ByVal pszSubIdList As String) As IntPtr
> End Function
>
> Protected Overrides Sub CreateHandle()
> MyBase.CreateHandle()
> If OSFeature.Feature.IsPresent(OSFeature.Themes) Then
> SetWindowTheme(Me.Handle, String.Empty, "")
> End If
> End Sub
>
>
> --
> Mick Doherty
> http://dotnetrix.co.uk/nothing.html
>



 
Reply With Quote
 
Mick Doherty
Guest
Posts: n/a
 
      22nd Nov 2006
The existing example on my site uses the same method that you are using to
resize the form. The newer example that I have been working on, uses the
windows resizing methods, similar to the move a borderless form example on
my site. This method will not work with the current example as the Size
menuitem of the Window menu needs to be enabled. If your form does not have
a border it is not sizable and so the menuitem will be grayed out.

If you are using the forms TransparencyKey to shape the form, then the new
method is probably not suitable as it requires that you define a region so
that you can Edge Detect and decide which of the 8 directions you need to be
sizing in.

The examples that I'm working on are not complete and are VB only at the
moment (I don't write the C# version until I am happy with the VB version).
I won't be giving out or posting the examples until they are complete, but
feel free to ask if you run into problems.

--
Mick Doherty
http://dotnetrix.co.uk/nothing.html


 
Reply With Quote
 
ThunderMusic
Guest
Posts: n/a
 
      22nd Nov 2006
I have started a new thread with a problem I run into, maybe you already
seen this kind of behavior?

thanks for the help...

ThunderMusic

"Mick Doherty"
<EXCHANGE#(E-Mail Removed).[mdaudi100#ntlworld.com]> wrote in
message news:(E-Mail Removed)...
> The existing example on my site uses the same method that you are using to
> resize the form. The newer example that I have been working on, uses the
> windows resizing methods, similar to the move a borderless form example on
> my site. This method will not work with the current example as the Size
> menuitem of the Window menu needs to be enabled. If your form does not
> have a border it is not sizable and so the menuitem will be grayed out.
>
> If you are using the forms TransparencyKey to shape the form, then the new
> method is probably not suitable as it requires that you define a region so
> that you can Edge Detect and decide which of the 8 directions you need to
> be sizing in.
>
> The examples that I'm working on are not complete and are VB only at the
> moment (I don't write the C# version until I am happy with the VB
> version). I won't be giving out or posting the examples until they are
> complete, but feel free to ask if you run into problems.
>
> --
> Mick Doherty
> http://dotnetrix.co.uk/nothing.html
>



 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
search in start menu and context menu do not open paul.vbautista@gmail.com Windows XP General 0 19th Apr 2007 08:04 AM
Can Borderless forms have a context menu in the start bar? ThunderMusic Microsoft Dot NET 5 22nd Nov 2006 02:43 PM
Can Borderless forms have a context menu in the start bar? ThunderMusic Microsoft Dot NET Framework 5 22nd Nov 2006 02:43 PM
Increase Fade Time on Context menu, start menu, etc. MatthewBrown@gmail.com Windows XP General 3 30th Oct 2005 03:09 AM
Start Menu in Win XP Pro not displaying - right click context menu not working e Doug Windows XP Basics 1 28th Nov 2003 05:39 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 08:04 PM.