将大小调整锚添加到派生的CMFCPropertySheet类 [英] Adding a resize anchor to derived CMFCPropertySheet class
问题描述
多亏了Stack Overflow的支持,我才能够创建自己的支持调整大小的CResizingMFCPropertySheet
.现在,我去添加一个调整大小的锚点,并使用了以下代码:
Thanks to the support of Stack Overflow I have been able to create my own CResizingMFCPropertySheet
that supports resizing. Now, I went to add a resize anchor and I used this code:
void CResizingMFCPropertySheet::InitialiseResizeIcon()
{
CRect rcIcon, rcClient;
m_bmpResize.LoadOEMBitmap(OBM_SIZE);
m_lblResize.Create(0, WS_CHILD | WS_VISIBLE | SS_BITMAP,
CRect(0, 0, 16, 16), this, IDC_STATIC_RESIZE);
m_lblResize.SetBitmap(m_bmpResize);
GetClientRect(rcClient);
m_lblResize.GetClientRect(rcIcon);
m_lblResize.SetWindowPos(&CWnd::wndTop, rcClient.right - rcIcon.Width(),
rcClient.bottom - rcIcon.Height(), 0, 0, SWP_NOSIZE);
}
(注意:以上代码已修改,不再使用动态布局-无效).
(Note: The above code is revised and no longer uses dynamic layout - doesn't work).
该方法在OnInitDialog
中被调用.第一次显示工作表时,它看起来不错:
The method gets called in OnInitDialog
. When the sheet is first displayed it looks OK:
您可以在右下角看到锚点.现在,当我调整窗口大小时:
You can see the anchor in the bottom right. Now, when i go to resize the window:
如您所见,它无法正确呈现锚点.
As you can see it is not rendering the anchor properly.
我已经设置了WS_CLIPSIBLINGS
,它没有区别.
I have set WS_CLIPSIBLINGS
and it makes no difference.
只是让所有人都知道新主题抓取器无法正常工作的原因是因为我没有添加OnNcHitTest
处理程序等.
Just to let everyone know the reason the new themed gripper was not working right was because I did not add the OnNcHitTest
handler etc.
推荐答案
我从未尝试过,我进行了一些搜索,并且动态地执行此操作似乎存在一些问题.有些人说无法做到,另一些人似乎提出了解决办法. 这是我找到的一些更好的链接,希望对您有所帮助.
I've never tried that, I did some searching and there appears to be some issues in doing this dynamically. Some said it cannot be done, others seem to propose ways of doing it. Here is are some of the better links I found, hope this helps.
https://www .codeproject.com/Tips/214744/How-to-implementationa-resizable-property-sheet-class
https://www.codeguru.com/cpp/controls/propertysheet/article.php/c543/Resizing-the-Property-Sheet.htm
这最终帮助了:
那里的答案说明了如何使用OnSize
正确绘制自定义子控件.
The answer there explains how to correctly drawn custom child controls with OnSize
.
这篇关于将大小调整锚添加到派生的CMFCPropertySheet类的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!