首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 开发语言 > VC/MFC >

派生于CEdit为什么不支持Ctrl+C解决方案

2012-02-08 
派生于CEdit为什么不支持Ctrl+C派生于Cedit的类,为什么不能用复制、粘贴等快捷方式呢?[解决办法]PreTransla

派生于CEdit为什么不支持Ctrl+C
派生于Cedit的类,为什么不能用复制、粘贴等快捷方式呢?

[解决办法]
PreTranslateMessage(MSG* pMsg)
再搞这个了
[解决办法]
好像是不能用ctrl + a 别的能用。跟自身文本格式有关系吧,自己也在求解
[解决办法]
BOOL myedit::PreTranslateMessage(MSG* pMsg)

做了手脚了??

那么对于你不处理的情况,(即复制,粘贴)
一定要保证程序会调用父类的pretranslateMessage()方法
就应该不会出问题的...
[解决办法]
我项目中用的,肯定行。
BOOL CEditEx::PreTranslateMessage( MSG* pMsg )
{
/**
* 编辑框快捷键操作
*/
if(pMsg-> message==WM_KEYDOWN )
{
if( ( GetKeyState( VK_CONTROL ) & 0xFF00 ) ==0xFF00 )
{
/**
* 全选
*/
if( pMsg-> wParam == 'A ' || pMsg-> wParam == 'a ')
{
this-> SetSel( 0, -1 );
return true;
}

/**
* copy
*/
if( pMsg-> wParam == 'C ' || pMsg-> wParam == 'c ')
{
this-> Copy();
return true;
}
/**
* cut
*/
if( pMsg-> wParam == 'X ' || pMsg-> wParam == 'x ')
{
this-> Cut();
return true;
}

/**
* paste
*/
if( pMsg-> wParam == 'V ' || pMsg-> wParam == 'v ')
{
this-> Paste();
return true;
}

/**
* undo
*/
if( pMsg-> wParam == 'Z ' || pMsg-> wParam == 'z ')
{
this-> Undo();
return true;

}
}
}
}

热点排行