form1.cs

来自「csharp课本的源代码」· CS 代码 · 共 28 行

CS
28
字号
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace TranslateTransformExample
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void Form1_Paint(object sender, PaintEventArgs e)
        {
            Graphics myGraphics = e.Graphics;
            myGraphics.TranslateTransform(0.5F, 0.5F);
            myGraphics.PageUnit = GraphicsUnit.Inch;
            Pen myPen = new Pen(Color.Black, 1 / myGraphics.DpiX);
            myGraphics.DrawLine(myPen, 0, 0, 2, 2);
        }

    }
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?