关于画画(重绘)的问题
楼主想要通过按钮(只有在点击后才会出现那张图自己画的图)来实现在Form1上画一张图(图的大小大于窗口的大小,所以设置了滚动条),但是在点击以后就在窗口中出现了话的一部分,但是当楼主想拖动滚动条的时候不仅以前未显示的部分没有出现,而且原来的那部分也不见了;
代码如下
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace 重绘1
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
this.AutoScroll = true;
this.BackColor = Color.Pink;
this.AutoScrollMinSize = new Size(10000, 10000);
}
private void weizhi(PaintEventArgs e)
{
Point startPoint=new Point (0,0);
Size location = new Size(1000, 1000);
Rectangle rectangle = new Rectangle(startPoint,location);
e.Graphics.Clip = new Region(rectangle );
}
private void button1_Click(object sender, EventArgs e)
{
huahua();
}
private void huahua()
{
Graphics g = CreateGraphics();
Point startPoint = new Point(0, 0);