日期:2014-05-20  浏览次数:21242 次

关于在C#里面显示图片的问题,谢谢!
在PictureBox里面放置一张图片,如果图片太大,PictureBox里面不能显示整张图片的时候,怎样利用滚动条去显示图片呢?我不想缩放,我要看到原图大小哦.

还有,如果我要在这张图片的某个坐标上面画上一个点,怎样做呢?

有简单的例子吗?请帮忙,谢谢!

------解决方案--------------------
Following is try to draw a line begin at keydown and end at keyup:

Point startMousePoint;
Point endMousePoint;
bool blMouseDown=false;
private void pictureBox1_MouseMove(object sender, MouseEventArgs e)
{
endMousePoint = e.Location;
this.pictureBox1.Refresh();
}

private void pictureBox1_MouseDown(object sender, MouseEventArgs e)
{
blMouseDown = true;
startMousePoint = e.Location;
endMousePoint = e.Location;
}

private void pictureBox1_MouseUp(object sender, MouseEventArgs e)
{
blMouseDown = false;
}

private void pictureBox1_Paint(object sender, PaintEventArgs e)
{
if(!blMouseDown) return;
e.Graphics.DrawLine(new Pen(Color.Red), startMousePoint, endMousePoint);
}