Keith Chapman

I have create a custom PictureBox that the user can select the edges and drag to resize, however, I cant get the DrawReversibleFrame to work as I want. Inside of the custom control, I have the MouseDown event set the _OriginalLoc point:

Control control = (Control)sender;

_OriginalLoc = control.PointToScreen(new Point(e.X, e.Y));

The in the MouseMove event I have the following:

ControlPaint.DrawReversibleFrame(Rectangle, Color.Black, FrameStyle.Thick);

Point endPoint = this.PointToScreen(new Point(e.X, e.Y));

int width = endPoint.X - _OriginalLoc.X;

int height = endPoint.Y - _OriginalLoc.Y;

Rectangle = new Rectangle(_OriginalLoc.X, _OriginalLoc.Y, width, height);

ControlPaint.DrawReversibleFrame(Rectangle, Color.Black, FrameStyle.Thick);

It draws fine, but it appears behind the actual form, instead of on the top. Any ideas




Re: Windows Forms General DrawReversibleFrame drawing behind form

zenguitar

Does it have to do with changing the focus of the frame




Re: Windows Forms General DrawReversibleFrame drawing behind form

nobugz

I assume you mean it is painting behind the PictureBox, behind the form would be a major trick. Yes, you are drawing on the form surface and it is clipped by the PB window. You'll have to put a window on top of both the form and the PB and draw on it to get it to work properly. Check this thread for a solution.