本文介绍了关于图像的点击事件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

c正在拍摄图片...

现在我想以这样一种方式进行管理,以便在单击图像后应该在单击部分上显示十字...

这有什么解决办法?

plz建议


Adbvance中的TnX

c am having an image ...

now i want to manage in such a way so that after clicking on image it should show cross on the click part...

is thr any solution for that???

plz advice


TnX in Adbvance

推荐答案

private Point crossCentre;
private void pictureBox1_MouseClick(object sender, MouseEventArgs e)
    {
    crossCentre = e.Location;
    pictureBox1.Invalidate();
    }
private void pictureBox1_Paint(object sender, PaintEventArgs e)
    {
    Graphics g = e.Graphics;
    if (crossCentre != null)
        {
        int x = crossCentre.X;
        int y = crossCentre.Y;
        g.DrawLine(Pens.AntiqueWhite, x, y - 10, x, y + 10);
        g.DrawLine(Pens.AntiqueWhite, x - 10, y, x + 10, y);
        }
    }


这篇关于关于图像的点击事件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-30 05:08