public void DoInvalidate() { if (this.CanLayout && this.dUIGraphics != null) { long executeTime = TimeTools.GetExecuteTime(() => { try { this.dUIGraphics.BeginDraw(this.invalidateRegion); this.dUIGraphics.Clear(this.BackColor); this.DoPaint(new DUIPaintEventArgs(this.dUIGraphics, new RectangleF(0, 0, this.Width, this.Height))); this.dUIGraphics.EndDraw(); } catch (Exception ex) { this.dUIGraphics?.Dispose(); this.dUIGraphics = null; this.dUIGraphics = DUIGraphics.FromControl(this.owner); Log.DUILog.WriteLog(ex); } }); //Debug.WriteLine("DUIInvalidateExecuteTime:" + executeTime); //this.invalidateRegion = new Region(Rectangle.Empty); //sw.Stop(); //Debug.WriteLine(sw.ElapsedMilliseconds + "|" + this.dUIGraphics.ClipBounds); } }
/// <summary> 重绘标题栏 /// </summary> public void CaptionInvalidate(DUIGraphics dUIGraphics) { RectangleF captionBounds = new RectangleF(0, 0, this.Width, this.Owner.CaptionHeightInternal); //标题栏区域 this.Owner.OnCaptionPaint(new DUIPaintEventArgs(dUIGraphics, captionBounds)); this.DoPaint(new DUIPaintEventArgs(dUIGraphics, captionBounds)); //Region captionRegion = new Region(captionBounds); //标题栏区域 //captionRegion.Intersect(region); //using (Graphics g = Graphics.FromImage(ControlThumbnail)) //{ // g.SetClip(captionRegion, System.Drawing.Drawing2D.CombineMode.Replace); // RectangleF rectF = captionRegion.GetBounds(g); // this.Owner.OnCaptionPaint(new PaintEventArgs(g, captionBounds)); // this.DoPaint(new PaintEventArgs(g, new Rectangle((int)rectF.X, (int)rectF.Y, (int)rectF.Width, (int)rectF.Height))); //} }
/// <summary> 重绘边框 /// </summary> public void BorderInvalidate(DUIGraphics dUIGraphics) { BorderInvalidate(new RectangleF(0, 0, this.Width, this.Height - this.Owner.CaptionHeightInternal)); }