Prev: ComboBox Column in a Bound DataGridView
Next: How to scroll label control along with text in RichTextBox
From: Crouchie1998 on 27 Dec 2009 21:59 Hello All How do I get a Form on Top on the System Menu, please? Of course I am using GetSystemMenu & AppendMenu - no problem but this part is: Because I cannot put a checkmark on the system menu I want to toggle text. Example: 'On Top' shown if for isn't topmost 'Not On Top' if the form is topmost In WndProc I can handle the m.wParam.ToInt32 for the new appended menu item, but how to change the text on click (toggle text)? SOME CODE LEFT OUT AppendMenu(MenuHandleHere, MF_STRING, 1001, "Not On Top") in WndProc: Select Case m.WParam.ToInt32 Case 1001 [GET MENU TEXT HERE] (On Top/Not On Top) End Select Any ideas would be appreciated
From: Crouchie1998 on 28 Dec 2009 07:11
Hello All, I can get it working but not how I wish to have it, although it works I have added a hidden checkbox to the form & checked it Have added the System Menu item with AppendMenu (Not TopMost) In WndProc in my Case statement with a nested If/End If If CheckBox1.Checked = False Then CheckBox1.Checked = True DeleteMenu(iMenu, 1001, MF_STRING) AppendMenu(iMenu, MF_STRING, 1001, "Not Topmost") Me.TopMost = True Else CheckBox1.Checked = False DeleteMenu(iMenu, 1001, MF_STRING) AppendMenu(iMenu, MF_STRING, 1001, "Topmost") Me.TopMost = False End If Can you see a better way to do this? "Crouchie1998" wrote: > Hello All > > How do I get a Form on Top on the System Menu, please? > > Of course I am using GetSystemMenu & AppendMenu - no problem but this part is: > > Because I cannot put a checkmark on the system menu I want to toggle text. > Example: > > 'On Top' shown if for isn't topmost > 'Not On Top' if the form is topmost > > In WndProc I can handle the m.wParam.ToInt32 for the new appended menu item, > but how to change the text on click (toggle text)? > > SOME CODE LEFT OUT > > AppendMenu(MenuHandleHere, MF_STRING, 1001, "Not On Top") > > in WndProc: > > Select Case m.WParam.ToInt32 > Case 1001 > [GET MENU TEXT HERE] (On Top/Not On Top) > End Select > > Any ideas would be appreciated |