Custom Titlebar
-
I have a custom title bar that I simply made from a label. My form is fixeddialog so I can get that raised effect. Everything looks great until I minimize my form to the taskbar. When I do this, I only see the corresponding icon and not the text. This is because my borderstyle isn't "none." And to have a fixeddialog form without a titlebar, you must make the text "". Therefore, I came up with this: When I minimize my form, I change the borderstyle and text so that it appears in the taskbar. The trick now is to get it to restore without the Titlebar. Essentially, I just need to do the opposite of what I did when I minimized the form. So, my question, do I have access to the "restore" event handler that is called when you either click or right-click on the item in the taskbar? If not, does anyone have another solution to this problem? Thanks in advance.
-
I have a custom title bar that I simply made from a label. My form is fixeddialog so I can get that raised effect. Everything looks great until I minimize my form to the taskbar. When I do this, I only see the corresponding icon and not the text. This is because my borderstyle isn't "none." And to have a fixeddialog form without a titlebar, you must make the text "". Therefore, I came up with this: When I minimize my form, I change the borderstyle and text so that it appears in the taskbar. The trick now is to get it to restore without the Titlebar. Essentially, I just need to do the opposite of what I did when I minimized the form. So, my question, do I have access to the "restore" event handler that is called when you either click or right-click on the item in the taskbar? If not, does anyone have another solution to this problem? Thanks in advance.
-
Look at the Resize and SizeChanged events of the form, at least one of them's fired by a resize, although I'm not sure which.
-
Thanks Dan, I tried that and it works. However, it flickers quite a bit. Too much to be acceptable. Any ideas? Thanks again.
Not really. there're properties to enable double buffering, but apparently they only work on custom controls and not an entire form. Doing manual resizing for a complex form I was able to largely reduce the flicker by massaging my code to use anchoring and nesting groups of controls in groupboxes as much as possible, and trying different ways to resize/position an object, there didn't appear to be any logic behind why X worked better than Y on control type A, while for B's you wanted to use Y instead.
-
Not really. there're properties to enable double buffering, but apparently they only work on custom controls and not an entire form. Doing manual resizing for a complex form I was able to largely reduce the flicker by massaging my code to use anchoring and nesting groups of controls in groupboxes as much as possible, and trying different ways to resize/position an object, there didn't appear to be any logic behind why X worked better than Y on control type A, while for B's you wanted to use Y instead.
-
Thanks for looking out. I just assumed that there would possibly be some win32 API that I could override to manually put the text in the taskbar.
Simply import the user32 dll and call the SetWindowText() method. using System.Runtime.InteropServices; [DllImport("User32.dll")] public static extern int SetWindowText(IntPtr hwnd , string str); [STAThread] static void Main() { Application.Run(new Form1()); } private void Form1_Load(object sender, System.EventArgs e) { SetWindowText(this.Handle , "Title"); } Thanks again for your help.