本帖最后由 renegade2008 于 2012-10-15 18:39:56 编辑

解决方案 »

  1.   

    还是没有把问题说清楚,重新说明如下:
    1. 在窗口的 load 事件中添加代码如下:
    this.AutoScroll = true;
    this.AutoScrollMinSize = new Size(1000,600);
    2. paint 改为:
     e.Graphics.TranslateTransform(this.AutoScrollPosition.X, this.AutoScrollPosition.Y);            Pen myPen = new Pen(Color.Blue, 1);
                Pen myPen2 = new Pen(Color.Red, 2);            // Draw the rectangle to the screen before applying the
                // transform.
                e.Graphics.DrawRectangle(myPen, 30, 30, 50, 50);            
                //Matrix myMatrix = new Matrix();
                //myMatrix.Scale(_zoom, _zoom, MatrixOrder.Append);
                //e.Graphics.Transform = myMatrix;
                e.Graphics.DrawRectangle(myPen2, 90, 90, 50, 50);
    3. 贴出的代码在使用滚动条时没有问题,
    现在的问题是使用了缩放,再拖动滚动条的情形下,工作就不正常了..