ImageLayout属性成员Stretch和Zoom各有其优缺点
宋育英Stretch: 画像根据控件的尺⼨伸缩表⽰ Zoom: 画像根据控件的尺⼨伸缩表⽰。但和StretchImage不同,持有画像尺⼨⽐率。表⽰位置在控件的中央 存在的问题: 现在控件的尺⼨已经固定了,如果使⽤Stretch,那么图⽚坐标定位⾮常不精确, ⽐如⼀幅800*600图⽚,压缩⾄300*200,如果只是通过⽐例来定位的话,基本上对应不上原图的点坐标, 误差不是⼀般的⼤
如果使⽤Zoom,虽然定位很精确,但是由于控件的固定,使得有部分是空⽩,所以不能使⽤zoom 提出的问题:使⽤Stretch,能否精准定位坐标(⾃⼰尝试了,不⾏)
string filePath
教师节感恩卡= "F://vs2005//新建⽂
件夹//0007//";
switch
(bType.Text)
{
case "BMP":
filePath
+= "L0002.bmp";
break;
case "JPG":
filePath
+= "test.jpg";
break;
case "GIF":
filePath
+= "test.gif";
break;
}
try
{
Image img =
Image.FromFile(filePat
徐州空气质量指数
h);
int
destWidth = 0;
int
destHeight = 0;手冢治虫怎么读
destWidth =
pictureBox1.Width;
destHeight
= pictureBox1.Height;
}
System.Drawing.Imagi
ng.ImageFormat
format =
img.RawFormat;
混合所有制与国企改革新思路Bitmap bmp
= new
附加: C# pictureBox放⼤缩⼩功能代码pictureBox1_MouseDo wn(object sender, MouseEventArgs e) { //string width = pictureBox1.Width.To String(); if (e.Button == MouseButtons.Left) { if (pictureBox1.Width < 1360) { pictureBox1.Width = Convert.ToInt32(pictu reBox1.Width * 1.2); pictureBox1.Height = Convert.ToInt32(pictu reBox1.Height * 1.2);
}布里亚特共和国
} if (e.Button == MouseButtons.Right) { if (pictureBox1.Width > 635) { pictureBox1.Width = Convert.ToInt32(pictu reBox1.Width / 1.2);