我的picturebox里面画了很多的region和线。现在要放大/缩小整个picturebox内部的内容。有没有什么方法?请赐教

解决方案 »

  1.   

    存成一个临时的 *.bmp文件
    再调入这个文件在picturebox控件上重画.
      

  2.   

    可以用另一个不可见的 Picture 作缓冲。    Picture1.SetFocus
        Picture2.AutoRedraw = True
        rv = SendMessage(Picture1.hwnd, WM_PAINT, Picture2.hDC, 0)
        rv = SendMessage(Picture1.hwnd, WM_PRINT, Picture2.hDC, _
        PRF_CHILDREN + PRF_CLIENT + PRF_OWNED)
        Picture2.Picture = Picture2.Image
        Picture2.AutoRedraw = False    '放大为原图的2倍    Picture1.PaintPicture Picture2, 0, 0, 2 * Picture2.Width, 2 * Picture2.Height, 0, 0, Picture2.Width, Picture2.Height
      

  3.   

    你可以用API函数来设置PictureBox的ViewPort,比如:   SetMapMode pb1.hdc, MM_ANISOTROPIC   GetClientRect pb1.hWnd, rect
       SetViewportExtEx pb1.hdc, _
           (rect.Right - rect.Left) / 2, _
           (rect.Bottom - rect.Top) / 2, size   SetWindowExtEx pb1.hdc, 30, -30, size
       SetWindowOrgEx pb1.hdc, -15, 30, point给我邮件,给一个完整的方案。