Trying to use grab handles to resize a picturebox at runtime, se below. No problem drawing the grab handles but I cant figure out how to wire the grab handles to the respective events.
Any ideas??
Thanks..
DrawGH(System.Windows.Forms.PictureBox p) {
const int hdlSz = 10;
System.Drawing.Graphics g = p.CreateGraphics();
System.Drawing.Point p = new System.Drawing.Point(0,0);
System.Drawing.Size s = new System.Drawing.Size(p.Width,p.Height);
System.Drawing.Rectangle r = new System.Drawing.Rectangle(p,s);
System.Drawing.Rectangle rHandle;
rHandle = new System.Drawing.Rectangle(r.X, r.Y, hdlSz, hdlSz);
System.Windows.Forms.ControlPaint.DrawGrabHandle(g, rHandle, true, true);
rHandle = new System.Drawing.Rectangle(r.X + r.Width/2 - hdlSz/2, r.Y, hdlSz, hdlSz);
System.Windows.Forms.ControlPaint.DrawGrabHandle(g, rHandle, true, true);
rHandle = new System.Drawing.Rectangle(r.X + r.Width - hdlSz, r.Y, hdlSz, hdlSz);
System.Windows.Forms.ControlPaint.DrawGrabHandle(g, rHandle, true, true);
rHandle = new System.Drawing.Rectangle(r.X, r.Y + r.Height/2 - hdlSz/2, hdlSz, hdlSz);
System.Windows.Forms.ControlPaint.DrawGrabHandle(g, rHandle, true, true);
rHandle = new System.Drawing.Rectangle(r.X + r.Width - hdlSz, r.Y + r.Height/2 - hdlSz/2, hdlSz, hdlSz);
System.Windows.Forms.ControlPaint.DrawGrabHandle(g, rHandle, true, true);
rHandle = new System.Drawing.Rectangle(r.X, r.Y + r.Height - hdlSz, hdlSz, hdlSz);
System.Windows.Forms.ControlPaint.DrawGrabHandle(g, rHandle, true, true);
rHandle = new System.Drawing.Rectangle(r.X + r.Width/2 - hdlSz/2, r.Y + r.Height - hdlSz, hdlSz, hdlSz);
System.Windows.Forms.ControlPaint.DrawGrabHandle(g, rHandle, true, true);
rHandle = new System.Drawing.Rectangle(r.X - hdlSz + r.Width, r.Y + r.Height - hdlSz, hdlSz, hdlSz);
System.Windows.Forms.ControlPaint.DrawGrabHandle(g, rHandle, true, true);
}
Any ideas??
Thanks..
DrawGH(System.Windows.Forms.PictureBox p) {
const int hdlSz = 10;
System.Drawing.Graphics g = p.CreateGraphics();
System.Drawing.Point p = new System.Drawing.Point(0,0);
System.Drawing.Size s = new System.Drawing.Size(p.Width,p.Height);
System.Drawing.Rectangle r = new System.Drawing.Rectangle(p,s);
System.Drawing.Rectangle rHandle;
rHandle = new System.Drawing.Rectangle(r.X, r.Y, hdlSz, hdlSz);
System.Windows.Forms.ControlPaint.DrawGrabHandle(g, rHandle, true, true);
rHandle = new System.Drawing.Rectangle(r.X + r.Width/2 - hdlSz/2, r.Y, hdlSz, hdlSz);
System.Windows.Forms.ControlPaint.DrawGrabHandle(g, rHandle, true, true);
rHandle = new System.Drawing.Rectangle(r.X + r.Width - hdlSz, r.Y, hdlSz, hdlSz);
System.Windows.Forms.ControlPaint.DrawGrabHandle(g, rHandle, true, true);
rHandle = new System.Drawing.Rectangle(r.X, r.Y + r.Height/2 - hdlSz/2, hdlSz, hdlSz);
System.Windows.Forms.ControlPaint.DrawGrabHandle(g, rHandle, true, true);
rHandle = new System.Drawing.Rectangle(r.X + r.Width - hdlSz, r.Y + r.Height/2 - hdlSz/2, hdlSz, hdlSz);
System.Windows.Forms.ControlPaint.DrawGrabHandle(g, rHandle, true, true);
rHandle = new System.Drawing.Rectangle(r.X, r.Y + r.Height - hdlSz, hdlSz, hdlSz);
System.Windows.Forms.ControlPaint.DrawGrabHandle(g, rHandle, true, true);
rHandle = new System.Drawing.Rectangle(r.X + r.Width/2 - hdlSz/2, r.Y + r.Height - hdlSz, hdlSz, hdlSz);
System.Windows.Forms.ControlPaint.DrawGrabHandle(g, rHandle, true, true);
rHandle = new System.Drawing.Rectangle(r.X - hdlSz + r.Width, r.Y + r.Height - hdlSz, hdlSz, hdlSz);
System.Windows.Forms.ControlPaint.DrawGrabHandle(g, rHandle, true, true);
}