To achieve the first point you can override the OnPaint method of the Form
and draw an image to the form. e.g.
[C#]
protected override void OnPaint(PaintEventArgs e)
{
//paint the splash screen bitmap
Graphics g = e.Graphics;
g.DrawImage(new
Bitmap(System.Reflection.Assembly.GetExecutingAssembly().GetManifestResource
Stream("background.bmp")),0, 0);
base.OnPaint (e);
}
[VB]
Protected Overrides Sub OnPaint(ByVal e As PaintEventArgs)
Graphics g = e.Graphics
g.DrawImage(New
Bitmap(System.Reflection.Assembly.GetExecutingAssembly().GetManifestResource
Stream("background.bmp")),0, 0)
MyBase.OnPaint(e)
End Sub
Note here I have loaded a bitmap from an embedded resource too. You could
use the alternate constructor for the Bitmap object which takes a filepath
to a valid image file.
Peter
--
Peter Foot
Windows Embedded MVP
www.inthehand.com |
www.opennetcf.org
Eka Gautama said:
Hi there,
I have couple questions:
- how can i put a background image in a form
- how can i set a trasparent bg color a label or button..
Thanks for help..