Quantcast
Viewing all articles
Browse latest Browse all 2341

New Post: Is Something Wrong with OnDrawBackBuffer?

Hi, I'm using MapWinGis.ocx 4.8.6 32bit(my OS Win7 64bit) in my c# Winform Project,
I use OnDrawBackBuffer in order to use graphic.Draw(... of .net
in such step, the axMap's behavior is Strange!
  1. Open my form window (shown WindowState= Normal)
  2. Click some points, and in my OnDrawBackBuffer code , i draw a rectangle with c#;
  3. Maximize my form window, switch axMap.CursorMode to cmZoomIn:
    axMap.CursorMode = MapWinGIS.tkCursorMode.cmZoomIn;
  4. zoom in a rectangle, only apart of the axMap is redrawing, the same size with when the form window is in Normal state , the other expanded parts:Nothing drawn....
It happends each time i operate as this 1,2,3,4...

Is it a bug? or what should i do with it ?

thanks!

my code is here:
        private List<DbPoint> ptRailsList = new List<DbPoint>();
        private void axMap_MouseDownEvent(object sender, AxMapWinGIS._DMapEvents_MouseDownEvent e)
        {
            if (axMap.CursorMode == tkCursorMode.cmNone)
            {
                double xProjected = 0, yProjected = 0;
                axMap.PixelToProj(e.x, e.y, ref xProjected, ref yProjected);
                ptRailsList.Add(new DbPoint(xProjected, yProjected));
                
            }
            axMap.Redraw();
        }
        private void axMap_OnDrawBackBuffer(object sender, AxMapWinGIS._DMapEvents_OnDrawBackBufferEvent e)
        {
            Graphics g = Graphics.FromHdc((IntPtr)e.backBuffer);
            if (ptRailsList.Count >= 3)
            {
                PointF[] points = new PointF[ptRailsList.Count];

                for (int i = 0; i < ptRailsList.Count; i++)
                {
                    double pixX1 = 0, pixY1 = 0;
                    axMap.ProjToPixel(ptRailsList[i].x, ptRailsList[i].y, ref pixX1, ref pixY1);
                    points[i] = new PointF((float)pixX1, (float)pixY1);
                }
                Brush brs = new HatchBrush(HatchStyle.LargeGrid, Color.FromArgb(100, Color.Green), Color.Transparent);
                g.FillPolygon(brs, points, FillMode.Alternate);
            }
        }

Viewing all articles
Browse latest Browse all 2341

Trending Articles