日本综合一区二区|亚洲中文天堂综合|日韩欧美自拍一区|男女精品天堂一区|欧美自拍第6页亚洲成人精品一区|亚洲黄色天堂一区二区成人|超碰91偷拍第一页|日韩av夜夜嗨中文字幕|久久蜜综合视频官网|精美人妻一区二区三区

RELATEED CONSULTING
相關(guān)咨詢
選擇下列產(chǎn)品馬上在線溝通
服務(wù)時間:8:30-17:00
你可能遇到了下面的問題
關(guān)閉右側(cè)工具欄

新聞中心

這里有您想知道的互聯(lián)網(wǎng)營銷解決方案
C#畫線控件的開發(fā)應(yīng)用實例解析

C#畫線控件的應(yīng)用實例介紹之前我們要明白在C#中沒有畫線的控件,這里寫了一個,大家分享。共有兩個控件分別是畫橫線和畫豎線的,關(guān)于怎么畫斜線我還沒沒有,有興趣的可以做一個大家分享。

創(chuàng)新互聯(lián)公司的客戶來自各行各業(yè),為了共同目標(biāo),我們在工作上密切配合,從創(chuàng)業(yè)型小企業(yè)到企事業(yè)單位,感謝他們對我們的要求,感謝他們從不同領(lǐng)域給我們帶來的挑戰(zhàn),讓我們激情的團(tuán)隊有機(jī)會用頭腦與智慧不斷的給客戶帶來驚喜。專業(yè)領(lǐng)域包括成都網(wǎng)站建設(shè)、網(wǎng)站建設(shè)、電商網(wǎng)站開發(fā)、微信營銷、系統(tǒng)平臺開發(fā)。

C#畫線控件之橫線

 
 
 
  1. using System;
  2. using System.Collections;
  3. using System.ComponentModel;
  4. using System.Drawing;
  5. using System.Data;
  6. using System.Windows.Forms;
  7. namespace Jiashi.WinControls
  8. {
  9.  /// 
  10.  /// LineX 畫橫線控件
  11.  /// 
  12.  public class LineX : System.Windows.Forms.UserControl
  13.  {
  14. #region 屬性定義
  15. private System.Drawing.Color lineColor;
  16. private int lineWidth;
  17. /// 
  18. /// 線的顏色屬性
  19. /// 
  20. public System.Drawing.Color LineColor
  21. {
  22.  set
  23.  {
  24. this.lineColor=value;
  25. System.Windows.Forms.PaintEventArgs ep=
  26. new PaintEventArgs(this.CreateGraphics(),
  27. this.ClientRectangle);
  28. this.LineX_Paint(this,ep);
  29.  }
  30.  get{return this.lineColor;}
  31. }
  32. /// 
  33. /// 線的粗細(xì)
  34. /// 
  35. public int LineWidth
  36. {
  37.  set
  38.  {
  39. this.lineWidth=value;
  40. System.Windows.Forms.PaintEventArgs ep=
  41. new PaintEventArgs(this.CreateGraphics(),
  42. this.ClientRectangle);
  43. this.LineX_Paint(this,ep);
  44.  }
  45.  get{return this.lineWidth;}
  46. }
  47. #endregion
  48. private System.ComponentModel.Container components = null;
  49. /// 
  50. /// 構(gòu)造函數(shù)初始顏色和線粗細(xì)
  51. /// 
  52. public LineX()
  53. {
  54.  InitializeComponent();
  55.  this.lineColor=this.ForeColor;
  56.  this.lineWidth=1;
  57. }
  58. /// 
  59. /// 清理所有正在使用的資源。
  60. /// 
  61. protected override void Dispose( bool disposing )
  62. {
  63.  if( disposing )
  64.  {
  65. if(components != null)
  66. {
  67.  components.Dispose();
  68. }
  69.  }
  70.  base.Dispose( disposing );
  71. }
  72. #region 組件設(shè)計器生成的代碼
  73. /// 
  74. /// 設(shè)計器支持所需的方法 - 不要使用代碼編輯器 
  75. /// 修改此方法的內(nèi)容。
  76. /// 
  77. private void InitializeComponent()
  78. {
  79.  // 
  80.  // LineX
  81.  // 
  82.  this.Name = "LineX";
  83.  this.Resize += new System.EventHandler(this.LineX_Resize);
  84.  this.Paint += 
  85. new System.Windows.Forms.PaintEventHandler(this.LineX_Paint);
  86. }
  87. #endregion
  88. private void LineX_Paint(object sender,
  89.  System.Windows.Forms.PaintEventArgs e)
  90. {
  91.  Graphics g=e.Graphics;
  92.  Pen myPen = new Pen(this.lineColor);
  93.  myPen.Width=this.lineWidth*2;
  94.  this.Height=this.LineWidth;
  95.  g.DrawLine(myPen,0,0,e.ClipRectangle.Right,0);
  96. }
  97. private void LineX_Resize(object sender, System.EventArgs e)
  98. {
  99.  this.Height=this.lineWidth;
  100. }
  101.  }
  102. }

C#畫線控件之豎線

 
 
 
  1. using System;
  2. using System.Collections;
  3. using System.ComponentModel;
  4. using System.Drawing;
  5. using System.Data;
  6. using System.Windows.Forms;
  7. namespace Jiashi.WinControls
  8. {
  9.  /// 
  10.  /// LineY 畫豎線控件
  11.  /// 
  12.  public class LineY : System.Windows.Forms.UserControl
  13.  {
  14. #region 屬性定義
  15. private System.Drawing.Color lineColor;
  16. private int lineWidth;
  17. /// 
  18. /// 線的顏色屬性
  19. /// 
  20. public System.Drawing.Color LineColor
  21. {
  22.  set
  23.  {
  24. this.lineColor=value;
  25. System.Windows.Forms.PaintEventArgs ep=
  26. new PaintEventArgs(this.CreateGraphics(),
  27. this.ClientRectangle);
  28. this.LineY_Paint(this,ep);
  29.  }
  30.  get{return this.lineColor;}
  31. }
  32. /// 
  33. /// 線的粗細(xì)
  34. /// 
  35. public int LineWidth
  36. {
  37.  set
  38.  {
  39. this.lineWidth=value;
  40. System.Windows.Forms.PaintEventArgs ep=
  41. new PaintEventArgs(this.CreateGraphics(),
  42. this.ClientRectangle);
  43. this.LineY_Paint(this,ep);
  44.  }
  45.  get{return this.lineWidth;}
  46. }
  47. #endregion
  48. private System.ComponentModel.Container components = null;
  49. /// 
  50. /// 構(gòu)造函數(shù)初始顏色和線粗細(xì)
  51. /// 
  52. public LineY()
  53. {
  54.  InitializeComponent();
  55.  this.lineColor=this.ForeColor;
  56.  this.lineWidth=1;
  57. }
  58. /// 
  59. /// 清理所有正在使用的資源。
  60. /// 
  61. protected override void Dispose( bool disposing )
  62. {
  63.  if( disposing )
  64.  {
  65. if(components != null)
  66. {
  67.  components.Dispose();
  68. }
  69.  }
  70.  base.Dispose( disposing );
  71. }
  72. #region 組件設(shè)計器生成的代碼
  73. /// 
  74. /// 設(shè)計器支持所需的方法 - 不要使用代碼編輯器 
  75. /// 修改此方法的內(nèi)容。
  76. /// 
  77. private void InitializeComponent()
  78. {
  79.  // 
  80.  // LineY
  81.  // 
  82.  this.Name = "LineY";
  83.  this.Resize += 
  84. new System.EventHandler(this.LineY_Resize);
  85.  this.Paint += 
  86. new System.Windows.Forms.PaintEventHandler(this.LineY_Paint);
  87. }
  88. #endregion
  89. private void LineY_Paint(
  90. object sender, System.Windows.Forms.PaintEventArgs e)
  91. {
  92.  Graphics g=e.Graphics;
  93.  Pen myPen = new Pen(this.lineColor);
  94.  myPen.Width=this.lineWidth*2;
  95.  this.Width=this.LineWidth;
  96.  g.DrawLine(myPen,0,0,0,e.ClipRectangle.Bottom);
  97. }
  98. private void LineY_Resize(
  99. object sender, System.EventArgs e)
  100. {
  101.  this.Width=this.lineWidth;
  102. }
  103.  }
  104. }

C#畫線控件的開發(fā)就向你介紹到這里,希望對你了解和學(xué)習(xí)C#畫線控件有所幫助。


分享題目:C#畫線控件的開發(fā)應(yīng)用實例解析
文章路徑:http://www.dlmjj.cn/article/coojgdj.html