Click here to Skip to main content
15,888,803 members
Home / Discussions / C#
   

C#

 
GeneralRe: Windows Service and Sql Server Pin
Anonymous19-Nov-04 19:13
Anonymous19-Nov-04 19:13 
GeneralRe: Windows Service and Sql Server Pin
Dennis C. Dietrich20-Nov-04 3:43
Dennis C. Dietrich20-Nov-04 3:43 
GeneralRe: Windows Service and Sql Server Pin
Zishan Haider22-Nov-04 0:07
Zishan Haider22-Nov-04 0:07 
GeneralPrinting Graphics Pin
rognog19-Nov-04 1:33
rognog19-Nov-04 1:33 
GeneralRe: Printing Graphics Pin
benjymous19-Nov-04 5:23
benjymous19-Nov-04 5:23 
GeneralRe: Printing Graphics Pin
Heath Stewart19-Nov-04 8:16
protectorHeath Stewart19-Nov-04 8:16 
GeneralRe: Printing Graphics Pin
Daniel Turini19-Nov-04 6:03
Daniel Turini19-Nov-04 6:03 
GeneralRe: Printing Graphics Pin
Heath Stewart19-Nov-04 8:24
protectorHeath Stewart19-Nov-04 8:24 
Extending on what Daniel said, you should rewrite your OnPaint to paint the entire surface (nodes and lines) but in a modular manner that you can pass a Graphics object (and perhaps the clip bounds) to paint on, but don't paint directly in OnPaint. This allows you to pass the Graphics for a PrintDocument (or even an HDC for some other device using Graphics.FromHdc) and use the same drawing routines.

The common solution follows:
private void Paint(Graphics g, Rectangle bounds)
{
  // Your drawing routines go here...
}
 
protected override void OnPaint(PaintEventArgs e)
{
  base.OnPaint(e);
  Paint(e.Graphics, Bounds);
}
 
private void printDocument1_PrintPage(object sender, PrintPageEventArgs e)
{
  Paint(e.Graphics, e.PageBounds);
}
Handling your mouse events isn't too hard if you design a nice abstract system of nodes where the Panel may translate mouse events to the nodes, but the nodes actually contain the code to move themselves. Polymorphism is a very powerful tool.

This posting is provided "AS IS" with no warranties, and confers no rights.

Software Design Engineer
Developer Division Sustained Engineering
Microsoft

[My Articles] [My Blog]
QuestionHow could I know all the threads have been executed? Pin
momer18-Nov-04 22:19
momer18-Nov-04 22:19 
AnswerRe: How could I know all the threads have been executed? Pin
benjymous18-Nov-04 22:30
benjymous18-Nov-04 22:30 
AnswerRe: How could I know all the threads have been executed? Pin
Daniel Turini18-Nov-04 23:10
Daniel Turini18-Nov-04 23:10 
GeneralNETBIOS Pin
Y3YPnATOP18-Nov-04 22:06
Y3YPnATOP18-Nov-04 22:06 
GeneralRe: NETBIOS Pin
Heath Stewart19-Nov-04 8:35
protectorHeath Stewart19-Nov-04 8:35 
GeneralDataGrid control Pin
sasan5618-Nov-04 20:30
sasan5618-Nov-04 20:30 
GeneralRe: DataGrid control Pin
DougW4818-Nov-04 20:38
DougW4818-Nov-04 20:38 
GeneralRe: DataGrid control Pin
drayab18-Nov-04 20:51
drayab18-Nov-04 20:51 
GeneralDataGridTimePickerColumn question Pin
Old Gun18-Nov-04 16:22
Old Gun18-Nov-04 16:22 
GeneralRe: DataGridTimePickerColumn question Pin
Heath Stewart19-Nov-04 8:38
protectorHeath Stewart19-Nov-04 8:38 
GeneralRe: DataGridTimePickerColumn question Pin
Old Gun20-Nov-04 21:06
Old Gun20-Nov-04 21:06 
QuestionHow to perform carriage return by coding,not by clicking the Enter key? Pin
momer18-Nov-04 16:04
momer18-Nov-04 16:04 
AnswerRe: How to perform carriage return by coding,not by clicking the Enter key? Pin
Daniel Turini18-Nov-04 20:41
Daniel Turini18-Nov-04 20:41 
AnswerRe: How to perform carriage return by coding,not by clicking the Enter key? Pin
Luis Alonso Ramos19-Nov-04 9:03
Luis Alonso Ramos19-Nov-04 9:03 
Generaldatagrid slow updating Pin
bwagz18-Nov-04 14:21
bwagz18-Nov-04 14:21 
GeneralArrayList in ArrayList Pin
stumpi18-Nov-04 13:52
stumpi18-Nov-04 13:52 
GeneralRe: ArrayList in ArrayList Pin
maibuihuynhtg18-Nov-04 16:43
maibuihuynhtg18-Nov-04 16:43 

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.