c#画图问题 急!!!
我现在要画一个矩形框或者圆,并且可以像word中那样选中,并且还可以拖动放大、缩小、旋转,请问高手这种问题在c#中是如何实现的?
将要画的图形写成各种控件,向一个容器内动态添加,并可修改它们的属性
/// <summary>
/// 椭圆
/// </summary>
public partial class OvalShape : UserControl
{
public OvalShape()
{
SetStyle(ControlStyles.SupportsTransparentBackColor | ControlStyles.ResizeRedraw, true);
SetStyle(ControlStyles.Selectable, false);
InitializeComponent();
}
[UserBrowerAble(), Browsable(true), Description("文本"), Category("椭圆框属性")]
public string text
{
get
{
return this.Text;
}
set
{
this.Text = value;
}
}
[UserBrowerAble(), Browsable(true), Description("控件位置"), Category("椭圆框属性")]
public Point location
{
get
{
return this.Location;
}
set
{
this.Location = value;
}
}
[UserBrowerAble(), Browsable(true), Description("控件大小"), Category("椭圆框属性")]
public Size size
{
get
{
return this.Size;
}
set
{
this.Size = value;
}
}
protected override void OnPaint(PaintEventArgs e)
{
base.OnPaint(e);
e.Graphics.DrawEllipse(new Pen(this.ForeColor, 1F),0,0,this.Width-2,this.Height-2);
}
}
[ 本帖最后由 xydddaxia 于 2011-11-25 17:56 编辑 ]