Click here to Skip to main content
15,897,273 members
Home / Discussions / Managed C++/CLI
   

Managed C++/CLI

 
GeneralRe: Testing if Elevated Process Pin
Mark Salsbery27-Apr-09 11:11
Mark Salsbery27-Apr-09 11:11 
QuestionGetting the Brush to apply to pictureBox instead of Form Pin
Jeffrey Webster26-Apr-09 19:55
Jeffrey Webster26-Apr-09 19:55 
AnswerRe: Getting the Brush to apply to pictureBox instead of Form Pin
Luc Pattyn27-Apr-09 0:58
sitebuilderLuc Pattyn27-Apr-09 0:58 
GeneralRe: Getting the Brush to apply to pictureBox instead of Form Pin
Jeffrey Webster27-Apr-09 3:13
Jeffrey Webster27-Apr-09 3:13 
GeneralRe: Getting the Brush to apply to pictureBox instead of Form Pin
Luc Pattyn27-Apr-09 3:43
sitebuilderLuc Pattyn27-Apr-09 3:43 
GeneralRe: Getting the Brush to apply to pictureBox instead of Form Pin
Jeffrey Webster27-Apr-09 4:26
Jeffrey Webster27-Apr-09 4:26 
GeneralRe: Getting the Brush to apply to pictureBox instead of Form Pin
Luc Pattyn27-Apr-09 4:34
sitebuilderLuc Pattyn27-Apr-09 4:34 
GeneralRe: Getting the Brush to apply to pictureBox instead of Form Pin
Jeffrey Webster27-Apr-09 6:20
Jeffrey Webster27-Apr-09 6:20 
Hi,
To me - and this may just reveal my ignorance - whether or not this is handled as a Paint event or simply placed within the timer sub doesn't really affect the central question which is how to get the brushes/pens to draw on the pictureBox and not the Form.

To get some idea I simply used the Designer code generator to create MouseDown and MouseUp events on the pictureBox.

This is what the code looked like:
this->pictureBox1->MouseUp += new System::Windows::Forms::MouseEventHandler(this, pictureBox1_MouseUp);
this->pictureBox1->MouseDown += new System::Windows::Forms::MouseEventHandler(this, pictureBox1_MouseDown);


then for the drawing I used this
private: System::Void pictureBox1_MouseDown(System::Object *  sender, System::Windows::Forms::MouseEventArgs *  e)
   {
	p1.X = e->X;
	p1.Y = e->Y;
   }

private: System::Void pictureBox1_MouseUp(System::Object *  sender, System::Windows::Forms::MouseEventArgs *  e)
   {
	p2.X = e->X;
	p2.Y = e->Y;
	Graphics* gr= CreateGraphics();
	Pen* pen1 = new Pen(Color::Black);
	gr->DrawLine(pen1, p1.X,p1.Y,p2.X,p2.Y);
	gr->Dispose();
   }


But this is still drawing on the Form, not the pictureBox. Puzzling.



Jeff
GeneralRe: Getting the Brush to apply to pictureBox instead of Form Pin
Luc Pattyn27-Apr-09 6:23
sitebuilderLuc Pattyn27-Apr-09 6:23 
GeneralRe: Getting the Brush to apply to pictureBox instead of Form Pin
Jeffrey Webster27-Apr-09 6:34
Jeffrey Webster27-Apr-09 6:34 
GeneralRe: Getting the Brush to apply to pictureBox instead of Form Pin
Luc Pattyn27-Apr-09 6:52
sitebuilderLuc Pattyn27-Apr-09 6:52 
GeneralRe: Getting the Brush to apply to pictureBox instead of Form Pin
Jeffrey Webster27-Apr-09 8:01
Jeffrey Webster27-Apr-09 8:01 
QuestionHow to Convert Strings[] to LPWSTR*??? Pin
ANURAG VISHNOI22-Apr-09 21:14
ANURAG VISHNOI22-Apr-09 21:14 
AnswerRe: How to Convert Strings[] to LPWSTR*??? Pin
Mark Salsbery23-Apr-09 6:33
Mark Salsbery23-Apr-09 6:33 
QuestionChecking OS and Vista admin rights Pin
turkmeistr122-Apr-09 3:32
turkmeistr122-Apr-09 3:32 
AnswerRe: Checking OS and Vista admin rights Pin
Mark Salsbery22-Apr-09 8:07
Mark Salsbery22-Apr-09 8:07 
GeneralRe: Checking OS and Vista admin rights Pin
turkmeistr122-Apr-09 8:38
turkmeistr122-Apr-09 8:38 
GeneralRe: Checking OS and Vista admin rights Pin
Mark Salsbery22-Apr-09 12:15
Mark Salsbery22-Apr-09 12:15 
GeneralRe: Checking OS and Vista admin rights Pin
turkmeistr122-Apr-09 12:40
turkmeistr122-Apr-09 12:40 
GeneralRe: Checking OS and Vista admin rights Pin
Mark Salsbery22-Apr-09 13:26
Mark Salsbery22-Apr-09 13:26 
GeneralRe: Checking OS and Vista admin rights Pin
turkmeistr123-Apr-09 7:34
turkmeistr123-Apr-09 7:34 
GeneralRe: Checking OS and Vista admin rights Pin
Mark Salsbery23-Apr-09 8:04
Mark Salsbery23-Apr-09 8:04 
GeneralRe: Checking OS and Vista admin rights Pin
turkmeistr123-Apr-09 11:57
turkmeistr123-Apr-09 11:57 
GeneralRe: Checking OS and Vista admin rights Pin
Mark Salsbery23-Apr-09 12:29
Mark Salsbery23-Apr-09 12:29 
GeneralRe: Checking OS and Vista admin rights Pin
Mark Salsbery23-Apr-09 12:34
Mark Salsbery23-Apr-09 12:34 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.