当前位置:编程学习 > C#/ASP.NET >>

真心不懂怎么在有图片的picturebox里面画图,求大神指导

有大神指导吗?昨天画的时候还能在图片上显示一下,只是坐标不对,今天连显示都显示不了了,真心不知道什么情况。 --------------------编程问答-------------------- 不上代码吗。 --------------------编程问答--------------------  private Point startpoint;//全局变量鼠标按下点
        private void pictureBox9_MouseDown(object sender, MouseEventArgs e)
        {
            Pen mypen = new Pen(Color.Red, 6);//画笔
            Point pShebei = new Point(0, 0);
            Graphics g = pictureBox9.CreateGraphics();//画图
            Brush redBrush = Brushes.Red;
            Font songti = new Font("宋体", 14);

            startpoint.X = MousePosition.X -  4 - 202;
            startpoint.Y = MousePosition.Y -  28 - 45;
            int realheng = MousePosition.X -  - 4 - 202;
            int realshu = MousePosition.Y - 28 - 45;
            g.DrawString("" + "▼" + "", songti, redBrush, new Rectangle(new Point(startpoint.X - 4, startpoint.Y - 4), new Size(50, 50))); --------------------编程问答-------------------- 上面的是代码 --------------------编程问答-------------------- 减的那些数字是因为左边有tabcontrol --------------------编程问答--------------------

 private Point startpoint;//全局变量鼠标按下点
 private Bitmap memoryBuffer;
 
private void 窗体_Load事件:
       memoryBuffer=new Bitmap(pictureBox9.Width,pictureBox9.Height);

private void pictureBox9_MouseDown(object sender, MouseEventArgs e)
{
       Pen mypen = new Pen(Color.Red, 6);//画笔
       Point pShebei = new Point(0, 0);
       //Graphics g = pictureBox9.CreateGraphics();//画图
            
       Graphics g=Graphcis.FromImage(memoryBuffer);
 
       Brush redBrush = Brushes.Red;
       Font songti = new Font("宋体", 14);

       startpoint.X = MousePosition.X -  4 - 202;
       startpoint.Y = MousePosition.Y -  28 - 45;
       int realheng = MousePosition.X -  - 4 - 202;
       int realshu = MousePosition.Y - 28 - 45;
       g.DrawString("" + "▼" + "", songti, redBrush, new Rectangle(new Point(startpoint.X - 4, startpoint.Y - 4), new Size(50, 50)));

        pictureBox9.Image=memoryBuffer;
        g.Dispose();
        songti.Dispose();

}
--------------------编程问答-------------------- 在有图片上的pbox...

private void 窗体_Load事件:
       memoryBuffer=pictureBox9.Image;
--------------------编程问答-------------------- Graphics g=Graphcis.FromImage(PictureBox1.Image);
.... --------------------编程问答-------------------- ข้้้้้้้้้้้้้้้้้้้้้้้้้้้้้้้้้้้้้้้้้้้้้้้้้้้้้้้้้้้้ = =OnPaint里面重绘 ข้้้้้้้้้้้้้้้้้้้้้้้้้้้้้้้้้้้้้้้้้้้้้้้้้้้้้้้้้้้้  --------------------编程问答-------------------- Graphics g= Graphcis.FromImage(memoryBuffer);这一段代码显示当前上下文没有名称Graphics --------------------编程问答-------------------- 好吧   看了半天才发现你单词打错了
补充:.NET技术 ,  C#
CopyRight © 2012 站长网 编程知识问答 www.zzzyk.com All Rights Reserved
部份技术文章来自网络,