Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Application Title in Taskbar but not Titlebar

This is a strange thing I'm doing, but how can I set the title of a winform form in the taskbar, but not in its titlebar?


1 Answers

A possible solution (it works fine for me) it's to override the CreateParams property and set the caption to be displayed in the taskbar:

protected override CreateParams CreateParams
{
   get
   {
      new SecurityPermission(SecurityPermissionFlag.UnmanagedCode).Demand();

      // Extend the CreateParams property of the Button class.
      CreateParams cp = base.CreateParams;
      // Update the button Style.
      cp.Style &= ~0xC00000; //WS_CAPTION;
      cp.Caption = PRODUCT_NAME;

      return cp;
   }
}

I hope that works for you,

Lisa

like image 58
Lisa Avatar answered Oct 23 '25 07:10

Lisa



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!