/// <summary> /// 使控件矩形无效,可以选择是否强制刷新 /// </summary> /// <param name="rc">无效矩形</param> /// <param name="invalidateChildren">使控件所在的 Win32 窗口的子控件无效为 true,否则为 false</param> /// <param name="forceUpdate">强制刷新为 true,否则为false</param> protected void InvalidateCore(Rectangle rc, bool invalidateChildren, bool forceUpdate) { if (forceUpdate || !this.UpdateSuspended) { IUIControl parent = this; IUIWindow window = null; while (parent != null && (window = parent as IUIWindow) == null) { rc.Offset(parent.Left, parent.Top); parent = parent.UIParent; } if (window == null) { return; } window.Invalidate(rc, invalidateChildren); } }
/// <summary> /// 立即刷新所在 Win32 窗口和其子控件,可以选择是否强制刷新 /// </summary> /// <param name="forceUpdate">强制刷新为 true,否则为false</param> protected void RefreshCore(bool forceUpdate) { if (forceUpdate || !this.UpdateSuspended) { IUIControl parent = this; IUIWindow window = null; Rectangle rc = this.ClientRectangle; while (parent != null && (window = parent as IUIWindow) == null) { rc.Offset(parent.Left, parent.Top); parent = parent.UIParent; } if (window == null) { return; } window.Invalidate(rc, true); window.Update(); } }