English 中文(简体)
在X和Y5px上设定4px
原标题:Setting MINMAXINFO is off by 4px on the X and 5px on the Y
  • 时间:2011-11-07 23:49:13
  •  标签:
  • c++
  • c
  • winapi

I m 处理MINmetINFO 类似:

 case WM_GETMINMAXINFO:
      {
         LPMINMAXINFO p_info = (LPMINMAXINFO)lParam;
         int total_border_width = 2 * GetSystemMetrics( SM_CXFRAME );
         int total_border_height = 2 * GetSystemMetrics( SM_CYFRAME ) + 
            GetSystemMetrics( SM_CYCAPTION ) - GetSystemMetrics( SM_CYBORDER );
         POINT min,max;

         min.x = d->min_w > 0 ? d->min_w + total_border_width : p_info->ptMinTrackSize.x;
         min.y = d->min_h > 0 ? d->min_h + total_border_height : p_info->ptMinTrackSize.y;
         max.x = d->max_w > 0 ? d->max_w + total_border_width : p_info->ptMaxTrackSize.x;
         max.y = d->max_h > 0 ? d->max_h + total_border_height : p_info->ptMaxTrackSize.y;

         p_info->ptMinTrackSize = min;
         p_info->ptMaxTrackSize = max;
        }

       break;

这项决议规定,它始终不.于我对X的希望,而关于Y. Doing + 4 和 + 5 的5个餐厅固然如此,但这似乎是一种可怕的想法。 是否有人错?

增 编

最佳回答

Depends on the type of frame you re using. You may need to account for the 3D elements of the border seperately, such as SM_CXEDGE. The client area may have an edge you re not accounting for if it s a 3D client frame.

问题回答

因此,用户32提供AdjustWindowRect(Ex)。

在MSDN中,对AdjustWindowRectEx的简要说明如下:

“根据客户休息点的预期规模计算窗户所需大小。 然后可将窗户直径转至创造窗口功能,以建立一个客户区为预期规模的窗口。

AdjustWindowRect是相同的,但用于Window。 对于MINMERINFO的更正,无论你利用什么功能创建窗口,都应做到:

RECT rc;
rc.left = 0;
rc.top = 0;
rc.right = desired_width;
rc.bottom = desired_height;
AdjustWindowRectEx(&rc, GetWindowLong(hwnd, GWL_STYLE),
     GetMenu(hwnd) != 0, GetWindowLong(GWL_EXSTYLE));

弧形将作改动,成为你在MIN.105/8INFO中确定相关点所需要的层面。





相关问题
Undefined reference

I m getting this linker error. I know a way around it, but it s bugging me because another part of the project s linking fine and it s designed almost identically. First, I have namespace LCD. Then I ...

C++ Equivalent of Tidy

Is there an equivalent to tidy for HTML code for C++? I have searched on the internet, but I find nothing but C++ wrappers for tidy, etc... I think the keyword tidy is what has me hung up. I am ...

Template Classes in C++ ... a required skill set?

I m new to C++ and am wondering how much time I should invest in learning how to implement template classes. Are they widely used in industry, or is this something I should move through quickly?

Print possible strings created from a Number

Given a 10 digit Telephone Number, we have to print all possible strings created from that. The mapping of the numbers is the one as exactly on a phone s keypad. i.e. for 1,0-> No Letter for 2->...

typedef ing STL wstring

Why is it when i do the following i get errors when relating to with wchar_t? namespace Foo { typedef std::wstring String; } Now i declare all my strings as Foo::String through out the program, ...

C# Marshal / Pinvoke CBitmap?

I cannot figure out how to marshal a C++ CBitmap to a C# Bitmap or Image class. My import looks like this: [DllImport(@"test.dll", CharSet = CharSet.Unicode)] public static extern IntPtr ...

Window iconification status via Xlib

Is it possible to check with the means of pure X11/Xlib only whether the given window is iconified/minimized, and, if it is, how?

热门标签