110,534
社区成员
发帖
与我相关
我的任务
分享
public partial class TdPanel : UserControl
{
[DefaultValue(typeof(Color))]
public Color LineColor
{
get { return LineColor; }
set { LineColor = value; }
}
public TdPanel()
{
InitializeComponent();
}
private void TdPanel_Resize(object sender, EventArgs e)
{
panel1.Size = this.Size;
}
private void panel1_Paint(object sender, PaintEventArgs e)
{
ControlPaint.DrawBorder(e.Graphics,
this.panel1.ClientRectangle,
this.LineColor, //left
1,
ButtonBorderStyle.Solid,
this.LineColor, //top
1,
ButtonBorderStyle.Solid,
this.LineColor, //right
1,
ButtonBorderStyle.Solid,
this.LineColor, //bottom
1,
ButtonBorderStyle.Solid);
}
}
public partial class TdPanel : UserControl
{
private Color lineColor = Color.Red;
[DefaultValue(typeof(Color))]
public Color LineColor
{
get { return lineColor; }
set { lineColor = value; this.Invalidate(); }
}
public TdPanel()
{
InitializeComponent();
}
private void TdPanel_Paint(object sender, PaintEventArgs e)
{
ControlPaint.DrawBorder(e.Graphics,
ClientRectangle,
this.LineColor, //left
1,
ButtonBorderStyle.Solid,
this.LineColor, //top
1,
ButtonBorderStyle.Solid,
this.LineColor, //right
1,
ButtonBorderStyle.Solid,
this.LineColor, //bottom
1,
ButtonBorderStyle.Solid);
}
}
[DefaultValue(typeof(Color),"Gray")]
public Color LineColor
{
get { return LineColor; }
set { LineColor = value; }
}