本文整理汇总了C#中System.IntPtr.AssumeNonZero方法的典型用法代码示例。如果您正苦于以下问题:C# IntPtr.AssumeNonZero方法的具体用法?C# IntPtr.AssumeNonZero怎么用?C# IntPtr.AssumeNonZero使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.IntPtr
的用法示例。
在下文中一共展示了IntPtr.AssumeNonZero方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: PositionButton
private void PositionButton(IntPtr hWnd, int right, int width)
{
hWnd.AssumeNonZero();
var id = hWnd.GetDlgCtrlID();
//hWnd.BringWindowToTop();
var buttonLoc = hWnd.GetWindowPlacement();
buttonLoc.Right = right;
buttonLoc.Left = buttonLoc.Right - width;
hWnd.SetWindowPlacement(ref buttonLoc);
hWnd.InvalidateRect(IntPtr.Zero, true);
}
示例2: ResizeCustomControl
private void ResizeCustomControl(IntPtr hWnd)
{
if (hWnd == m_hWnd)
{
var hSelectButton = hWnd.AssumeNonZero().GetDlgItem(InteropUtil.ID_SELECT).AssumeNonZero();
var hOkButton = hWnd.AssumeNonZero().GetDlgItem(InteropUtil.ID_CUSTOM_CANCEL).AssumeNonZero();
var hParent = hWnd.GetParent().AssumeNonZero();
var fileName = hParent.GetDlgItem(InteropUtil.ID_FileNameCombo).AssumeNonZero();
/*var right = fileName.GetWindowPlacement().Right;
var top = hSelectButton.GetWindowPlacement().Top;*/
var rect = new InteropUtil.RECT();
var selectRect = hSelectButton.GetWindowPlacement();
rect.top = selectRect.Top;
rect.bottom = selectRect.Bottom;
rect.right = fileName.GetWindowPlacement().Right;
rect.left = rect.right - (m_cancelWidth + m_buttonGap + m_selectWidth);
ResizeCustomControl(hWnd, rect, hOkButton, hSelectButton);
}
}
示例3: LoadFontFrom
public static void LoadFontFrom(this IntPtr hWndDest, IntPtr hWndSrc)
{
hWndDest.AssumeNonZero();
hWndSrc.AssumeNonZero();
var hFont = (IntPtr)unchecked((int)SendMessage(hWndSrc, WM_GETFONT, 0, 0));
hFont.AssumeNonZero();
SendMessage(hWndDest, WM_SETFONT, (uint)hFont, 0);
}