public static void DrawXY(Graphics g)
{
    //删除
   // Graphics g = pan.CreateGraphics();
   ...
}
//全部替换成这个参数
public static void DrawXLine(Graphics g, float minX, float maxX, int len);
public static void DrawYLine(Graphics g, float minY, float maxY, int len)调用private void panel1_Paint(object sender, PaintEventArgs e)
{
     Graphics g=e.Graphics;
     XYLinesFactory.DrawXY(g);
     XYLinesFactory.DrawYLine(g, 45, 85, 8);
     XYLinesFactory.DrawXLine(g,18,4,14);  
}

解决方案 »

  1.   

    把绘制图像的代码放到绘制图像控件的OnPaint事件中,输入坐标后,调用 xxxx.Invalidate(),触发重绘事件
      

  2.   


            private void Form1_Paint(object sender, PaintEventArgs e)
            {
                Draw(e.Graphics);
            }
    private void Draw(Graphics g)
    {
    //绘图代码
    }
    private void textBox1_KeyDown(object sender, KeyEventArgs e)
    {
    this.Invalidate();
    }
      

  3.   

    http://blog.csdn.net/mask_soft/article/details/7913739
      

  4.   

     点是text1里,输入坐标回车后有,应该将textBox1-->panel1
                    int x = Convert.ToInt32(ss[0]);
                    int y = Convert.ToInt32(ss[1]); 
                    Graphics g =panel1.CreateGraphics();
      

  5.   

     g.FillEllipse(Brushes.Red, new Rectangle(4, 45, x, y));这句x,y与4,45换一下,前2个是int x,int y ,后面是宽与高,输入的坐标是x,y是这个意思吧
      

  6.   

    你看下这里:http://blog.csdn.net/mask_soft/article/details/7913739
     private void textBox1_KeyDown(object sender, KeyEventArgs e)
            {
                if (e.KeyCode == Keys.Enter)
                {
                    string[] ss = textBox1.Text.Trim().Split(new char[] { ',' });                int x = Convert.ToInt32(ss[0]);
                    int y = Convert.ToInt32(ss[1]);      
                    Graphics g = pnlPic.CreateGraphics();
                   g.FillEllipse(Brushes.Red, new System.Drawing.Rectangle(x,y,14, 14));
                }
            }
      

  7.   

    我用你的代码能显示出来,就是textBox1-->panel1,然后数值改修改一些,
      

  8.   

    http://www.dotblogs.com.tw/red315/archive/2012/04/16/71539.aspx
    C# 折線圖
      

  9.   

    我就是参考http://blog.csdn.net/mask_soft/article/details/7913739
    画的坐标图   然后还要画点 所以写了这个一段  我的亲娘啊 那个点还是没有出来
      

  10.   

    你是不是就改了这里的数值?? 
    g.FillEllipse(Brushes.Red, new System.Drawing.Rectangle(x,y,14, 14));
      

  11.   

    原先那样红点也能出来,你参考一下这个http://www.dotblogs.com.tw/red315/archive/2012/04/16/71539.aspx