fork download
  1. using System;
  2. using System.Collections.Generic;
  3. using System.ComponentModel;
  4. using System.Data;
  5. using System.Drawing;
  6. using System.Linq;
  7. using System.Text;
  8. using System.Windows.Forms;
  9.  
  10. namespace WindowsFormsApplication1
  11. {
  12. public partial class Form1 : Form
  13. {
  14. public Form1()
  15. {
  16. InitializeComponent();
  17. }
  18.  
  19. private void Form1_Load(object sender, EventArgs e)
  20. {
  21.  
  22. }
  23.  
  24. private void Form1_Paint(object sender, PaintEventArgs e)
  25. {
  26. }
  27. }
  28. public class LineShape : Label
  29. {
  30. public Color PenColor;
  31. public float _Width;
  32. PointF _StartPoint;
  33. PointF _EndPoint;
  34. public LineShape()
  35. {
  36. PenColor = Color.Black;
  37. _Width = 1.0f;
  38. _StartPoint = new PointF(0.0f, 0.0f);
  39. _EndPoint = new PointF(100.0f, 0.0f);
  40. this.Paint += new PaintEventHandler(LineShape_Paint);
  41.  
  42. }
  43.  
  44. void LineShape_Paint(object sender, PaintEventArgs e)
  45. {
  46. Graphics g = e.Graphics;
  47. Pen p = new Pen(PenColor,_Width);
  48. p.DashStyle = System.Drawing.Drawing2D.DashStyle.Dash;
  49. g.DrawLine(p,_StartPoint,_EndPoint);
  50. p.Dispose();
  51. }
  52. public float PenWidth
  53. {
  54. get
  55. {
  56. return _Width;
  57. }
  58. set
  59. {
  60. _Width = value;
  61. this.ppp();
  62. }
  63. }
  64. public PointF StartPoint
  65. {
  66. get
  67. {
  68. return _StartPoint;
  69. }
  70. set
  71. {
  72. _StartPoint = value;
  73. this.ppp();
  74.  
  75. }
  76. }
  77. public PointF EndPoint
  78. {
  79. get
  80. {
  81. return _EndPoint;
  82. }
  83. set
  84. {
  85. _EndPoint = value;
  86. this.ppp();
  87. }
  88. }
  89. private void ppp()
  90. {
  91. this.ClientSize = new Size((int)_EndPoint.X+1, (int)_EndPoint.Y+1);
  92.  
  93. }
  94. }
  95. }
  96.  
Not running #stdin #stdout 0s 0KB
stdin
Standard input is empty
stdout
Standard output is empty