public void ToolkitExpose(Graphics graphics) { IToolkitEventSink co = this.mControlWeakRef.Target as IToolkitEventSink; if (null != co) { co.ToolkitExpose(graphics); } }
// Handle a paint event from Xsharp. protected override void OnPaint(Xsharp.Graphics graphics) { if (sink != null) { System.Drawing.Region clip = RegionToDrawingRegion(graphics.ExposeRegion); DrawingGraphics g = new DrawingGraphics(toolkit, graphics); using (System.Drawing.Graphics gr = ToolkitManager.CreateGraphics(g, clip)) { sink.ToolkitExpose(gr); } } }
// WM_PAINT Message internal void Paint() { Win32.Api.PAINTSTRUCT myPS = new System.Drawing.Win32.Api.PAINTSTRUCT(); hdc = Win32.Api.BeginPaint(hwnd, ref myPS); if (sink != null) { DrawingGraphics g = new DrawingGraphics(toolkit, hdc); Region clip = new Region(Rectangle.FromLTRB(myPS.rcPaintLeft, myPS.rcPaintTop, myPS.rcPaintRight, myPS.rcPaintBottom)); System.Drawing.Graphics gr = ToolkitManager.CreateGraphics(g, clip); try { sink.ToolkitExpose(gr); } finally { // EndPaint deletes the hdc but that doesnt matter. Win32.Api.EndPaint(hwnd, ref myPS); gr.Dispose(); } //Console.WriteLine( "DrawingWindow.Paint "+ sink +","+gr.ClipBounds.ToString()); } }