Click here to Skip to main content
15,938,218 members
Home / Discussions / Visual Basic
   

Visual Basic

 
AnswerRe: Background color of message box Pin
Dave Kreskowiak4-Mar-10 3:44
mveDave Kreskowiak4-Mar-10 3:44 
GeneralRe: Background color of message box Pin
Tufail Ahmad4-Mar-10 18:05
Tufail Ahmad4-Mar-10 18:05 
GeneralRe: Background color of message box Pin
Anubhava Dimri4-Mar-10 18:19
Anubhava Dimri4-Mar-10 18:19 
GeneralRe: Background color of message box Pin
Dave Kreskowiak5-Mar-10 2:02
mveDave Kreskowiak5-Mar-10 2:02 
QuestionOffice Interop Exception in VB.NET1.1, Please help Pin
Puneet Bhatnagar4-Mar-10 1:53
Puneet Bhatnagar4-Mar-10 1:53 
QuestionGDI+ help Pin
nyt19723-Mar-10 23:43
professionalnyt19723-Mar-10 23:43 
AnswerRe: GDI+ help Pin
Wayne Gaylard4-Mar-10 0:50
professionalWayne Gaylard4-Mar-10 0:50 
AnswerRe: GDI+ help Pin
Dave Kreskowiak4-Mar-10 1:53
mveDave Kreskowiak4-Mar-10 1:53 
Your code is messed up to say the least. You can start by removing every line that says "CreateGraphics" and replace it with this:
Dim g As Graphics = e.Graphics

Use the Graphics object passed to you in the event args. Do NOT create your own Graphics object when handling Paint events.

Get rid of your OnPaint method.

You're creating objects all over the place, but only Diposing of some of them. Your code leaks resources like mad because your creating these objects on every Paint event call, but never releasing them. You'll eventually run the system out of resources and Windows will start behaving very strangely. Create objects that do not change over time, like brushes, pens, and fonts, once, and reuse them. Dispose of them when you app closes.

A guide to posting questions on CodeProject[^]



Dave Kreskowiak
Microsoft MVP
Visual Developer - Visual Basic
     2006, 2007, 2008
But no longer in 2009...




GeneralRe: GDI+ help Pin
nyt19724-Mar-10 19:24
professionalnyt19724-Mar-10 19:24 
GeneralRe: GDI+ help Pin
Wayne Gaylard4-Mar-10 21:31
professionalWayne Gaylard4-Mar-10 21:31 
GeneralRe: GDI+ help Pin
nyt19725-Mar-10 0:01
professionalnyt19725-Mar-10 0:01 
GeneralRe: GDI+ help Pin
Wayne Gaylard5-Mar-10 0:57
professionalWayne Gaylard5-Mar-10 0:57 
GeneralRe: GDI+ help Pin
nyt19725-Mar-10 1:13
professionalnyt19725-Mar-10 1:13 
GeneralRe: GDI+ help Pin
Wayne Gaylard5-Mar-10 1:51
professionalWayne Gaylard5-Mar-10 1:51 
GeneralRe: GDI+ help Pin
Dave Kreskowiak5-Mar-10 2:10
mveDave Kreskowiak5-Mar-10 2:10 
AnswerRe: GDI+ help Pin
Luc Pattyn5-Mar-10 1:55
sitebuilderLuc Pattyn5-Mar-10 1:55 
GeneralRe: GDI+ help Pin
nyt19727-Mar-10 20:35
professionalnyt19727-Mar-10 20:35 
QuestionWorking with CR in VB.net Pin
C#Coudou3-Mar-10 23:03
C#Coudou3-Mar-10 23:03 
AnswerRe: Working with CR in VB.net Pin
Anubhava Dimri4-Mar-10 18:25
Anubhava Dimri4-Mar-10 18:25 
QuestionHow to Open a Third Party Application in a Form/Webbrowser in VB6 Pin
karthickmani633-Mar-10 17:31
karthickmani633-Mar-10 17:31 
AnswerRe: How to Open a Third Party Application in a Form/Webbrowser in VB6 Pin
Dalek Dave3-Mar-10 21:47
professionalDalek Dave3-Mar-10 21:47 
GeneralRe: How to Open a Third Party Application in a Form/Webbrowser in VB6 Pin
karthickmani633-Mar-10 23:33
karthickmani633-Mar-10 23:33 
GeneralRe: How to Open a Third Party Application in a Form/Webbrowser in VB6 Pin
Dave Kreskowiak4-Mar-10 1:47
mveDave Kreskowiak4-Mar-10 1:47 
QuestionReferences Pin
neverpleat3-Mar-10 12:45
neverpleat3-Mar-10 12:45 
AnswerRe: References Pin
Dave Kreskowiak4-Mar-10 1:44
mveDave Kreskowiak4-Mar-10 1:44 

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.