我不断地得到两个错误“不一致的可访问性”,表示“.比方法更难访问.”。
我已经找到了解决这个问题的方法,每个答案基本上都是:“让班级公开。”
因此我被困住了,因为这门课已经公开了。
以下是错误发生的地方:
[DllImport("User32.Dll")]
public static extern bool GetClientRect(IntPtr hWnd, out RECT lpRect);
/// <summary>
/// Get the inner bounds of client window
/// </summary>
/// <param name="hWnd"></param>
/// <returns></returns>
public static RECT GetClientRect(IntPtr hWnd)
{
RECT result;
GetClientRect(hWnd, out result);
return result;
}发布于 2016-04-26 13:40:52
是的,我知道RECT应该有效。我意识到我做错了什么。
[DllImport("User32.Dll")]
public static extern bool GetClientRect(IntPtr hWnd, out RECT lpRect);
public static RECT GetClientRect(IntPtr hWnd)
{
RECT result;
GetClientRect1(hWnd, out result);
RECT appRect = result;
return result;
}appRect应该是正确的,而不是矩形,因为它们是不同的类型。RECT因其结构而工作:
[StructLayout(LayoutKind.Sequential)]
public struct RECT
{
public int left;
public int top;
public int right;
public int bottom;
}https://stackoverflow.com/questions/36637448
复制相似问题