How to make a window have taskbar text but no title bar

前端 未结 4 719
名媛妹妹
名媛妹妹 2020-12-06 06:52

How can I make my window not have a title bar but appear in the task bar with some descriptive text? If you set the Form\'s .Text property then .net gives it a title bar, wh

相关标签:
4条回答
  • 2020-12-06 07:05

    Once you have removed the borders with the FormBorderStyle, as mentioned already, you can make it draggable fairly easily. I describe this at http://www.blackwasp.co.uk/DraggableBorderless.aspx.

    0 讨论(0)
  • 2020-12-06 07:08

    One approach to look into might be to set the FormBorderStyle property of your Form to None (instead of FixedDialog).

    The drawback to this approach is that you lose the borders of your window as well as the Titlebar. A result of this is that you lose the form repositioning/resizing logic that you normally get "for free" with Windows Forms; you would need to deal with this by implementing your own form move/resize logic in the form's MouseDown and MouseMove event handlers.

    I would also be interested to hear about better solutions.

    0 讨论(0)
  • 2020-12-06 07:16

    In my case I have a Form with FormBorderStyle = FormBorderStyle.SizableToolWindow and the following CreateParams override did the trick (i.e. I now have a form without caption and without additional margin for the title, but it keeps the title in the task bar):

    protected override System.Windows.Forms.CreateParams CreateParams
    {
        get
        {
            var parms = base.CreateParams;
            parms.Style &= ~0x00C00000; // remove WS_CAPTION
            parms.Style |= 0x00040000;  // include WS_SIZEBOX
            return parms;
        }
    }
    
    0 讨论(0)
  • 2020-12-06 07:21

    Just set the border style to None.

    this.FormBorderStyle = FormBorderStyle.None;
    
    0 讨论(0)
提交回复
热议问题