P
Polaris431
I want to create a floating dialog/window that when moved resembles
the way a MessageBox is moved. When you bring up a MessageBox and
click on the title and drag the MessageBox to a different location, a
frame (also known as border or rectangle) appears over the dimensions
of the MessageBox and while you drag the MessageBox, only this frame
moves while the content area of the frame is transparent.
I have looked up solutions for creating transparent controls but I
believe that this is the wrong solution. For starters, when a
MessageBox is moved, there is no flickering at all. This tells me that
the frame is probably not a control of any sorts, because if it were
it would require that the background be updated very quickly and this
does not appear possible using anything that inherits from a base
control.
I believe that the frame is being drawn as a rectangle on top of a
bitmap of the entire form (or entire screen) and that double buffering
must be used to eliminate flickering. In fact, I wouldn't be surprised
that only the grahic areas behind the actual frame lines are being
updated and nothing within the frame. This allows for the fastest
updating possible while the frame is being moved around.
So, it's possible that when a mouse down even is detected by the
MessageBox control on the title area, a snapshot of the entire form or
screen is taken and then a rectangle is drawn at the same location
where the MessageBox is located. When the user moves the mouse while
it is down, the code is effectively redrawing the frame on a different
location of the snapshot. Then again, maybe I am wrong. Perhaps the
drawing of this MessageBox is an internal piece of code that access
the drawing buffer of the device and simply just draws on it. If this
is so, I am not aware of whether there is an API that would allow me
to do the same. In other words, some API that simply says,
"DrawFrame".
Finally, I also want to be able to resize the dialog/form. A
MessageBox cannot be resized so I would obviously need to come up with
a radically new solution. And while resizing, it cannot flicker.
So my assumption here is that I will probably need to take a snapshot
myself and handle the the moving/resizing. Has anyone done this before
or at least know of an API that lets me take a snapshot of the entire
screen (or just the form) ?
Thank you
Johann
the way a MessageBox is moved. When you bring up a MessageBox and
click on the title and drag the MessageBox to a different location, a
frame (also known as border or rectangle) appears over the dimensions
of the MessageBox and while you drag the MessageBox, only this frame
moves while the content area of the frame is transparent.
I have looked up solutions for creating transparent controls but I
believe that this is the wrong solution. For starters, when a
MessageBox is moved, there is no flickering at all. This tells me that
the frame is probably not a control of any sorts, because if it were
it would require that the background be updated very quickly and this
does not appear possible using anything that inherits from a base
control.
I believe that the frame is being drawn as a rectangle on top of a
bitmap of the entire form (or entire screen) and that double buffering
must be used to eliminate flickering. In fact, I wouldn't be surprised
that only the grahic areas behind the actual frame lines are being
updated and nothing within the frame. This allows for the fastest
updating possible while the frame is being moved around.
So, it's possible that when a mouse down even is detected by the
MessageBox control on the title area, a snapshot of the entire form or
screen is taken and then a rectangle is drawn at the same location
where the MessageBox is located. When the user moves the mouse while
it is down, the code is effectively redrawing the frame on a different
location of the snapshot. Then again, maybe I am wrong. Perhaps the
drawing of this MessageBox is an internal piece of code that access
the drawing buffer of the device and simply just draws on it. If this
is so, I am not aware of whether there is an API that would allow me
to do the same. In other words, some API that simply says,
"DrawFrame".
Finally, I also want to be able to resize the dialog/form. A
MessageBox cannot be resized so I would obviously need to come up with
a radically new solution. And while resizing, it cannot flicker.
So my assumption here is that I will probably need to take a snapshot
myself and handle the the moving/resizing. Has anyone done this before
or at least know of an API that lets me take a snapshot of the entire
screen (or just the form) ?
Thank you
Johann