c# - 在 C# Windows 窗体中单击时如何停止文本在按钮中移动?
问题描述
所以我正在以 Windows 形式制作一个基本的计算器,并且对 C# 很陌生。我有 +、-、/ 和 * 的按钮,由于某种原因,当我运行程序时,如果单击“-”按钮,“-”符号会移动到按钮的底部。每次我运行程序并尝试将边距和填充设置为 0 并锚定但无法解决它时,都会发生这种情况。其他 3 个按钮不会发生这种情况,除了符号和按钮编号外,它们的代码都相同。我从工具箱中拖出控件,所以没有编写任何代码,这就是我如此困惑的原因。
按钮的代码如下:
this.button2.Font = new System.Drawing.Font("Microsoft Sans Serif", 24F);
this.button2.Location = new System.Drawing.Point(209, 174);
this.button2.Margin = new System.Windows.Forms.Padding(0);
this.button2.Name = "button2";
this.button2.Size = new System.Drawing.Size(50, 50);
this.button2.TabIndex = 4;
this.button2.Text = "−";
this.button2.UseVisualStyleBackColor = true;
this.button2.Click += new System.EventHandler(this.button2_Click);
代码的边缘行是与其他 3 个按钮唯一不同的行,但无论有没有该行,问题仍然存在。任何帮助将非常感激!
解决方案
推荐阅读
- postgresql - 为什么显示不同的 PostgreSQL 版本?
- sql-server - 为相同的序列元素分配多次连续重复
- dictionary - 为什么golang中的map桶最多包含8个key/elem对?为什么数字是八?
- python - 如何使 discord.py bot 确定句子中的关键字?
- javascript - 尝试使用 imagemin-webp 将图像转换为 webp 但不工作
- c# - Unity Golf 游戏物理和运动控制器
- android - 为什么数据库名称和版本必须是静态的?
- amazon-web-services - AWS 内部 ALB 没有从 API Gateway 获得流量
- html - HTML 视频标签将 MOV 文件读取为 Google Chrome 中的音频文件
- android - 如何限制用户访问 Firebase Firestore 中的数据库?