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窗体的更多相关文章

  1. WinForm 窗体基本属性、公共控件

    一.WinForm:客户端程序制作 - C/S (B/S:服务器端) 它是基于.NET Framework框架上运行,不是必须在windows系统上才能运行---------------------- ...

  2. 重绘Winform窗体

    本文转载自:http://www.cnblogs.com/encoding/p/5603080.html 按照惯例,先来几张样例图(注:为了展示窗口阴影效果,截图范围向外扩展了些,各位凭想象吧). 还 ...

  3. 【开源】做了一个WinForm窗体的投影组件,能够为窗口添加影子效果

    最近手头上的项目终于忙得差不多了,想起好久没有更新了的NanUI,再看着每天QQ群未读消息闪烁的标志,突然才发现似乎愧对了群里各位喜爱NanUI的朋友们.于是乎,就想趁这几天有时间,好好的修复一下Na ...

  4. C# 鼠标移动Winform窗体内或者panel容器内的控件 显示虚线/实现虚线框来确定位置

    C# 鼠标移动WinForm窗体或者panel容器内的控件 移动虚线/实现虚线框来确定位置 1.用到的方法介绍 今天,根据领导指示指导移动容器内的控件,生成虚线框,使用 ControlPaint.Dr ...

  5. winform 窗体圆角设计

    网上看到的很多winform窗体圆角设计代码都比较累赘,这里分享一个少量代码就可以实现的圆角.主要运用了System.Drawing.Drawing2D. 效果图 代码如下. private void ...

  6. WinForm 窗体属性 窗体美化

    WinForm是·Net开发平台中对Windows Form的一种称谓. Windows窗体的一些重要特点如下: 功能强大:Windows窗体可用于设计窗体和可视控件,以创建丰富的基于Windows的 ...

  7. winform窗体置顶

    winform窗体置顶 金刚 winform 置顶 今天做了一个winform小工具.需要设置置顶功能. 网上找了下,发现百度真的很垃圾... 还是必应靠谱些. 找到一个可以链接. https://s ...

  8. winform窗体控件(全)

    回顾跟补充下除了昨天那常用6个其他的winform窗体控件作用 1:Button:按钮 (1)AutoSize:如果是True的情况下,内容将会撑开:False的话会另起一行 (2)Enabled: ...

  9. C#将exe运行程序嵌入到自己的winform窗体中

    以下例子是将Word打开,然后将它嵌入到winform窗体中,效果如下图:C将exe运行程序嵌入到自己的winform窗体中 - kingmax_res - iSport注意:该方法只适用于com的e ...

随机推荐

  1. python_类

    1. 对象的概念 对象包括特性和方法.特性只是作为对象的一部分的变量,方法则是存储在对象内的函数.对象中的方法和其他函数的区别在于方法总是将对象作为自己的第一个参数,这个参数一般称为self. 2. ...

  2. HBase shell

    进入命令行 ./hbase shell 查看HBase shell帮助 help 查看命令帮助 直接输入命令回撤 创建命名空间 create_namespace 'ns1' 查看命名空间 list_n ...

  3. javascript学习之位置获取

    一.获取浏览器的大小和位置 具体可以参见博客:http://www.cnblogs.com/bobodeboke/p/4653920.html 二.获取元素的大小和位置 方法一.利用offsetXXX ...

  4. 发现前端框架 bui-min.js

    http://www.builive.com/apps/default/main.html#menu/code http://www.builive.com/demo/grid-plugin.php# ...

  5. Java基础之序列化对象——将对象写入到文件中(SerializeObjects)

    控制台程序. 首先定义一个含有任意不同数据类型域的可序列化类: import java.io.Serializable; public class Junk implements Serializab ...

  6. IntelliJ IDEA 常用设置讲解1

    IntelliJ IDEA 有很多人性化的设置我们必须单独拿出来讲解,也因为这些人性化的设置让我们这些 IntelliJ IDEA 死忠粉更加死心塌地使用它和分享它. 常用设置 IntelliJ ID ...

  7. SC-控制Windows服务的命令

    Windows自带一个控制服务的命令-SC,下面用Terminal Service做个简单例子: 查询Terminal Service的配置 C:\Users\jackie.chen>sc qc ...

  8. Lintcode: Majority Number II

    Given an array of integers, the majority number is the number that occurs more than 1/3 of the size ...

  9. C#面向对象的方法写数组的功能

    上一篇文章用Java方法写出了可以对数组执行的功能,然后在用实例化后的对象调用这些方法来实现这些功能: 这篇随笔改用C#语言实现同样的功能 方法类:Array using System; using ...

  10. table创建固定表头

    布局:两个div,上部内容将表头复制,高度固定,下部div内部将table设置为margin:-**px; 隐藏掉表头,下部div设置overflow,即可. 代码: