zoukankan      html  css  js  c++  java
  • Winfrom实现圆角设计

    主要代码

     public partial class Form1 : Form
        {
            public Form1()
            {
                InitializeComponent();
            }

            private void Form1_Paint(object sender, PaintEventArgs e)
            {
                Type(this, 25, 0.1);
            }

            private void Type(Control sender, int p_1, double p_2)
            {
                GraphicsPath oPath = new GraphicsPath();
                oPath.AddClosedCurve(new Point[] {
                    new Point(0, sender.Height / p_1),
                    new Point(sender.Width / p_1, 0),
                    new Point(sender.Width - sender.Width / p_1, 0),
                    new Point(sender.Width, sender.Height / p_1),
                    new Point(sender.Width, sender.Height - sender.Height / p_1),
                    new Point(sender.Width - sender.Width / p_1, sender.Height),
                    new Point(sender.Width / p_1, sender.Height),
                    new Point(0, sender.Height - sender.Height / p_1) },
                    (float)p_2); sender.Region = new Region(oPath);
            }

            private void Form1_Resize(object sender, EventArgs e)
            {
                Type(this, 25, 0.1);
            }


            Point _Location;
            Boolean _Down = false;
            private void Form1_MouseDown(object sender, MouseEventArgs e)
            {
                if (e.Button == MouseButtons.Left)
                {
                    _Location = new Point(e.X, e.Y);
                    _Down = true;
                }
            }

            private void Form1_MouseMove(object sender, MouseEventArgs e)
            {
                if (e.Button == MouseButtons.Left && _Down == true)
                {
                    this.Left += e.X - _Location.X;
                    this.Top += e.Y - _Location.Y;
                }
            }

            private void Form1_MouseUp(object sender, MouseEventArgs e)
            {
                _Down = false;
            }
        }

  • 相关阅读:
    Matlab中如何取出cell型数组里的某一列,和具体某个值
    Matlab 读取dat文件(包含几行多余文本,数据带有数字和字符串,且以逗号分隔)
    批处理txt文件
    Word删除关键字所在行
    移动web页面前端开发总结
    JavaScript 的性能优化:加载和执行
    jq中prop和attr的区别以及各自的使用
    移动web开发经验总结(转)
    JavaScript核心(晋级高手必读篇)
    -webkit-transition: all .2s ease-in-out;
  • 原文地址:https://www.cnblogs.com/FLWL/p/6247720.html
Copyright © 2011-2022 走看看