zoukankan      html  css  js  c++  java
  • 学了点GDI+ 做了一个滑动的效果

    代码很简单,写成控件,定义一个角度的属性,然后改动属性重绘。

     public UserControl1()
            {
                InitializeComponent();
                this.SetStyle(ControlStyles.AllPaintingInWmPaint, true);
                this.SetStyle(ControlStyles.OptimizedDoubleBuffer, true);
                this.SetStyle(ControlStyles.ResizeRedraw, true);
                this.SetStyle(ControlStyles.UserPaint, true);
                this.SetStyle(ControlStyles.SupportsTransparentBackColor, true);
                this.SetStyle(ControlStyles.Selectable, true);
            }
           int arcAngle;
            public int  ArcAngle
            {
                get { return arcAngle; }
                set { arcAngle = value; this.Invalidate(); }
            }
          
            protected override void OnPaint(PaintEventArgs e)
            {
                Graphics g = e.Graphics;
                Rectangle rec = new Rectangle(0, 0, this.Width, this.Height);
                SolidBrush solidBrush1 = new SolidBrush(Color.Red);
                SolidBrush solidBrush2 = new SolidBrush(Color.Blue);
                g.FillPie(solidBrush1, rec, 180+arcAngle,180-arcAngle);
                g.FillPie(solidBrush2, rec, 180, arcAngle);
                base.OnPaint(e);
            }
  • 相关阅读:
    博客园停更...
    Linux-常用命令汇总
    Linux-目录结构
    Mysql-python连接操作数据库
    Mysql-概念及常用命令
    Mysql-Sql查询汇总
    Mysql-Sql增删改查
    Mysql-Navicat破解使用
    Mysql-环境配置及问题解决
    Fiddler-AutoResponder替换资源
  • 原文地址:https://www.cnblogs.com/lovezhangyu/p/3399941.html
Copyright © 2011-2022 走看看