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);
            }
  • 相关阅读:
    python爬虫
    绕过CDN查找网站真实IP方法收集
    拖库
    伪静态注入的总结
    国外安全网站信息收集
    python字典去重脚本
    AOP 的利器:ASM 3.0 介绍
    JDK工具
    JVM性能调优监控工具
    DMZ
  • 原文地址:https://www.cnblogs.com/lovezhangyu/p/3399941.html
Copyright © 2011-2022 走看看