如何在c#中设置自定义边框大小 [英] How to set custom border size in c#

查看:419
本文介绍了如何在c#中设置自定义边框大小的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在win form app中设置自定义边框大小。



就像许多地铁形式一样,这个属性是给出的。

解决方案

System.Windows.Forms 中没有这样的东西,只有很少的预定义边框类型。如果你真的需要它,你可以,例如,创建一个没有非客户区域的窗口,并模拟客户区域的边框。



-SA


试试这个:



 Form1.FormBorderStyle = System.Windows。 Forms.FormBorderStyle.FixedDialog; 





参考:



更改Windows窗体的边框 [ ^ ]


< blockquote>您好,

您可以订阅Form.Paint事件并使用此代码来执行此操作。



  private   void  Form1_Paint( object  sender ,PaintEventArgs e)
{
e.Graphics.DrawRectangle( new Pen(Color.GREEN, 3 ),
this .DisplayRectangle);
}


How to set custom border size in win form app.?

like in many metro forms this property is given.

解决方案

There is not such thing in System.Windows.Forms, there are only few predefined border types. If you really need it, you can, for example, create a window free from non-client areas and simulate border in the client area.

—SA


Try this :

Form1.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;



Reference :

Changing the Borders of Windows Forms[^]


Hello,
you can subscribe for Form.Paint event and use this code to do that.

private void Form1_Paint(object sender, PaintEventArgs e)
{
   e.Graphics.DrawRectangle(new Pen(Color.GREEN, 3),
                            this.DisplayRectangle);
}


这篇关于如何在c#中设置自定义边框大小的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆