public void Invalidate(Rectangle rectangle) { GISShare.Win32.RECT rect = new GISShare.Win32.RECT(); rect.Left = rectangle.Left; rect.Right = rectangle.Right; rect.Top = rectangle.Top; rect.Bottom = rectangle.Bottom; GISShare.Win32.API.InvalidateRect(this.Handle, rect, true); }
public void Refresh() { GISShare.Win32.RECT rect = new GISShare.Win32.RECT(); GISShare.Win32.API.GetWindowRect(this.Handle, ref rect); GISShare.Win32.API.InvalidateRect(this.Handle, rect, true); }
protected virtual bool WndNCPaint(IntPtr iHWnd) { try { Size size = this.FrameBorderSize; // GISShare.Win32.RECT rectScreen = new GISShare.Win32.RECT(); GISShare.Win32.API.GetWindowRect(iHWnd, ref rectScreen); // Rectangle rectBounds = Rectangle.FromLTRB(rectScreen.Left, rectScreen.Top, rectScreen.Right, rectScreen.Bottom); rectBounds.Offset(-rectBounds.X, -rectBounds.Y); // Rectangle rectClip = rectBounds; Region region = new Region(rectClip); rectClip.Inflate(-size.Width, -size.Height); // IntPtr iHandle = GISShare.Win32.API.GetDCEx ( iHWnd, (IntPtr)0, (GISShare.Win32.DCXFlags.DCX_CACHE | GISShare.Win32.DCXFlags.DCX_CLIPSIBLINGS | GISShare.Win32.DCXFlags.DCX_WINDOW) ); Graphics g = Graphics.FromHdc(iHandle); // region.Exclude(rectClip); IntPtr hrgn = region.GetHrgn(g); GISShare.Win32.API.SelectClipRgn(iHandle, hrgn); // if (this.m_BufferedGraphics == null || this.m_CurrentCacheSize != rectBounds.Size) { if (this.m_BufferedGraphics != null) { this.m_BufferedGraphics.Dispose(); } // m_BufferedGraphics = this.m_BufferedGraphicsContext.Allocate ( g, new Rectangle(0, 0, rectBounds.Width, rectBounds.Height) ); this.m_CurrentCacheSize = rectBounds.Size; } // // // this.OnNCPaint(new PaintEventArgs(m_BufferedGraphics.Graphics, this.FrameRectangle)); // // // if (this.m_BufferedGraphics != null) { m_BufferedGraphics.Render(g); } // if (iHandle != (IntPtr)0) { GISShare.Win32.API.SelectClipRgn(iHandle, (IntPtr)0); GISShare.Win32.API.ReleaseDC(iHWnd, iHandle); } if (region != null && hrgn != (IntPtr)0) { region.ReleaseHrgn(hrgn); } if (region != null) { region.Dispose(); } if (g != null) { g.Dispose(); } // #region old //IntPtr iHandle = GISShare.Win32.API.GetWindowDC(iHWnd); //Graphics g = Graphics.FromHdc(iHandle); //// //GISShare.Controls.WinForm.WFNew.WFNewRenderer.WFNewRendererStrategy.OnRenderRibbonFormNC( // new GISShare.Controls.WinForm.ObjectRenderEventArgs(g, this, this.FrameRectangle)); //// //g.Dispose(); //GISShare.Win32.API.ReleaseDC(iHWnd, iHandle); #endregion } catch { return(false); } // return(true); }