using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace WindowsFormsApplication1
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
}
private void Form1_Paint(object sender, PaintEventArgs e)
{
}
}
public class LineShape : Label
{
public Color PenColor;
public float _Width;
PointF _StartPoint;
PointF _EndPoint;
public LineShape()
{
PenColor = Color.Black;
_Width = 1.0f;
_StartPoint = new PointF(0.0f, 0.0f);
_EndPoint = new PointF(100.0f, 0.0f);
this.Paint += new PaintEventHandler(LineShape_Paint);
}
void LineShape_Paint(object sender, PaintEventArgs e)
{
Graphics g = e.Graphics;
Pen p = new Pen(PenColor,_Width);
p.DashStyle = System.Drawing.Drawing2D.DashStyle.Dash;
g.DrawLine(p,_StartPoint,_EndPoint);
p.Dispose();
}
public float PenWidth
{
get
{
return _Width;
}
set
{
_Width = value;
this.ppp();
}
}
public PointF StartPoint
{
get
{
return _StartPoint;
}
set
{
_StartPoint = value;
this.ppp();
}
}
public PointF EndPoint
{
get
{
return _EndPoint;
}
set
{
_EndPoint = value;
this.ppp();
}
}
private void ppp()
{
this.ClientSize = new Size((int)_EndPoint.X+1, (int)_EndPoint.Y+1);
}
}
}
dXNpbmcgU3lzdGVtOwp1c2luZyBTeXN0ZW0uQ29sbGVjdGlvbnMuR2VuZXJpYzsKdXNpbmcgU3lzdGVtLkNvbXBvbmVudE1vZGVsOwp1c2luZyBTeXN0ZW0uRGF0YTsKdXNpbmcgU3lzdGVtLkRyYXdpbmc7CnVzaW5nIFN5c3RlbS5MaW5xOwp1c2luZyBTeXN0ZW0uVGV4dDsKdXNpbmcgU3lzdGVtLldpbmRvd3MuRm9ybXM7CgpuYW1lc3BhY2UgV2luZG93c0Zvcm1zQXBwbGljYXRpb24xCnsKICAgIHB1YmxpYyBwYXJ0aWFsIGNsYXNzIEZvcm0xIDogRm9ybQogICAgewogICAgICAgIHB1YmxpYyBGb3JtMSgpCiAgICAgICAgewogICAgICAgICAgICBJbml0aWFsaXplQ29tcG9uZW50KCk7CiAgICAgICAgfQoKICAgICAgICBwcml2YXRlIHZvaWQgRm9ybTFfTG9hZChvYmplY3Qgc2VuZGVyLCBFdmVudEFyZ3MgZSkKICAgICAgICB7CiAgICAgICAgICAgIAogICAgICAgIH0KCiAgICAgICAgcHJpdmF0ZSB2b2lkIEZvcm0xX1BhaW50KG9iamVjdCBzZW5kZXIsIFBhaW50RXZlbnRBcmdzIGUpCiAgICAgICAgewogICAgICAgIH0KICAgIH0KICAgIHB1YmxpYyBjbGFzcyBMaW5lU2hhcGUgOiBMYWJlbAogICAgewogICAgICAgIHB1YmxpYyBDb2xvciBQZW5Db2xvcjsKICAgICAgICBwdWJsaWMgZmxvYXQgX1dpZHRoOwogICAgICAgIFBvaW50RiBfU3RhcnRQb2ludDsKICAgICAgICBQb2ludEYgX0VuZFBvaW50OwogICAgICAgIHB1YmxpYyBMaW5lU2hhcGUoKQogICAgICAgIHsKICAgICAgICAgICAgUGVuQ29sb3IgPSBDb2xvci5CbGFjazsKICAgICAgICAgICAgX1dpZHRoID0gMS4wZjsKICAgICAgICAgICAgX1N0YXJ0UG9pbnQgPSBuZXcgUG9pbnRGKDAuMGYsIDAuMGYpOwogICAgICAgICAgICBfRW5kUG9pbnQgPSBuZXcgUG9pbnRGKDEwMC4wZiwgMC4wZik7CiAgICAgICAgICAgIHRoaXMuUGFpbnQgKz0gbmV3IFBhaW50RXZlbnRIYW5kbGVyKExpbmVTaGFwZV9QYWludCk7CiAgICAgICAgICAgIAogICAgICAgIH0KCiAgICAgICAgdm9pZCBMaW5lU2hhcGVfUGFpbnQob2JqZWN0IHNlbmRlciwgUGFpbnRFdmVudEFyZ3MgZSkKICAgICAgICB7CiAgICAgICAgICAgIEdyYXBoaWNzIGcgPSBlLkdyYXBoaWNzOwogICAgICAgICAgICBQZW4gcCA9IG5ldyBQZW4oUGVuQ29sb3IsX1dpZHRoKTsKICAgICAgICAgICAgcC5EYXNoU3R5bGUgPSBTeXN0ZW0uRHJhd2luZy5EcmF3aW5nMkQuRGFzaFN0eWxlLkRhc2g7CiAgICAgICAgICAgIGcuRHJhd0xpbmUocCxfU3RhcnRQb2ludCxfRW5kUG9pbnQpOwogICAgICAgICAgICBwLkRpc3Bvc2UoKTsKICAgICAgICB9CiAgICAgICAgcHVibGljIGZsb2F0IFBlbldpZHRoCiAgICAgICAgewogICAgICAgICAgICBnZXQKICAgICAgICAgICAgewogICAgICAgICAgICAgICAgcmV0dXJuIF9XaWR0aDsKICAgICAgICAgICAgfQogICAgICAgICAgICBzZXQKICAgICAgICAgICAgewogICAgICAgICAgICAgICAgX1dpZHRoID0gdmFsdWU7CiAgICAgICAgICAgICAgICB0aGlzLnBwcCgpOwogICAgICAgICAgICB9CiAgICAgICAgfQogICAgICAgIHB1YmxpYyBQb2ludEYgU3RhcnRQb2ludAogICAgICAgIHsKICAgICAgICAgICAgZ2V0CiAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgIHJldHVybiBfU3RhcnRQb2ludDsKICAgICAgICAgICAgfQogICAgICAgICAgICBzZXQKICAgICAgICAgICAgewogICAgICAgICAgICAgICAgX1N0YXJ0UG9pbnQgPSB2YWx1ZTsKICAgICAgICAgICAgICAgIHRoaXMucHBwKCk7CgogICAgICAgICAgICB9CiAgICAgICAgfQogICAgICAgIHB1YmxpYyBQb2ludEYgRW5kUG9pbnQKICAgICAgICB7CiAgICAgICAgICAgIGdldAogICAgICAgICAgICB7CiAgICAgICAgICAgICAgICByZXR1cm4gX0VuZFBvaW50OwogICAgICAgICAgICB9CiAgICAgICAgICAgIHNldAogICAgICAgICAgICB7CiAgICAgICAgICAgICAgICBfRW5kUG9pbnQgPSB2YWx1ZTsKICAgICAgICAgICAgICAgIHRoaXMucHBwKCk7CiAgICAgICAgICAgIH0KICAgICAgICB9CiAgICAgICAgcHJpdmF0ZSB2b2lkIHBwcCgpCiAgICAgICAgewogICAgICAgICAgICB0aGlzLkNsaWVudFNpemUgPSBuZXcgU2l6ZSgoaW50KV9FbmRQb2ludC5YKzEsIChpbnQpX0VuZFBvaW50LlkrMSk7CgogICAgICAgIH0KICAgIH0KfQo=