[英]How to Zoom a Drawn Image in PictureBox
大家好,C#.Net中的一个新人。
我需要将使用gdi +绘制的图像缩放到pictureBox。
我进行了搜索,但找不到一个好的答案, 我发现的只是现有文件 。 有人有主意吗?
感谢您的回答。
我最诚挚的问候...
如使用转换和Matrix对象这里描述 。 缩放示例为
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.