我们可以在Windows应用程序中添加放大和缩小功能吗? [英] can we add the feature of zoom in and zoom out in windows application":
本文介绍了我们可以在Windows应用程序中添加放大和缩小功能吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个带有2个文本框和按钮的winform。以及下面的代码...我只是希望我的表单在加载时应具有缩放功能。任何人都可以帮助
命名空间缩放
{
public partial class Form1:Form
{
public Form1()
{
InitializeComponent();
// AutoSize = false;
// AutoScaleMode = AutoScaleMode.Font;
// Font = new Font(Trebuchet MS,10.0f,FontStyle.Regular,GraphicsUnit.Point,((byte)(204)));
}
private void button1_Click( object sender,EventArgs e)
{
MessageBox.Show( Hellooooooooooooooo跨度>);
}
private void Form1_Load( object sender,EventArgs e)
{
textBox2.PasswordChar = ' *'跨度>;
// float scaleX =((float)Screen.PrimaryScreen.WorkingArea.Width / 1024);
// float scaleY =((float)Screen.PrimaryScreen.WorkingArea.Height / 768);
// SizeF aSf = new SizeF(scaleX,scaleY);
// this.Scale(aSf);
}
}
}
解决方案
请参阅我过去的答案: C#.net鼠标滚轮中的缩放图像 [ ^ ]。
-SA
如果我正确理解了这个问题,你就无法缩放表格。当然,你可以有一个图片框或类似的,可以放大图片,但表格本身与文本框,我不知道任何合理的方式来做到这一点。
如果您指的是调整表单内部对象的大小,那么Anchoring可能是一个可行的解决方案。有关更多信息,请查看如何:在Windows窗体上锚定控件 [ ^ 一>
I have a winform with 2 text boxes and button.and the code ia below... I just want my form when loaded should have zooming feature. can anybody help
namespace Zooming { public partial class Form1 : Form { public Form1() { InitializeComponent(); //AutoSize = false; //AutoScaleMode = AutoScaleMode.Font; //Font = new Font("Trebuchet MS", 10.0f, FontStyle.Regular, GraphicsUnit.Point, ((byte)(204))); } private void button1_Click(object sender, EventArgs e) { MessageBox.Show("Hellooooooooooooooo"); } private void Form1_Load(object sender, EventArgs e) { textBox2.PasswordChar = '*'; //float scaleX = ((float)Screen.PrimaryScreen.WorkingArea.Width / 1024); //float scaleY = ((float)Screen.PrimaryScreen.WorkingArea.Height / 768); //SizeF aSf = new SizeF(scaleX, scaleY); //this.Scale(aSf); } } }解决方案Please see my past answer: Zoom image in C# .net mouse wheel[^].
—SA
If I understand the question correctly, you can't zoom the form. Of course you could have a picture box or similar which could have the ability to zoom into the picture but the form itself with the text boxes, I don't know any reasonable way to do this.
Then again if you're referring to resizing objects inside a form then Anchoring could be a feasible solution. For more information have a look at How to: Anchor Controls on Windows Forms[^]
这篇关于我们可以在Windows应用程序中添加放大和缩小功能吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文