Minfu,
When your overriden OnPaint method is called, your first line will be:
protected override OnPaint(PaintEventArgs e)
{
// Call the base implementation.
base.OnPaint(e);
// Perform your painting HERE.
}
In order to know what section to paint, you can access the ClipRectangle
property on the PaintEventArgs instance passed to you as a parameter. This
will let you know what to paint.
As for capturing the form image, you could just get the device context
of the bitmap you are drawing to (getting the Graphics instance, and then
calling GetHDC) and then do the same for the form. Then, you would just
perform a BltBit to copy the image of the form to the bitmap.
--
- Nicholas Paldino [.NET/C# MVP]
-
mv*@spam.guard.caspershouse.com
"Minfu Lu" <Mi*****@discussions.microsoft.com> wrote in message
news:CB**********************************@microsof t.com...
Nicholas,
Capturing forms means to copy the entire form image (including title bar)
to
the clipboard.
What do u mean "calling the base method" ? The problem is if a small
portion
needs to repaint, I really do not know how to redraw it ?
Thanks,
Minfu
"Nicholas Paldino [.NET/C# MVP]" wrote:
Minfu,
What you need to do is maintain the state of what you want to draw in
your form. Then, override the OnPaint method on your Form class, calling
the base method, and then painting your shapes/whatever state you want to
paint on the form.
Then, when the form is invalidated, it will be painted correctly.
What do you mean by capturing forms?
Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com
"Minfu Lu" <Mi*****@discussions.microsoft.com> wrote in message
news:6B**********************************@microsof t.com... > Hi Folks,
>
> I have a VB6 project moved to C+.NET. I got some problem with GDI+.
> 1. VB6 forms have a Autodraw property which allows the Windows to
> repaint
> it
> automatically. But there is not so property of forms in C+.NET. If any
> part
> of a form is covered by another form and when the second one moves
> around
> the
> first form, the content (some 3D color mesh, lines and texts for
> example)
> of
> the covered form disappears. Redrawing the covered form manually when
> the
> form paint event occurs takes a long time. Is there any where to
> simulate
> the
> VB6 Autodraw in C+.NET?
> 2. I need some C+.NET code to capture any forms and client array of
> forms.
>
> Thanks,
>
> Minfu Lu
>
>