[英]SetWindowPos has not effect on tooltip
I am trying to give my ComboBox an in place tooltip for long strings. 我试图给我的ComboBox一个适合长字符串的工具提示。 However when I call SetWindowPos on the tooltip, the position is never changed. 但是,当我在工具提示上调用SetWindowPos时,位置永远不会改变。 Called when TTN_SHOW is received: 在收到TTN_SHOW时调用:
::SetWindowPos(textTooltip, NULL, TipRect.left, TipRect.top, 0, 0, SWP_NOSIZE | SWP_NOACTIVATE | SWP_NOZORDER);
If I remove the SWP_NOSIZE flag and pop in some values into the width/height, then the combo box changes size to these values but the position remains the same. 如果我删除了SWP_NOSIZE标志,并在宽度/高度中弹出了一些值,则组合框会将大小更改为这些值,但位置保持不变。 SetWindowPos always returns TRUE. SetWindowPos始终返回TRUE。
The tip is initialised like so: 提示是这样初始化的:
textTooltip = CreateWindowEx(WS_EX_TRANSPARENT, TOOLTIPS_CLASS, NULL, TTS_NOPREFIX, 0, 0, 0, 0, this->GetSafeHwnd(), NULL, NULL, NULL);
if(!textTooltip)
return;
ZeroMemory(&ToolInfo, sizeof(TOOLINFO));
ToolInfo.cbSize = sizeof(TOOLINFO);
ToolInfo.uFlags = TTF_TRANSPARENT | TTF_SUBCLASS;
ToolInfo.hwnd = this->GetSafeHwnd();
ToolInfo.lpszText = "place holder"; //set in OnSelectChangeOk
ToolInfo.uId = 0;
ToolInfo.rect = TipRect; //rect is re-set in OnSelectChangeOk
::SendMessage(textTooltip, TTM_ADDTOOL, 0, (LPARAM)&ToolInfo);
Am I missing something? 我想念什么吗?
you gotta do ::SendMessage(hToolWnd, TTM_TRACKPOSITION, 0, MAKELPARAM(x, y));
您必须执行::SendMessage(hToolWnd, TTM_TRACKPOSITION, 0, MAKELPARAM(x, y));
and set the TTF_ABSOLUTE
flag in the ToolInfo.uFlags
member! 并在ToolInfo.uFlags
成员中设置TTF_ABSOLUTE
标志!
Fore more information, refer to: http://msdn.microsoft.com/en-us/library/bb760422(VS.85).aspx 有关更多信息,请参阅: http : //msdn.microsoft.com/zh-cn/library/bb760422(VS.85).aspx
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.