[英]How to Zoom a Drawn Image in PictureBox
Hey everyone, a new guy here in C#.Net. 大家好,C#.Net中的一个新人。
What I need is to zoom an image drawn using gdi+ to pictureBox. 我需要将使用gdi +绘制的图像缩放到pictureBox。
I searched but couldn't find a nice answer, all I found was for existing files . 我进行了搜索,但找不到一个好的答案, 我发现的只是现有文件 。 Does anyone has an idea? 有人有主意吗?
Thanks for the answers. 感谢您的回答。
My best Regards... 我最诚挚的问候...
Use Transforms and Matrix objects as described here . 如使用转换和Matrix对象这里描述 。 The example of scaling is given as 缩放示例为
private void Scale_Click(object sender,
System.EventArgs e)
{
// Create Graphics object
Graphics g = this.CreateGraphics();
g.Clear(this.BackColor);
// Draw a filled rectangle with
// width 20 and height 30
g.FillRectangle(Brushes.Blue,
20, 20, 20, 30);
// Create Matrix object
Matrix X = new Matrix();
// Apply 3X scaling
X.Scale(3, 4, MatrixOrder.Append);
// Apply transformation on the form
g.Transform = X;
// Draw a filled rectangle with
// width 20 and height 30
g.FillRectangle(Brushes.Blue,
20, 20, 20, 30);
// Dispose of object
g.Dispose();
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.