关于C# Winfrom, PictureBox 控件大小变化问题

来源:百度知道 编辑:UC知道 时间:2024/05/21 03:07:30
怎样实现在程序运行时,PictureBox能像在窗体编辑时 大小可以随鼠标的拖拽二改变。。。

Rectangle r1;
Rectangle r2;
Rectangle r3;
private void pictureBox1_MouseDown(object sender, MouseEventArgs e)
{
int x = this.pictureBox1.Parent.Left + this.pictureBox1.Left + 4;
int y = this.pictureBox1.Parent.Top + this.pictureBox1.Top + 30;
Rectangle rec = new Rectangle(x, y, this.pictureBox1.Width, this.pictureBox1.Height);
ControlPaint.DrawReversibleFrame(rec, Color.Black, FrameStyle.Dashed);

r1 = new Rectangle(x - 3, y - 4, 5, 5);
ControlPaint.DrawReversibleFrame(r1, Color.Black, FrameStyle.Thick);
r2 = new Rectangle(x-2, y - 4 + this.pictureBox1.Height / 2, 5, 5);
ControlPaint.DrawReversibleFrame(r2, Color.Black, FrameStyle.Thick);
r3 = new Rectangle(x - 4, y - 4 + this.pictureBox1.Height+4, 5, 5);
ControlPaint.DrawReversibleFrame(r3, Color.Black, Frame