Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. Custom Titlebar

Custom Titlebar

Scheduled Pinned Locked Moved C#
questionhelp
6 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • P Offline
    P Offline
    PHDENG81
    wrote on last edited by
    #1

    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.

    D 1 Reply Last reply
    0
    • P PHDENG81

      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.

      D Offline
      D Offline
      Dan Neely
      wrote on last edited by
      #2

      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.

      P 1 Reply Last reply
      0
      • D Dan Neely

        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.

        P Offline
        P Offline
        PHDENG81
        wrote on last edited by
        #3

        Thanks Dan, I tried that and it works. However, it flickers quite a bit. Too much to be acceptable. Any ideas? Thanks again.

        D 1 Reply Last reply
        0
        • P PHDENG81

          Thanks Dan, I tried that and it works. However, it flickers quite a bit. Too much to be acceptable. Any ideas? Thanks again.

          D Offline
          D Offline
          Dan Neely
          wrote on last edited by
          #4

          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.

          P 1 Reply Last reply
          0
          • D Dan Neely

            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.

            P Offline
            P Offline
            PHDENG81
            wrote on last edited by
            #5

            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.

            P 1 Reply Last reply
            0
            • P PHDENG81

              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.

              P Offline
              P Offline
              PHDENG81
              wrote on last edited by
              #6

              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.

              1 Reply Last reply
              0
              Reply
              • Reply as topic
              Log in to reply
              • Oldest to Newest
              • Newest to Oldest
              • Most Votes


              • Login

              • Don't have an account? Register

              • Login or register to search.
              • First post
                Last post
              0
              • Categories
              • Recent
              • Tags
              • Popular
              • World
              • Users
              • Groups