位图按钮功能 [英] Bitmapped button functionality
问题描述
你好,
我有一个与启用了位图的对话"窗口的使用有关的问题.我已经创建了一个键盘类型布局,并且我也希望通过键盘获得输入.使用鼠标时,我可以按下按钮,并且所有按钮都可以正常工作-其他图像DEFAULT,SELECTED,DISABLED ...都已加载并可以正常工作,因为我正在使用功能Loadbitmaps()
功能)所能完成的操作.
我正在使用这三个功能来实现与使用鼠标相同的作用和效果:
-LoadBitmap()
-SetBitmap()
-Invalidate()
但是,尽管它们在内部起作用,但似乎并没有给按钮带来效果.有人可以帮我吗?
谢谢和问候
Sayonee
Hello there,
I have an issue related to the usage of the bitmap enabled Dialog window. I have created a keyboard type layout and I wish to get the input through keyboard also. When I use the mouse, I am able to get the button(s) pressed and also all the buttons are working fine - the other images DEFAULT, SELECTED, DISABLED... all get loaded and work since I am using the function m_BtnBtn1Ctrl.LoadBitmaps
. But then, any key pressed on keyboard and the corresponding character on the screen isn''t able to do the same as I have been able to do it with clicking of the mouse (and using the Loadbitmaps()
function).
I am using these 3 functions to achieve the same action and effect as that of using a mouse:
- LoadBitmap()
- SetBitmap()
- Invalidate()
But these don''t seem to give the pressed button effect though internally they work. Can some one please help me with this?
Thanks and regards
Sayonee
BOOL KeyBoard_press::PreTranslateMessage(MSG* pMsg)
{
// TODO: Add your specialized code here and/or call the base class
CString strTemp;
if (pMsg->message == WM_KEYDOWN)
{
if ( pMsg->wParam == 0x41 || pMsg->wParam == 0x61) //check for both 'a' and 'A'
OnBtnBtn1();
if (pMsg->wParam == VK_RETURN || pMsg->wParam == VK_DELETE ||
pMsg->wParam == VK_ESCAPE || pMsg->wParam == VK_TAB ||
pMsg->wParam == VK_UP || pMsg->wParam == VK_DOWN || GetKeyState (VK_CONTROL))
{
::TranslateMessage (pMsg);
::DispatchMessage (pMsg);
return TRUE; // DO NOT process further
}
}
return CDialog::PreTranslateMessage(pMsg);
}
[edit]删除了粗体[/edit]
[edit]removed bolding[/edit]
推荐答案
我想这与焦点有关吗?尝试SetFocus().
Rozis
I guess it has something to do with focus? Try SetFocus().
Rozis
nope尝试了所有操作..对不起,我的回复太晚了,我的工作让我很忙,而我一直在专注":doh:在某些其他问题上,任何代码示例都可以帮助我..再次感谢
nope tried everything ..sorry this reply of mine is late and my work had kept me busy instead I was "focussing" :doh: on some other issues any code example will help me ..thanks again
这篇关于位图按钮功能的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!