Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Visual Studio.NET / General / June 2005

Tip: Looking for answers? Try searching our database.

Graphics Vanish when Window is Over

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Marcelo - 07 Jun 2005 07:51 GMT
Greetings!
I am developping a multiple forms Windows Forms application in Visual
Studio C++ .NET 2003 and I need to draw graphics into a group box. In
order to do this I use:

private: System::Void button1_Click(System::Object *  sender,
System::EventArgs *  e)    {
    Graphics* graph= Graphics::FromHwnd(this->groupBox1->Handle);
    graph->DrawLine(new Pen(Color::Blue),20,20,50,50);//whatever...
}

It works. But the problem is: when I minimize and maximize again the
window, or when I put any window over my graphic, it vanishes! What
could I do in order to make the graphics stable?
If anybody could help anyway, I thank very much
Garry Freemyer - 07 Jun 2005 16:54 GMT
Ok, basically, you need to do your graphics in a paint event. When you don't
do them in paint events or don't call your drawing stuff from paint events,
your graphics vanish, but since windows expects the programmer to put the
drawing stuff in the paint event in events where it needs to be redrawn,
your stuff vanishes.

Check out Bob Powell's excellent FAQ site on GDI+ graphics. It has a lot of
nice info there ...

http://www.bobpowell.net/faqmain.htm

> Greetings!
> I am developping a multiple forms Windows Forms application in Visual
[quoted text clipped - 11 lines]
> could I do in order to make the graphics stable?
> If anybody could help anyway, I thank very much
Marcelo - 08 Jun 2005 08:37 GMT
Thank you very much! And the FAQ site is really very good. Now in my
favourites :o)
Marcelo Schio

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.