我有一个自定义的C用户控件,我想在其中绘制一个圆
后面
锚定到控件中心底部的文本框。我画的圆是:
protected override void OnResize(EventArgs e)
{
this.gp= new GraphicsPath();
this.gp.AddEllipse(0,0,width,height); //this is the width and height of the control
this.Region=new Region(this.gp);
this.Refresh();
base.OnResize (e);
}
protected override void OnPaint(PaintEventArgs pe)
{
Color centerColor = Color.FromArgb(255,255,255,255);
Color surroundColor = Color.FromArgb(255,255,255,255);
PathGradientBrush br=new PathGradientBrush(this.gp);
br.CenterColor=centerColor;
br.SurroundColors=new Color[]{surroundColor};
pe.Graphics.FillPath(br,this.gp);
}
我已经将文本框添加到了GUI设计器中的控件中。
当我运行这个程序时,结果是这样的:
alt text http://i47.tinypic.com/2pyrxbk.jpg
如何将椭圆保持在文本框后面?
谢谢,
作记号