mfc 控件大小 调整大小_在运行时调整控件大小的简单技巧

mfc 控件大小 调整大小

This article describes a simple method to resize a control at runtime.  It includes ready-to-use source code and a complete sample demonstration application.  We'll also talk about C# Extension Methods.

本文介绍了一种在运行时调整控件大小的简单方法。 它包括现成的源代码和完整的示例演示应用程序。 我们还将讨论C#扩展方法。

Demo

Introduction

介绍

In one of my applications I needed a control that could be resizable at run time. Just like the canvas in MSPaint, you can resize it inside the host window. After a quick search on the internet I noticed that most solutions treating this simple issue as a beast.  An example of a "complex implementation" is in the EE Solution, here.

在我的一个应用程序中,我需要一个可以在运行时调整大小的控件。 就像MSPaint中的画布一样,您可以在主机窗口中调整其大小。 在互联网上快速搜索之后,我注意到大多数解决方案都将这个简单的问题视为野兽。 “复杂实现”的一个示例在EE解决方案中( 此处)

Using SendMessage is an intuitive temptation.  We could try the technique I descried in my previous article on how to drag a form -- wehe we simply flood mouse movement to the caption of the host form.  However, the parameters for resizing message scattered to eight directions and you'd have to calculate the delta in each direction to make it work.  That’s why the code tends to become so bulky.

使用SendMessage是一种直观的诱惑。 我们可以尝试在

  • 1
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值