Click here to Skip to main content
15,891,473 members
Home / Discussions / C#
   

C#

 
GeneralDraw line between pictureboxes Pin
ninja260523-Dec-04 2:18
ninja260523-Dec-04 2:18 
GeneralRe: Draw line between pictureboxes Pin
Heath Stewart23-Dec-04 5:47
protectorHeath Stewart23-Dec-04 5:47 
GeneralRe: Draw line between pictureboxes Pin
ninja260523-Dec-04 18:37
ninja260523-Dec-04 18:37 
GeneralRe: Draw line between pictureboxes Pin
Heath Stewart23-Dec-04 19:24
protectorHeath Stewart23-Dec-04 19:24 
GeneralRe: Draw line between pictureboxes Pin
ninja260523-Dec-04 20:18
ninja260523-Dec-04 20:18 
GeneralRe: Draw line between pictureboxes Pin
Heath Stewart23-Dec-04 20:23
protectorHeath Stewart23-Dec-04 20:23 
GeneralRe: Draw line between pictureboxes Pin
ninja260524-Dec-04 0:33
ninja260524-Dec-04 0:33 
GeneralRe: Draw line between pictureboxes Pin
Heath Stewart27-Dec-04 10:09
protectorHeath Stewart27-Dec-04 10:09 
There's several things wrong I can see by scanning this over:
  1. Put g.Dispose in a finally block, however...
  2. DO NOT use CreateGraphics with owner-drawing; use the PaintEventArgs.Graphics that is passed to you in your OnPaint override. This could be responsible for quite a bit of the performance problem. Use the right ControlStyles bits in call to Control.SetStyle in your constructor to send all paint messages to OnPaint and allow for double-buffering. Be sure to read the documentation for the ControlStyles enumeration so that you use the right flags. In order to enable double-buffering you need to specify three different enumeration members. These are mentioned in the documentation for said enumeration.
  3. When painting your controls - don't redraw the whole thing. You only need to re-draw what is passed to you in the PaintEventArgs.ClipRectangle. Depending on what you're drawing, the Graphics class members let you draw certain rectangles of an image only. If you redraw the entire image every time you will also notice performance pentalties, especially if transforms are applied to shrink the image, etc.


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]
GeneralRe: Draw line between pictureboxes Pin
ninja260529-Dec-04 0:38
ninja260529-Dec-04 0:38 
GeneralRe: Draw line between pictureboxes Pin
Heath Stewart29-Dec-04 5:28
protectorHeath Stewart29-Dec-04 5:28 
GeneralRe: Draw line between pictureboxes Pin
ninja260510-Jan-05 0:49
ninja260510-Jan-05 0:49 
GeneralI wish myself a flicker free form Pin
TyronX23-Dec-04 2:09
TyronX23-Dec-04 2:09 
GeneralRe: I wish myself a flicker free form Pin
Heath Stewart23-Dec-04 5:27
protectorHeath Stewart23-Dec-04 5:27 
GeneralRe: I wish myself a flicker free form Pin
TyronX23-Dec-04 6:47
TyronX23-Dec-04 6:47 
GeneralRe: I wish myself a flicker free form Pin
Heath Stewart23-Dec-04 9:31
protectorHeath Stewart23-Dec-04 9:31 
GeneralRe: I wish myself a flicker free form Pin
TyronX23-Dec-04 10:23
TyronX23-Dec-04 10:23 
GeneralConnection to access database with C#.net Pin
Robske23-Dec-04 1:41
Robske23-Dec-04 1:41 
GeneralRe: Connection to access database with C#.net Pin
leppie23-Dec-04 3:27
leppie23-Dec-04 3:27 
GeneralRe: Connection to access database with C#.net Pin
Robske23-Dec-04 4:25
Robske23-Dec-04 4:25 
GeneralRe: Connection to access database with C#.net Pin
leppie23-Dec-04 4:42
leppie23-Dec-04 4:42 
GeneralRe: Connection to access database with C#.net Pin
Robske23-Dec-04 8:06
Robske23-Dec-04 8:06 
GeneralRe: Connection to access database with C#.net Pin
Rob Graham23-Dec-04 8:56
Rob Graham23-Dec-04 8:56 
GeneralRe: Connection to access database with C#.net Pin
Robske25-Dec-04 1:23
Robske25-Dec-04 1:23 
GeneralRe: Connection to access database with C#.net Pin
Heath Stewart23-Dec-04 5:32
protectorHeath Stewart23-Dec-04 5:32 
GeneralRe: Connection to access database with C#.net Pin
SeMartens23-Dec-04 3:32
SeMartens23-Dec-04 3:32 

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.