从ChooseColor对话框中获取当前单击的颜色 [英] Get the current clicked color from ChooseColor dialog

查看:189
本文介绍了从ChooseColor对话框中获取当前单击的颜色的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好,

在ChooseColor文档中,用户需要按OK,以便  LPCHOOSECOLOR
结构传递给函数包含选定的颜色。

From the ChooseColor documentation, the user needs to press OK so that the LPCHOOSECOLOR structure passed to the function contains the selected color.

我想知道是否有可能,从钩子程序(或其他方式),当对话框打开时,读取当前的
点击的颜色。

I would like to know if it is possible, from the hook procedure(or another way), to read the current clicked color when the dialog is open.

非常感谢!

文档:

https://msdn.microsoft.com/en-us/library / windows / desktop / ms646912(v = vs.85).aspx

https://msdn.microsoft.com/en-us/library/windows/desktop/ms646912(v=vs.85).aspx




推荐答案

我想知道是否有可能,从钩子程序(或其他方式) ,在对话框打开时读取当前的
单击颜色。

I would like to know if it is possible, from the hook procedure(or another way), to read the current clicked color when the dialog is open.

如果通过"当前点击的颜色"你的意思是 在鼠标单击之前选择的颜色
然后Castorix31的代码在钩子程序中运行良好。

If by "current clicked color" you mean  the selected color before a mouse click then Castorix31's code will work well from within a hook procedure.

但是,如果您打算确定所选在
a鼠标点击(例如,WM_LBUTTONDOWN)之后选择一种颜色,然后你需要继承颜色对话框,并在允许对话框之后确定颜色。处理鼠标消息。 处理WM_INITDIALOG时,在钩子内设置子类。

However, if you intend to determine the selected color after a mouse click (e.g., WM_LBUTTONDOWN) selects a color then you will need to subclass the Color dialog box and determine the color after allowing the dialog to  handle the mouse message.  Set the subclass from within the hook when it process WM_INITDIALOG.


这篇关于从ChooseColor对话框中获取当前单击的颜色的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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