frmscaling.cs
来自「Microsoft Mobile Development Handbook的代码」· CS 代码 · 共 39 行
CS
39 行
using System;
using System.Windows.Forms;
using System.Drawing;
namespace CodeForChapter2
{
public partial class frmScaling : Form
{
public frmScaling()
{
InitializeComponent();
}
// run this project on both VGA and non-VGA devices
private void frmScaling_Paint(object sender, PaintEventArgs e)
{
int left = 5, right = 5, width = 200, height = 200;
Rectangle r = new Rectangle((int)(left * Program.ScaleFactor),
(int)(right * Program.ScaleFactor),
(int)(width * Program.ScaleFactor),
(int)(height * Program.ScaleFactor));
float thickness = 2;
Pen p = new Pen(Color.Red, thickness * Program.ScaleFactor);
e.Graphics.DrawEllipse(p, r);
Brush b = new SolidBrush(Color.Blue);
float x = 75, y = 100;
e.Graphics.DrawString("scales well", this.Font, b,
x * Program.ScaleFactor,
y * Program.ScaleFactor);
p.Dispose();
b.Dispose();
}
}
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?