943,762 Members | Top Members by Rank

Ad:
  • C++ Discussion Thread
  • Unsolved
  • Views: 2866
  • C++ RSS
Sep 18th, 2008
0

drawline

Expand Post »
How do you draw on an image in visual studio 2005 and get it to stay? Ive can get it to draw, but it flickers on resize and disappears when the resize is done. Any ideas?
Similar Threads
Reputation Points: 10
Solved Threads: 2
Junior Poster in Training
Nemoticchigga is offline Offline
98 posts
since Feb 2008
Sep 18th, 2008
0

Re: drawline

Could you post the code that you're using?
Moderator
Featured Poster
Reputation Points: 4142
Solved Threads: 394
Industrious Poster
Nick Evan is offline Offline
4,132 posts
since Oct 2006
Sep 18th, 2008
0

Re: drawline

This is the code I use to load the image

C++ Syntax (Toggle Plain Text)
  1. Map->Image = System::Drawing::Image::FromFile("test_map1.bmp");
  2. Map->Height = Map->Image->Height;
  3. Map->Width = Map->Image->Width;
  4. Map->Left = 0;
  5. Map->Top = 0;
  6. this->Height = Map->Image->Height;
  7. this->Width = Map->Image->Width;

And this is what I want to draw on it.

C++ Syntax (Toggle Plain Text)
  1. Graphics^ grfx = Map->CreateGraphics();
  2. Pen^ myPen = gcnew Pen(Color::Yellow, 3);
  3.  
  4. grfx->DrawLine(myPen, this->Map->Width/2, this->Map->Height/2, this->Map->Width/2 + 10, this->Map->Height/2);
  5. grfx->DrawLine(myPen, this->Map->Width/2, this->Map->Height/2, this->Map->Width/2, this->Map->Height/2 - 10);
  6. grfx->DrawLine(myPen, this->Map->Width/2, this->Map->Height/2, this->Map->Width/2 - 10, this->Map->Height/2);
  7. grfx->DrawLine(myPen, this->Map->Width/2, this->Map->Height/2, this->Map->Width/2, this->Map->Height/2 + 20);
Reputation Points: 10
Solved Threads: 2
Junior Poster in Training
Nemoticchigga is offline Offline
98 posts
since Feb 2008

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in C++ Forum Timeline: Select Row in TextBox
Next Thread in C++ Forum Timeline: Link two window forms





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC