示例#1
0
        protected override void OnPaint(PaintEventArgs e)
        {
            #region old
            //e.Graphics.SmoothingMode = m_smoothingMode;
            //Rectangle cliprectangle = e.ClipRectangle;
            //if (m_staticImage == null)
            //{
            //    cliprectangle = ClientRectangle;
            //    m_staticImage = new Bitmap(ClientRectangle.Width, ClientRectangle.Height);
            //    //  m_staticImage.Save("D:\\a.png", ImageFormat.Png);
            //    m_staticDirty = true;
            //}
            ////绘制在背景图片上
            //Graphics BitMapGc = Graphics.FromImage(m_staticImage);
            //BitMapGc.SmoothingMode = m_smoothingMode;
            ////this.BackgroundLayer.Draw(dcStatic, r);
            ////if (m_model.GridLayer.Enabled)
            ////    m_model.GridLayer.Draw(dcStatic, r);
            ////绘制十字丝
            //RPoint rCenterPoint = new RPoint(0, 0, 0);
            //PointF nullPoint = Transform.ToScreen(rCenterPoint, this);
            //BitMapGc.DrawLine(Pens.Blue, nullPoint.X - 10, nullPoint.Y, nullPoint.X + 10, nullPoint.Y);
            //BitMapGc.DrawLine(Pens.Blue, nullPoint.X, nullPoint.Y - 10, nullPoint.X, nullPoint.Y + 10);
            //if (m_staticDirty)
            //{
            //    m_staticDirty = false;

            //    List<ILayer> layers = mMap.Layers;
            //    for (int layerindex = layers.Count - 1; layerindex >= 0; layerindex--)
            //    {
            //        if (layers[layerindex].Visible)
            //            layers[layerindex].Draw(mScreenDisplay);
            //    }
            //    BitMapGc.Dispose();
            //}
            ////绘制背景图片
            //e.Graphics.DrawImage(m_staticImage, cliprectangle, cliprectangle, GraphicsUnit.Pixel);
            #endregion
            e.Graphics.SmoothingMode = m_smoothingMode;
            mScreenDisplay.StartDrawing(this);
            mScreenDisplay.FinishDrawing(e.Graphics);
            if (mScreenDisplay.IsCacheDirty)
            {
                mScreenDisplay.StartRecording();

                mScreenDisplay.StopRecording();
            }
            else
            {
                mScreenDisplay.DrawCache();
            }
        }