public Form1()
        {
            InitializeComponent();            this.Resize += new System.EventHandler(this.formResize);
            //Use double-buffering for flicker-free updating:
            SetStyle(ControlStyles.UserPaint | ControlStyles.AllPaintingInWmPaint
                 | ControlStyles.DoubleBuffer | ControlStyles.ResizeRedraw, true);
            SetStyle(ControlStyles.SupportsTransparentBackColor, true);            Rectangle rect = new Rectangle(0, 0, this.Size.Width-15, this.Size.Height-30);
            _masterPane = new MasterPane("", rect);
            _masterPane.Margin.All = 0;
            _masterPane.Title.IsVisible = false;            string titleStr = "Title";
            string xStr = "X Axis";
            string yStr = "Y Axis";            GraphPane graphPane = new GraphPane(rect, titleStr, xStr, yStr);
            using (Graphics g = this.CreateGraphics())
            {
                graphPane.AxisChange(g);
            }
            _masterPane.Add(graphPane);        }

解决方案 »

  1.   

    using (Graphics g = this.CreateGraphics())改为:using (Graphics g = yourPanel.CreateGraphics())
     
      

  2.   

    最好是在Panel的Paint事件响应中调用graphPane.AxisChange(g);
      

  3.   

    这个是可以的,一般用那个对象的Graphics就是在这个对象中画图
      

  4.   

    改了,还是不行,我绘制的是坐标轴,怎么能把它放进panel1控件中呢?求高手指点
      

  5.   

    你不就是要在Panel上画坐标吗Graphics g = this.panel1.CreateGraphics();
                Pen p = new Pen(Color.Red);
                g.DrawLine(p, new Point(100, 100), new Point(200, 200));