⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 frmscaling.cs

📁 Microsoft Mobile Development Handbook的代码,有C#,VB,C++的
💻 CS
字号:
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 + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -