在Alt +鼠标左键单击并在MFC,C ++中拖动时选择文本列 [英] Select columns of text when alt+ mouse left click and dragged in MFC, C++

查看:324
本文介绍了在Alt +鼠标左键单击并在MFC,C ++中拖动时选择文本列的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当alt和鼠标左键被关闭并拖动时,我需要选择文本列。

我需要实现visual studio中存在的操作,因为我们使用alt和鼠标选择文本列左键被点击并拖动。









提前致谢



我尝试了什么:



我什么都不知道实现这一点。

I need to select columns of text when alt and mouse left key is down and dragged.
I need to implement the operation which exists in visual studio as we select columns of text with alt and mouse left key is clicked and dragged.




Thanks in advance

What I have tried:

I dont have any idea of implementing this.

推荐答案

所以你已经创建了自己的 CWnd 控件。



然后你必须自己使用鼠标按钮向上和向上以及鼠标移动的常用处理程序来实现它。使用 GetKeyState(VK_MENU)检查ALT键状态,并相应地设置类成员变量,以指示选择是否处于活动状态以及启动位置:

  • 按下按钮:如果ALT按下保存开始位置并将状态设置为选择

  • 移动:如果状态为选择更新屏幕以显示选择

  • 按钮:如果状态是选择保存结束位置并将状态设置为有选择

  • 复制:如果状态为已选择复制到剪贴板

So you have created your own CWnd based control.

Then you have to implement it yourself using the common handlers for mouse button down and up, and mouse move. There check the ALT key state with GetKeyState(VK_MENU) and set class member variables accordingly to indicate that selection is active and where it starts:
  • Button down: if ALT down save start position and set state to "selecting"
  • Move: if state is "selecting" update screen to show the selection
  • Button up: if state is "selecting" save end position and set state to "has selection"
  • Copy: if state is "has selection" copy to clipboard


这篇关于在Alt +鼠标左键单击并在MFC,C ++中拖动时选择文本列的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆