开发者

How to achieve a captionless bordered Aero window?

I know how I can remove the border of my form, but I simply want to remove the开发者_Python百科 caption. Googling for P/Invokes didn't give me much results, so I'm wondering, how can I achieve such a result?

How to achieve a captionless bordered Aero window?


Coming from unmanaged development, I'd P/Invoke {Get/Set}WindowLong, etc. etc. -- which was my initial response -- but there's a managed way to deal with this.

You'll want to override the CreateParams property in your form, removing the bordering style and adding the thick frame style, as such:

...
const UInt32 WS_THICKFRAME = 0x40000;
const UInt32 WS_BORDER = 0x800000;
...

protected override CreateParams CreateParams
{
  get
  {
    CreateParams p = base.CreateParams;
    p.Style |= WS_THICKFRAME;
    p.Style &= ~WS_BORDER;

    return p;
  }
}



Suggested reading list

Window Styles http://msdn.microsoft.com/en-us/library/ms632600%28VS.85%29.aspx

Form::CreateParams Property http://msdn.microsoft.com/en-us/library/system.windows.forms.form.createparams.aspx


I don't have VS right now so I can't give you an exact answer, sorry.

In the window's property pane look for border style, one of them will allow you to set one similar :)

Edit: I knew I was missing something... First, look for the properties "ControlBox", "MaximizeBox" and "MinimizeBox" and set them to false and choose one of the sizable options in "FormBorderStyle" property -yes, it cannot look like the one in the pic and also be fixed-size, at least not without PinVoke AFAIK-.

Also remember to leave the "Text" property blank.

Hope this helps :)

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜