我正在开发一个mfc应用程序,其中有一个主对话框,上面有几个自定义控件。 我有两个自定义控件,一个在另一个之下。 我想在它们之间添加一个水平分割条,这样当向下移动时,顶部控件的尺寸增加(即长度),底部控制尺寸减小(即长度),反之亦然。 我对应该应用的逻辑感到困惑。移动分割条时,如何相应更改顶部和底部控件?我应该用新尺寸重新绘制它们吗?(但是不能重新划分分割器的每一个动作效率低下并且可能导致闪烁?)或者是否有办法增加/减少长度。 我也遇到了DefWindowProc。它可以在这种情况下使用吗? 非常感谢你的帮助!!
I'm working on a mfc application, where there is a main dialog with several custom controls on it. I have two custom controls, one below the other. I want to add a horizontal splitter bar between them, such that when moved down, the top control increases in size(i.e. in length) and the bottom control decreses in size(i.e. length) and vice versa. I'm confused about the logic I should apply. When the splitter bar is moved, how do I change the top and bottom controls accordingly? Should I re-draw them with the new dimensions?(But isn't redrawing for every move of the splitter inefficient and may lead to flickering?) Or is there a way to just increase/decrease the length. I also came across DefWindowProc. Can it be used in this case? Thanks a lot for the help!!
推荐答案MFC分割器是为了与它们的视图类一起使用而编写的。最近的一篇CP文章提供了一个对话分割器类这里 [ ^ ]以及如何使用它的示例。 The MFC splitter was written for use with their view classes. A recent CP article provides a dialog splitter class here[^] with examples on how to use it.
感谢Brydon的链接! 我会尝试理解这篇文章并试着加入它。 Thanks for the link Brydon! I'll try and understand the article and try and incorporate it.
更多推荐
调整自定义控件的大小
发布评论