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);
}
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();
}
int x = Convert.ToInt32(ss[0]);
int y = Convert.ToInt32(ss[1]);
Graphics g =panel1.CreateGraphics();
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));
}
}
C# 折線圖
画的坐标图 然后还要画点 所以写了这个一段 我的亲娘啊 那个点还是没有出来
g.FillEllipse(Brushes.Red, new System.Drawing.Rectangle(x,y,14, 14));