亚洲乱码中文字幕综合,中国熟女仑乱hd,亚洲精品乱拍国产一区二区三区,一本大道卡一卡二卡三乱码全集资源,又粗又黄又硬又爽的免费视频

C#進(jìn)度軸控件分享

 更新時(shí)間:2015年06月04日 15:58:24   投稿:hebedich  
這里給大家介紹的是使用C#實(shí)現(xiàn)的進(jìn)度軸的方法和示例,非常的實(shí)用,有需要的小伙伴可以參考下。

當(dāng)執(zhí)行長時(shí)間后臺(tái)處理時(shí),你是否希望軟件給你一個(gè)反饋,讓你了解程序執(zhí)行進(jìn)度。進(jìn)度軸幫你忙,輕松掌握全局動(dòng)態(tài)。你的進(jìn)度你做主!進(jìn)度軸分為橫版和縱版總有一版適合你!

應(yīng)用了事件機(jī)制假如有更好的方法歡迎交流,假如對您有用請頂一下。

載入時(shí)間軸控件

/// <summary>
   /// 載入時(shí)間軸控件
   /// 2015-04-16
   /// 吳海龍
   /// </summary>
   public void LoadTimeAxis()
   {
     SortedDictionary<string, string> sdict = new SortedDictionary<string, string>();
     sdict.Add("1", "讀取配置");
     sdict.Add("2", "選擇模板");
     sdict.Add("3", "確認(rèn)數(shù)據(jù)");
     sdict.Add("4", "生成代碼");
     uta = new uctlTimeAxis(sdict,1);
     uta.lc = new ToolFunction.uctlTimeAxis.TimeAxisClick(SayHello);
     CommonFunction.AddForm3(splitContainer4.Panel2, uta);
   }

panel容器中添加控件

/// <summary>
    /// 項(xiàng)panel容器中添加控件
    /// </summary>
    /// <param name="p">容器panel</param>
    /// <param name="uc">顯示的usercontrol</param>
    public static void AddForm3(Panel p, UserControl uc)
    {
      p.Controls.Clear();
      p.Controls.Add(uc);
      uc.Dock = DockStyle.Fill;
 
    }

初始化縱版界面

/// <summary>
    /// 初始化垂直進(jìn)度軸
    /// 2015-04-15
    /// 吳海龍
    /// </summary>
    public void InitVerticalTimeAxis()
    {
      try
      {
        int TempCenterOfThePieY = CenterOfTheCircleY;
        using (Graphics g = this.CreateGraphics())
        {
          g.SmoothingMode = SmoothingMode.HighQuality; //使繪圖質(zhì)量最高,即消除鋸齒
          g.InterpolationMode = InterpolationMode.HighQualityBicubic;
          g.CompositingQuality = CompositingQuality.HighQuality;
          g.DrawString("正在執(zhí)行:", f1, Brushes.Black, new PointF(CenterOfTheCircleX, 5));
          g.DrawLine(p3, new Point(LineStartX, TempCenterOfThePieY), new Point(LineStartX, (sdict.Keys.Count - 1) * CircleSpace + TempCenterOfThePieY));
          foreach (var item in sdict.Keys)
          {
            g.FillEllipse(Brushes.Gray, CenterOfTheCircleX - CircleRadius, TempCenterOfThePieY - CircleRadius, CircleRadius * 2, CircleRadius * 2);
            g.FillEllipse(Brushes.White, CenterOfTheCircleX - PieRadius2, TempCenterOfThePieY - PieRadius2, PieRadius2 * 2, PieRadius2 * 2);
            g.DrawString(sdict[item], f1, Brushes.DarkGray, new PointF(ItemStartX, TempCenterOfThePieY - ItemFixY));
            Label l = new Label();
            l.Name = item;
            l.Location = new Point(ItemStartX,TempCenterOfThePieY - ItemFixY);
            l.Text = sdict[item];
            l.Click +=new EventHandler(l_Click);
 
            //l.Click += new EventHandler(l_Click2);
            this.Controls.Add(l);
            TempCenterOfThePieY = TempCenterOfThePieY + CircleSpace;
          }
        }
      }
      catch (Exception exp)
      {
        CommonFunction.WriteLog(exp, "繪制失敗");
      }
}

縱版進(jìn)度軸步進(jìn)方法

/// <summary>
    /// 垂直步進(jìn)方法
    /// /// 2015-04-16
    /// 吳海龍
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    public void SetVerticalStep(object sender, KeyValueEventArgs e)
    {
      int TempCenterOfThePieY = CenterOfTheCircleY;
      if ("" == KeyValueEventArgs.Key)
      {
        return;
      }
      using (Graphics g = this.CreateGraphics())
      {
        g.SmoothingMode = SmoothingMode.HighQuality; //使繪圖質(zhì)量最高,即消除鋸齒
        g.InterpolationMode = InterpolationMode.HighQualityBicubic;
        g.CompositingQuality = CompositingQuality.HighQuality;
        foreach (var item in sdict.Keys)
        {
          g.DrawString(sdict[item], f1, Brushes.Green, ItemStartX, TempCenterOfThePieY - ItemFixY);
          g.DrawEllipse(Pens.Green, CenterOfTheCircleX - CircleRadius, TempCenterOfThePieY - CircleRadius, CircleRadius * 2, CircleRadius * 2);
          g.DrawLine(p2, new Point(LineStartX, LineStartY), new Point(LineStartX, TempCenterOfThePieY));
          g.FillEllipse(Brushes.Green, CenterOfTheCircleX - PieRadius, TempCenterOfThePieY - PieRadius, PieRadius * 2, PieRadius * 2);
          if (item == KeyValueEventArgs.Key)
          {
            break;
          }
          TempCenterOfThePieY = TempCenterOfThePieY + CircleSpace;
        }
      }
}

畫圖屬性字段

/// <summary>
   /// 藍(lán)色寬2
   /// </summary>
   static Pen p1 = new Pen(Color.Blue, 2);
   /// <summary>
   /// 綠色寬3
   /// </summary>
   static Pen p2 = new Pen(Color.Green, 3);
   /// <summary>
   /// 灰色寬1
   /// </summary>
   static Pen p3 = new Pen(Color.Gray, 1);
   /// <summary>
   /// 微軟雅黑
   /// </summary>
   static Font f1 = new Font("微軟雅黑", 9, FontStyle.Regular);
   /// <summary>
   /// 圓心X坐標(biāo)
   /// </summary>
   public static int CenterOfTheCircleX = 31;
   /// <summary>
   /// 圓心Y坐標(biāo)
   /// </summary>
   public static int CenterOfTheCircleY = 46;
   /// <summary>
   /// 說明條目X坐標(biāo)
   /// </summary>
   public static int ItemStartX = 45;
   /// <summary>
   /// 條目X修正量
   /// </summary>
   public static int ItemFixX = -20;
   /// <summary>
   /// 條目Y修正量
   /// </summary>
   public static int ItemFixY = 10;
   public static Point CenterOfThePie = new Point(CenterOfTheCircleX, CenterOfTheCircleY);
   /// <summary>
   /// 命中Pie半徑
   /// </summary>
   public static int PieRadius = 6;
   /// <summary>
   /// 白點(diǎn)Pie半徑
   /// </summary>
   public static int PieRadius2 = 8;
   /// <summary>
   /// 圓半徑
   /// </summary>
   public static int CircleRadius = 9;
   /// <summary>
   /// 圓心距
   /// </summary>
   public static int CircleSpace = 80;
   /// <summary>
   /// 軸X起點(diǎn)
   /// </summary>
   public static int LineStartX = CenterOfTheCircleX;
   /// <summary>
   /// 軸Y起點(diǎn)
   /// </summary>
   public static int LineStartY = CenterOfTheCircleY;
   /// <summary>
   /// 內(nèi)部Key定義
   /// </summary>
   public static string Key = "";
   /// <summary>
   /// 繪圖事件
   /// </summary>
   public event EventHandler<KeyValueEventArgs> KeyValueChangeEventHandler;
 
   public delegate void LabelClickEventHandler(object sender, LabelClickEventArgs e);
 
   //public event LabelClickEventHandler<LabelClickEventArgs> ;
 
   public delegate void TimeAxisClick();
 
   public TimeAxisClick lc = null;
 
   public delegate void TimeAxisClick2(string labelName);
 
   public TimeAxisClick2 lc2 = null;
   /// <summary>
   /// 流程字典
   /// </summary>
   public static SortedDictionary<string, string> sdict = new SortedDictionary<string, string>();
   /// <summary>
   /// 水平標(biāo)示
   /// </summary>
   private static readonly int HorizontalTimeAxis = 0;
   /// <summary>
   /// 垂直標(biāo)志
   /// </summary>
   private static readonly int VerticalTimeAxis = 1;
 
   /// <summary>
   /// 繪制標(biāo)志,0為水平;1為垂直。
   /// </summary>
   public static int TimeAxisModle = 0;

構(gòu)造方法

#region 構(gòu)造方法
    public uctlTimeAxis()
    {
      InitializeComponent();
    }
 
    public uctlTimeAxis(SortedDictionary<string, string> s)
    {
      InitializeComponent();
      if (sdict != null)
      {
        sdict = s;
      }
    }
 
    public uctlTimeAxis(SortedDictionary<string, string> s, int model)
    {
      InitializeComponent();
      if (sdict != null)
      {
        sdict = s;
        TimeAxisModle = model;
        if (HorizontalTimeAxis==TimeAxisModle)
        {
          KeyValueChangeEventHandler += new EventHandler<KeyValueEventArgs>(SetHorizontalStep);
        }
        else if (VerticalTimeAxis==TimeAxisModle)
        {
          KeyValueChangeEventHandler += new EventHandler<KeyValueEventArgs>(SetVerticalStep);
        }
      }
    }
#endregion

 Key值轉(zhuǎn)變

/// <summary>
   /// Key值轉(zhuǎn)變
   /// </summary>
   public class KeyValueEventArgs : EventArgs
   {
     public static string Key = "";
 
     public KeyValueEventArgs(string s)
     {
       Key = s;
     }
   }

以上所述就是本文的全部內(nèi)容了,希望大家能夠喜歡。

相關(guān)文章

  • C# AE之返回上一級(jí)和下一級(jí)的實(shí)戰(zhàn)操作

    C# AE之返回上一級(jí)和下一級(jí)的實(shí)戰(zhàn)操作

    這篇文章主要介紹了C# AE之返回上一級(jí)和下一級(jí)的實(shí)戰(zhàn)操作,具有很好的參考價(jià)值,希望對大家有所幫助。一起跟隨小編過來看看吧
    2021-01-01
  • 基于WPF實(shí)現(xiàn)步驟控件的示例代碼

    基于WPF實(shí)現(xiàn)步驟控件的示例代碼

    這篇文章主要為大家詳細(xì)介紹了WPF實(shí)現(xiàn)簡單的步驟控件,文中的示例代碼講解詳細(xì),對我們學(xué)習(xí)或工作有一定幫助,感興趣的小伙伴可以了解一下
    2023-01-01
  • WinForm實(shí)現(xiàn)狀態(tài)欄跑馬燈效果的方法示例

    WinForm實(shí)現(xiàn)狀態(tài)欄跑馬燈效果的方法示例

    這篇文章主要介紹了WinForm實(shí)現(xiàn)狀態(tài)欄跑馬燈效果的方法,涉及WinForm控件結(jié)合時(shí)間函數(shù)動(dòng)態(tài)操作元素屬性的相關(guān)技巧,需要的朋友可以參考下
    2017-07-07
  • C# 中的IComparable和IComparer的使用及區(qū)別

    C# 中的IComparable和IComparer的使用及區(qū)別

    這篇文章主要介紹了C# 中的IComparable和IComparer的使用及區(qū)別,文中通過示例代碼介紹的非常詳細(xì),對大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面隨著小編來一起學(xué)習(xí)學(xué)習(xí)吧
    2020-01-01
  • C#中數(shù)組、ArrayList、List、Dictionary的用法與區(qū)別淺析(存取數(shù)據(jù))

    C#中數(shù)組、ArrayList、List、Dictionary的用法與區(qū)別淺析(存取數(shù)據(jù))

    在工作中經(jīng)常遇到C#數(shù)組、ArrayList、List、Dictionary存取數(shù)據(jù),但是該選擇哪種類型進(jìn)行存儲(chǔ)數(shù)據(jù)呢?很迷茫,今天小編抽空給大家整理下這方面的內(nèi)容,需要的朋友參考下吧
    2017-02-02
  • C#實(shí)現(xiàn)餐廳管理系統(tǒng)

    C#實(shí)現(xiàn)餐廳管理系統(tǒng)

    這篇文章主要為大家詳細(xì)介紹了C#實(shí)現(xiàn)餐廳管理系統(tǒng),具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下
    2019-01-01
  • 詳解c# Emit技術(shù)

    詳解c# Emit技術(shù)

    這篇文章主要介紹了c# Emit技術(shù)的相關(guān)資料,幫助大家更好的理解和使用c#,感興趣的朋友可以了解下
    2020-12-12
  • C#微信開發(fā)第一章

    C#微信開發(fā)第一章

    這篇文章主要為大家詳細(xì)介紹了C#微信開發(fā)第一章,很有參考價(jià)值和實(shí)用性,感興趣的小伙伴們可以參考一下
    2016-07-07
  • C#命令行參數(shù)解析庫System.CommandLine使用

    C#命令行參數(shù)解析庫System.CommandLine使用

    System.CommandLine是一個(gè)基于.Net Standard 2.0的命令行參數(shù)解析庫,該項(xiàng)目還是屬于beta狀態(tài),期待以后的正式版本,文章通過示例代碼給大家介紹了System.CommandLine使用講解,感興趣的朋友一起看看吧
    2021-06-06
  • C#中的ComboBox控件詳細(xì)使用方法

    C#中的ComboBox控件詳細(xì)使用方法

    這篇文章主要給大家介紹了關(guān)于C#中ComboBox控件詳細(xì)使用的相關(guān)資料,ComboBox控件是一個(gè)很容易使用出錯(cuò)的控件,在此將常用的操作寫下來,以備后用,需要的朋友可以參考下
    2023-09-09

最新評論