c#图像放大或缩小定位问题

c#图像放⼤或缩⼩定位问题
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);

本文发布于:2024-09-21 20:43:21,感谢您对本站的认可!

本文链接:https://www.17tex.com/xueshu/7486.html

版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。

标签:控件   定位   坐标   中央   问题   基本上
留言与评论(共有 0 条评论)
   
验证码:
Copyright ©2019-2024 Comsenz Inc.Powered by © 易纺专利技术学习网 豫ICP备2022007602号 豫公网安备41160202000603 站长QQ:729038198 关于我们 投诉建议