|
||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Announcements
Want a new Job?
Chapters
Services
Feature Zones
|
IntroductionHere, in continuation to my previous article, I present two more methods to do the same. Method 1 Project Name: ReversePaintAs suggested by a reader, we do have an equivalent to Method 2 Project Name: WindowPosChangingHere I take a totally new approach. As one can see, resizing and Dragging and Dropping the selection rectangle needs to behave like a normal window, then why not use a normal window to do the same? So Windows will handle resize and other features automatically. For this, the Window (which is actually going to be a form, let us call it the There is a Win32-API specifically for it, namely: [DllImport("user32.dll")]
public static extern long SetLayeredWindowAttributes
(IntPtr Handle, int Clr, byte transparency, int clrkey);
The fourth parameter But there is one down side to it - it will not create a hole in child windows (forms), this API will work only in a Pop-Up Window. Now our When handing this message, I just ensure that The handling of the message works two fold:
protected override void OnMove(EventArgs e)
{
if (chFrm != null)
{
MoveWindow(chFrm.Handle, chFrm.Location.X, chFrm.Location.Y,
chFrm.Size.Width, chFrm.Size.Height, true);
MinimumSize = new Size(chFrm.Size.Width + 100, chFrm.Size.Height);
}
base.OnMove(e);
}
Please note that the This is kind of a free gift, just move the Main form all over your desktop and see how the That's all for the resize feature, now for the Drag And Drop feature. Since the form has a hole in it, a user can drag-drop the This is achieved by overriding the Mouse-move function and inside it, I call the History
|
|||||||||||||||||||||||||||||||||||||||||||||||||||