做了一个有滚动条的窗口
不过如果不进行处理
窗口内的图形会变形
这个时候进行坐标轴平移就行了
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace 滚动窗口绘图
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
this.AutoScrollMinSize=new Size(400,400);//设置滚动窗口的最小size(400,400);
}
private void Form1_Load(object sender, EventArgs e)
{
this.BackColor = Color.White;
}
protected override void OnPaint(PaintEventArgs e)
{
base.OnPaint(e);
Rectangle r = new Rectangle(new Point(20, 20), new Size(100, 150));
SolidBrush b = new SolidBrush(Color.Red);