开发者

make windows form Title at The middle of the tittle bar

In My windows form application I want to make the title of the form in the middle of it's bar ( Title bar ) for example : if you are on windows xp and open your my computer you will find it in the left of the title bar I want for exa开发者_开发问答mple to make my title in the middle of the same bar

How ?


That's not possible using regular WinForms form properties. On the other hand, you can create a form without any border and custom draw your own borders. That will be very much like what other skinning libraries too so you can look into various skinning libs from vendors if you don't want to bother with writing your own custom routines.


There are basically three options:

  1. Create a custom control that has the title centered and the appropriate minimize/maximize/close buttons. Use a from with no title bar and drop your custom control on top.

  2. Use GDI+ to draw the title, and update its position using form resize events. Total hack, not even sure this would work.

  3. Calculate the number of spaces required to center the title based on the width of the form and then insert them before the title text. Lame solution, but it would work and be easy to implement.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜