How do I load a picture into the PictureBox control?

To load a Picture into the PictureBox control drag a PictureBox control and a Command Button from the Toolbox. When you click the Command Button, the picture you specified will be loaded into the Picturebox. The following code is a demonstration: 

PictureBox1.Image=Image.FromFile(“image address url”) 

//Assuming you have a folder named images in C: drive and a gif image in that.

How do I add custom drawing to a Button?

Subclass Button and add a custom Paint event handler that does you custom drawing.public class CustomButton : Button

public class CustomButton : Button

{

public CustomButton()
{
Paint += new PaintEventHandler( ButtonPaint );
}private void ButtonPaint( object sender, PaintEventArgs e )
{
Pen pen = new Pen( Color.Red );
pen.Width = 8;
e.Graphics.DrawLine( pen, 7, 4, 7, Height – 4 );
pen.Width = 1;
e.Graphics.DrawEllipse( pen, Width – 16 , 6, 8, 8 );
}
}

Need Help? Contact Us.

Log in

*
*

Forgot password?

*

New User

*
*
*
*