C#设置picturebox滚动条来实现查看大图片

要给PictureBox添加滚动条需要以下步骤:

    (1)将picturebox放在panel上;

   ( 2)将panel的AutoScroll设置为ture;

    (3)将picturebox的SizeMode设置为AutoSize;

    (4)将picturebox的Dock设置为None(必须为None,设置为Fill不会出现滚动条);

    (5)将图像交给控件的Image属性:pictureBox.Image = 图像; 

在picturebox上使用GDI绘图是不会显示滚动条的。


posted @ 2021-08-23 15:43  WellMandala  阅读(780)  评论(0)    收藏  举报