具体方法是什么?才开始接触C#,请多多指教.
解决方案 »
- winform 动态用户控件 传值的问题 .....
- C# 将按钮控件封装为用户控件
- 我想要个漂亮的button和textbox控件 vs2003下用
- 急,在.net 里,用c# 连接ms sql 2k 时,用该字符串连接本台电脑的数据据时,却可以的,但连接到网络上的其它的一台电脑时,就超时,总是超时,为
- 高级皮肤库skinctrl 源码
- 有什么好书吗??专门介绍VS里面web控件和winform控件使用的好书吗?
- 关于注册界面的注册年月日,得生成问题~!在线等
- 用编码做主键好还是单独开一个主键字段好
- 大家帮忙做下题目,高分送,在线等!!!
- 两个问题,打开网页和发送邮件?
- 没人知道么?再发!!!
- ASP.NET问题
或是 自定义控件
第二步:重写paint事件
可以看看我画的圆作为红绿灯的灯.
连接http://community.csdn.net/Expert/topic/4707/4707165.xml?temp=.2129785
{
/// <summary>
/// myArcLabel 的摘要说明。
/// </summary>
public class myEllipseLabel:System.Windows.Forms.Label
{
private System.Drawing.Pen _pen;
private int _PenWidth = 2;//线宽,描边的线的宽度
private System.Drawing.Rectangle EllipseRect;//边缘尺寸 public myEllipseLabel():base()
{
EllipseRect = new System.Drawing.Rectangle(0,0,150,150);
}
protected override void InitLayout()
{
System.Drawing.Drawing2D.GraphicsPath path =
new System.Drawing.Drawing2D.GraphicsPath();
path.AddEllipse(this.ClientRectangle);
EllipseRect = this.ClientRectangle;
EllipseRect.Width -= (_PenWidth + 1);
EllipseRect.Height -= (_PenWidth + 1);
this.Region = new System.Drawing.Region(path);
base.InitLayout ();
}
protected override void OnPaintBackground(System.Windows.Forms.PaintEventArgs pevent)
{
base.OnPaintBackground (pevent);
if (_pen==null)
{
_pen = new System.Drawing.Pen(this.ForeColor,_PenWidth);
}
pevent.Graphics.DrawEllipse(_pen,EllipseRect);
} }
}//刚写了个类。貌似可以完成你的想法。设计的时候还可以改变尺寸。
this.label1.Location = new System.Drawing.Point(48, 40);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(176, 112);
this.label1.TabIndex = 0;
this.label1.Text = "\r\n\r\n TestMyLabel";
//调用的
代码:
http://community.csdn.net/Expert/topic/4707/4707165.xml?temp=.875149