本文整理汇总了C#中System.Windows.Forms.Hwnd.AddNcInvalidArea方法的典型用法代码示例。如果您正苦于以下问题:C# Hwnd.AddNcInvalidArea方法的具体用法?C# Hwnd.AddNcInvalidArea怎么用?C# Hwnd.AddNcInvalidArea使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Windows.Forms.Hwnd
的用法示例。
在下文中一共展示了Hwnd.AddNcInvalidArea方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: AddExpose
void AddExpose (Hwnd hwnd, bool client, int x, int y, int width, int height) {
// Don't waste time
if ((hwnd == null) || (x > hwnd.Width) || (y > hwnd.Height) || ((x + width) < 0) || ((y + height) < 0)) {
return;
}
// Keep the invalid area as small as needed
if ((x + width) > hwnd.width) {
width = hwnd.width - x;
}
if ((y + height) > hwnd.height) {
height = hwnd.height - y;
}
if (client) {
hwnd.AddInvalidArea(x, y, width, height);
if (!hwnd.expose_pending) {
if (!hwnd.nc_expose_pending) {
hwnd.Queue.Paint.Enqueue(hwnd);
}
hwnd.expose_pending = true;
}
} else {
hwnd.AddNcInvalidArea (x, y, width, height);
if (!hwnd.nc_expose_pending) {
if (!hwnd.expose_pending) {
hwnd.Queue.Paint.Enqueue(hwnd);
}
hwnd.nc_expose_pending = true;
}
}
}
示例2: AddExpose
private void AddExpose (Hwnd hwnd, bool client, int x, int y, int width, int height) {
// Don't waste time
if ((hwnd == null) || (x > hwnd.Width) || (y > hwnd.Height) || ((x + width) < 0) || ((y + height) < 0)) {
return;
}
// Keep the invalid area as small as needed
if ((x + width) > hwnd.width) {
width = hwnd.width - x;
}
if ((y + height) > hwnd.height) {
height = hwnd.height - y;
}
if (client) {
hwnd.AddInvalidArea(x, y, width, height);
if (!hwnd.expose_pending && hwnd.visible) {
MSG msg = new MSG ();
msg.message = Msg.WM_PAINT;
msg.hwnd = hwnd.Handle;
EnqueueMessage (msg);
hwnd.expose_pending = true;
}
} else {
hwnd.AddNcInvalidArea (x, y, width, height);
if (!hwnd.nc_expose_pending && hwnd.visible) {
MSG msg = new MSG ();
Region rgn = new Region (hwnd.Invalid);
IntPtr hrgn = rgn.GetHrgn (null); // Graphics object isn't needed
msg.message = Msg.WM_NCPAINT;
msg.wParam = hrgn == IntPtr.Zero ? (IntPtr)1 : hrgn;
msg.refobject = rgn;
msg.hwnd = hwnd.Handle;
EnqueueMessage (msg);
hwnd.nc_expose_pending = true;
}
}
}