日期:2014-05-17  浏览次数:20669 次

求大神 帮忙 捉急啊
哪里出错了   在textbox中输入坐标 为毛坐标图上没有点·····

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace mianjian
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void panel1_Paint(object sender, PaintEventArgs e)
        {

            XYLinesFactory.DrawXY(panel1);
            XYLinesFactory.DrawYLine(panel1, 45, 85, 8);
            XYLinesFactory.DrawXLine(panel1,18,4,14);  


        }


        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 = textBox1.CreateGraphics();
                g.FillEllipse(Brushes.Red, new Rectangle(4, 45, x, y));
            }
        }



    }


    class XYLinesFactory
    {
        #region   画出X轴与Y轴
        /// <summary>   
        /// 在任意的panel里画一个坐标,坐标所在的四边形距离panel边52像素   
        /// </summary>   
        /// <param name="pan"></param> 
        public static void DrawXY(Panel pan)
        {
            Graphics g = pan.CreateGraphics();
      &nb