调整自定义控件的大小

编程入门 行业动态 更新时间:2024-10-24 03:23:50
本文介绍了调整自定义控件的大小的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我正在开发一个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.

更多推荐

调整自定义控件的大小

本文发布于:2023-11-08 07:50:33,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1568785.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:自定义   控件   大小

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!