C#:绘制Winform窗体
Winform窗体缺少左上角效果:
public void SetWindowRegion()
{
System.Drawing.Drawing2D.GraphicsPath FormPath;
FormPath = new System.Drawing.Drawing2D.GraphicsPath();
Rectangle rect = new Rectangle(, , this.Width, this.Height);
int diameter = ;
FormPath .AddRectangle(new Rectangle(rect.Location.X + diameter, rect.Location.Y, rect.Width - diameter, rect.Height));
FormPath .AddRectangle(new Rectangle(rect.Location.X, rect.Location.Y + diameter, diameter, rect.Height - diameter));
path.CloseFigure(); this.Region = new Region(FormPath); } protected override void OnResize(System.EventArgs e)
{ this.Region = null; SetWindowRegion(); }
参考:Winform窗体四圆角效果:
public void SetWindowRegion()
{
System.Drawing.Drawing2D.GraphicsPath FormPath;
FormPath = new System.Drawing.Drawing2D.GraphicsPath();
Rectangle rect = new Rectangle(, , this.Width, this.Height - );//this.Left-10,this.Top-10,this.Width-10,this.Height-10);
FormPath = GetRoundedRectPath(rect, );
this.Region = new Region(FormPath);
}
private GraphicsPath GetRoundedRectPath(Rectangle rect, int radius)
{
int diameter = radius;
Rectangle arcRect = new Rectangle(rect.Location, new Size(diameter, diameter));
GraphicsPath path = new GraphicsPath();
// 左上角
path.AddArc(arcRect, , );
// 右上角
arcRect.X = rect.Right - diameter;
path.AddArc(arcRect, , );
// 右下角
arcRect.Y = rect.Bottom - diameter;
path.AddArc(arcRect, , );
// 左下角
arcRect.X = rect.Left;
path.AddArc(arcRect, , );
path.CloseFigure();
return path;
}
protected override void OnResize(System.EventArgs e)
{
this.Region = null;
SetWindowRegion();
}
C#:绘制Winform窗体的更多相关文章
- WinForm 窗体基本属性、公共控件
一.WinForm:客户端程序制作 - C/S (B/S:服务器端) 它是基于.NET Framework框架上运行,不是必须在windows系统上才能运行---------------------- ...
- 重绘Winform窗体
本文转载自:http://www.cnblogs.com/encoding/p/5603080.html 按照惯例,先来几张样例图(注:为了展示窗口阴影效果,截图范围向外扩展了些,各位凭想象吧). 还 ...
- 【开源】做了一个WinForm窗体的投影组件,能够为窗口添加影子效果
最近手头上的项目终于忙得差不多了,想起好久没有更新了的NanUI,再看着每天QQ群未读消息闪烁的标志,突然才发现似乎愧对了群里各位喜爱NanUI的朋友们.于是乎,就想趁这几天有时间,好好的修复一下Na ...
- C# 鼠标移动Winform窗体内或者panel容器内的控件 显示虚线/实现虚线框来确定位置
C# 鼠标移动WinForm窗体或者panel容器内的控件 移动虚线/实现虚线框来确定位置 1.用到的方法介绍 今天,根据领导指示指导移动容器内的控件,生成虚线框,使用 ControlPaint.Dr ...
- winform 窗体圆角设计
网上看到的很多winform窗体圆角设计代码都比较累赘,这里分享一个少量代码就可以实现的圆角.主要运用了System.Drawing.Drawing2D. 效果图 代码如下. private void ...
- WinForm 窗体属性 窗体美化
WinForm是·Net开发平台中对Windows Form的一种称谓. Windows窗体的一些重要特点如下: 功能强大:Windows窗体可用于设计窗体和可视控件,以创建丰富的基于Windows的 ...
- winform窗体置顶
winform窗体置顶 金刚 winform 置顶 今天做了一个winform小工具.需要设置置顶功能. 网上找了下,发现百度真的很垃圾... 还是必应靠谱些. 找到一个可以链接. https://s ...
- winform窗体控件(全)
回顾跟补充下除了昨天那常用6个其他的winform窗体控件作用 1:Button:按钮 (1)AutoSize:如果是True的情况下,内容将会撑开:False的话会另起一行 (2)Enabled: ...
- C#将exe运行程序嵌入到自己的winform窗体中
以下例子是将Word打开,然后将它嵌入到winform窗体中,效果如下图:C将exe运行程序嵌入到自己的winform窗体中 - kingmax_res - iSport注意:该方法只适用于com的e ...
随机推荐
- Janus WinForms Controls
http://blog.sina.com.cn/s/blog_68eb92020101kpw8.html
- Java基础之处理事件——应用程序中的语义事件监听器(Sketcher 5 with element color listeners)
控制台程序. 为了标识元素的类型,可以为菜单已提供的4中元素定义常量,用作ID.这有助于执行菜单项监听器的操作,还提供了一种标识颜色类型的方式.我们会累积许多应用程序范围的常量,所以把它们定义为可以静 ...
- 通用窗口类 Inventory Pro 2.1.2 Demo1(上)
插件功能 按照Demo1的实现,使用插件来实现一个装备窗口是很easy的,虽然效果还很原始但是也点到为止了,本篇涉及的功能用加粗标出,具体的功能如下: 1.实现了两个窗口,通过点击键盘I来,打开或者关 ...
- csuoj 1120: 病毒
http://acm.csu.edu.cn/OnlineJudge/problem.php?id=1120 1120: 病毒 Time Limit: 3 Sec Memory Limit: 128 ...
- ofbiz进击 个人遇到的奇葩问题汇总。
在本人做退货单生成的时候,因为考虑到要控制通过java类方法去调用 service服务可以方便给出提示消息,所以专门新建了一个java类,然后去重新请求request请求,下面为Java类的代码 pu ...
- 自己使用Fresco时遇到的相关问题
Fresco是facebook推出的一款强大的android图片处理库,github地址:https://github.com/facebook/fresco 里面有官方的使用配置文档,而且是中文的. ...
- Spring 中 Xml配置文件属性的说明
Xml配置文件属性的说明: <bean id="TheAction" ⑴ class="net.xiaxin.spring.qs.UpperAction" ...
- session 和 cookie 的区别与联系
1.创建一个新的Cookie Cookie cookie = new Cookie("username",name); 2.设置cookie在客户端上存活多久 cookie.set ...
- ef 5 在 DropCreateDatabaseAlways 报错,the connection is currently used
go sp_who2 -- db_id 数据库名称,查询出来的结果执行一遍就能关闭所有连接 SELECT N'kill '+ CAST(spid AS varchar) FROM master..sy ...
- [Ubuntu] Remove Byte Order Mark (BOM) from files recursively [Forward article]
Original article: http://www.yiiframework.com/wiki/570/remove-byte-order-mark-bom-from-files-recursi ...