日期:2014-05-17 浏览次数:21176 次
//自适应尺寸
private void adaptButton_Click(object sender, EventArgs e)
{
//获取屏幕的宽度和高度
int w = Screen.PrimaryScreen.Bounds.Width;
int h = Screen.PrimaryScreen.Bounds.Height;
ddoc.pictureBox1.Location = new Point(0, 0);
ddoc.pictureBox1.Size = new Size(w, h);
ddoc.pictureBox1.SizeMode = PictureBoxSizeMode.Zoom;
}
string strWelcome = System.Windows.Forms.Application.StartupPath + "\\welcome.jpg";
if (File.Exists(strWelcome))
{
Bitmap bm = new Bitmap(Image.FromFile(strWelcome), ddoc.pictureBox1.Width, ddoc.pictureBox1.Height);
bm.Save("filename");
}