Question VB form load takes time...

elite87

Member
Joined
Aug 13, 2009
Messages
8
Programming Experience
1-3
I have a form in size of 1280,800
I have created a image(jpeg) in tat size using Photoshop and its abt 200++ KB
...

The quest is.. when i set the image as my background and when i run the form, it loads my buttons very slow... i hv abt 4 button on the left n 6 on the right side... every time i click on the any of the left buttons the right buttons text will change..

but... every time i click on the button it load the button very slow...

my pc is running on 4GB ram... i wonder whats the problem...
 
Yep i know is always slow if you set background to the form!
The way i make it faster is not to set it as background but the draw on to it using Form1_paint

To make it load faster use double buffer
here is the code that you will need to copy it to form load

SetStyle(ControlStyles.DoubleBuffer, True)
SetStyle(ControlStyles.AllPaintingInWmPaint, True
 
Yep i know is always slow if you set background to the form!
The way i make it faster is not to set it as background but the draw on to it using Form1_paint

To make it load faster use double buffer
here is the code that you will need to copy it to form load

SetStyle(ControlStyles.DoubleBuffer, True)
SetStyle(ControlStyles.AllPaintingInWmPaint, True

How do u use the form1_paint??/

nt sure what u mean by that line...
Thanks.
 
1. Click on your form
2. Look at the propertise there will a lighting icon, click on that
3. Scroll down to appearance and double click on paint
4. This then should bring up Form1_paint code view

First you need a Bitmap variable with an image inside it
eg.
Dim myPic as new bitmap("c:\pic")

In your Form1_paint write this

e.graphic.drawimage(myPic,0,0)

Last 2 numbers 0,0 are cordinates
 
1. Click on your form
2. Look at the propertise there will a lighting icon, click on that
3. Scroll down to appearance and double click on paint
4. This then should bring up Form1_paint code view

First you need a Bitmap variable with an image inside it
eg.
Dim myPic as new bitmap("c:\pic")

In your Form1_paint write this

e.graphic.drawimage(myPic,0,0)

Last 2 numbers 0,0 are cordinates


Thanks... It works... :)
can i resize the image using this function??
 
Back
Top