Click here to Skip to main content
16,007,885 members
Home / Discussions / Visual Basic
   

Visual Basic

 
QuestionVB.Net to Excel Problem Pin
directred23-Feb-06 4:07
directred23-Feb-06 4:07 
AnswerRe: VB.Net to Excel Problem Pin
Divya Rathi23-Feb-06 5:36
Divya Rathi23-Feb-06 5:36 
Questionimage passing via 3 form cause infinite loop.. Pin
campbells23-Feb-06 3:41
campbells23-Feb-06 3:41 
Questionupdateing datagrid Pin
microuser_200023-Feb-06 2:47
microuser_200023-Feb-06 2:47 
QuestionHow do I get a splash screen to transist from one color to another? Pin
Tyrone_whitey23-Feb-06 2:41
Tyrone_whitey23-Feb-06 2:41 
AnswerRe: How do I get a splash screen to transist from one color to another? Pin
Joshua Quick23-Feb-06 9:01
Joshua Quick23-Feb-06 9:01 
GeneralRe: How do I get a splash screen to transist from one color to another? Pin
Tyrone_whitey24-Feb-06 3:27
Tyrone_whitey24-Feb-06 3:27 
AnswerRe: How do I get a splash screen to transist from one color to another? Pin
Joshua Quick24-Feb-06 6:34
Joshua Quick24-Feb-06 6:34 
You can draw the gradient yourself with individual lines. It just takes more effort (and might not be as efficient). GDI+ can do the work for you with a single Gradient brush, like in the code I gave you.

Your code isn't going to work though. For one thing, you're assigning a new Color to "colCurrent" on every pass in the loop, but you never assigned the color to your pen. You should be creating the pen with this color at the bottom of your switch statement.
penCurrent = New Pen(colCurrent)

Also, you really shouldn't be using a switch statement. There are a lot of colors for you to go through, which would involve too many case statements. Instead, you should create red, green, and blue integer variables and increment the ones you need on every pass. Luckily you're transitioning from black to another color, which involves just incrementing up from (0,0,0). If your starting color was not black, then creating a gradient would be much, much harder.

Also, you need to call your brush's and pen's Dispose() method when you're done using them. Otherwise you'll have GDI leaks. As a general rule, any object that you've created should be disposed if it has a Dispose() method. That means disposing the pen before overwriting it with a new one on every pass in the loop.
AnswerRe: How do I get a splash screen to transist from one color to another? Pin
Joshua Quick27-Feb-06 13:02
Joshua Quick27-Feb-06 13:02 
AnswerRe: How do I get a splash screen to transist from one color to another? Pin
Tyrone_whitey28-Feb-06 11:31
Tyrone_whitey28-Feb-06 11:31 
AnswerRe: How do I get a splash screen to transist from one color to another? Pin
Joshua Quick28-Feb-06 11:58
Joshua Quick28-Feb-06 11:58 
Questionfurther question on show "now loading" form before Shell() Pin
cylix200022-Feb-06 23:46
cylix200022-Feb-06 23:46 
QuestionVBIDE Interop bug? Pin
daveekid22-Feb-06 22:54
daveekid22-Feb-06 22:54 
QuestionCan menus appear only upon right clicking? Pin
KaKa'22-Feb-06 21:50
KaKa'22-Feb-06 21:50 
AnswerRe: Can menus appear only upon right clicking? Pin
merlynml22-Feb-06 22:40
merlynml22-Feb-06 22:40 
Question[Resolved] Dataview .RowFilter = "PartNo = '123' AND Ave(Cost)" gives error Pin
RichardBerry22-Feb-06 21:25
RichardBerry22-Feb-06 21:25 
AnswerRe: Dataview .RowFilter = "PartNo = '123' AND Ave(Cost)" gives error Pin
Ritesh123422-Feb-06 23:02
Ritesh123422-Feb-06 23:02 
GeneralRe: Dataview .RowFilter = "PartNo = '123' AND Ave(Cost)" gives error Pin
RichardBerry22-Feb-06 23:42
RichardBerry22-Feb-06 23:42 
QuestionWhat am I missing here? Pin
Darshon22-Feb-06 20:47
Darshon22-Feb-06 20:47 
AnswerRe: What am I missing here? Pin
Christian Graus22-Feb-06 20:51
protectorChristian Graus22-Feb-06 20:51 
GeneralRe: What am I missing here? Pin
Darshon23-Feb-06 4:55
Darshon23-Feb-06 4:55 
GeneralRe: What am I missing here? Pin
Darshon23-Feb-06 6:21
Darshon23-Feb-06 6:21 
GeneralRe: What am I missing here? Pin
Christian Graus23-Feb-06 10:59
protectorChristian Graus23-Feb-06 10:59 
Questionwhat is this mean? Pin
pandapatin22-Feb-06 20:34
pandapatin22-Feb-06 20:34 
AnswerRe: what is this mean? Pin
Christian Graus22-Feb-06 20:38
protectorChristian Graus22-Feb-06 20:38 

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.