VC超链接问题 如何实现让鼠标移动到一CStatic上的时候,点击实现超链接! 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 用ShellExcute吧.看看:http://topic.csdn.net/u/20071221/15/e2fe650b-bc00-452a-8628-0578311e6493.html void CTestDlg::OnMouseMove(UINT nFlags, CPoint point){ // TODO: 在此添加消息处理程序代码和/或调用默认值 CRect rcLink; m_Link.GetClientRect( &rcLink ); m_Link.ClientToScreen( &rcLink ); ScreenToClient( &rcLink ); if( point.x > rcLink.left && point.x < rcLink.right && point.y > rcLink.top && point.y < rcLink.bottom ) { HCURSOR hCursor; hCursor = ::AfxGetApp()->LoadCursorW( IDC_HAND ); SetCursor( hCursor ); } CDialog::OnMouseMove(nFlags, point);}void CTestDlg::OnLButtonDown(UINT nFlags, CPoint point){ // TODO: 在此添加消息处理程序代码和/或调用默认值 CRect rcLink; m_Link.GetClientRect( &rcLink ); m_Link.ClientToScreen( &rcLink ); ScreenToClient( &rcLink ); if( point.x > rcLink.left && point.x < rcLink.right && point.y > rcLink.top && point.y < rcLink.bottom ) { if( nFlags == MK_LBUTTON ) ShellExecute( NULL, NULL, _T("http://www.csdn.net"), NULL, NULL, SW_NORMAL ); } CDialog::OnLButtonDown(nFlags, point);} 我应该怎么样来判断鼠标移动到了我CStatic的位置上了呢! CRect rcLink; m_Static.GetClientRect( &rcLink ); // 这个m_Static就是你m_Static.ClientToScreen( &rcLink ); ScreenToClient( &rcLink ); if( point.x > rcLink.left && point.x < rcLink.right && point.y > rcLink.top && point.y < rcLink.bottom ) { // 移动到了static上了} 这个LoadCursor我改了hCursor = ::LoadCursor(NULL, IDC_HAND );那样写可能没效果 m_link应该是指静态控件吧恩 是CStatic类型的的变量 ((CStatic*)GetDlgItem(IDC_STATIC1))->GetClientRect(&rcLink); 就这有点区别塞!但是这样的吧! 8楼的 我的E-Mail [email protected]先谢达! 最好就从CStatic继承一个类嘛,不久好用了。 OnMouseMove的if语句里下个断点吧,看看鼠标放在区域内的时候,进断点了没,自己调调吧,这么多天了 解决了吧 m_Link 是怎么定义的啊? 怎么确定你那个m_Link就是他的 CStatic 啊?大哥,,我不明白啊 散分了,论坛的奖章是怎么搞来的呀^_^ 线程和串口的问题!! 关于VC调用javascript的方法,请指点一下。 鼠标移动会导致框架窗口重绘吗? 求助在SDK下使用ActiveX控件遇到的问题,200分 包含SAFTARRAY的VARIANT的数据怎么取出来? 哪里能找到关于CALLBACK,APIENTRY等方面的详细资料! 在使用CopyFile拷贝文件之前,要不要需要测试一下这个文件能不能打开,或这个文件正在使用? MFC如何搭建本地服务器 请问如何查看文件大小?如何给文件重命名? vc++2005的苦恼`菜鸟跪求解决方法。Orc```` 对HORZSIZE和VERTSIZE的疑惑
看看:http://topic.csdn.net/u/20071221/15/e2fe650b-bc00-452a-8628-0578311e6493.html
void CTestDlg::OnMouseMove(UINT nFlags, CPoint point)
{
// TODO: 在此添加消息处理程序代码和/或调用默认值
CRect rcLink;
m_Link.GetClientRect( &rcLink );
m_Link.ClientToScreen( &rcLink );
ScreenToClient( &rcLink ); if( point.x > rcLink.left && point.x < rcLink.right && point.y > rcLink.top && point.y < rcLink.bottom )
{
HCURSOR hCursor;
hCursor = ::AfxGetApp()->LoadCursorW( IDC_HAND ); SetCursor( hCursor );
}
CDialog::OnMouseMove(nFlags, point);
}void CTestDlg::OnLButtonDown(UINT nFlags, CPoint point)
{
// TODO: 在此添加消息处理程序代码和/或调用默认值
CRect rcLink;
m_Link.GetClientRect( &rcLink );
m_Link.ClientToScreen( &rcLink );
ScreenToClient( &rcLink ); if( point.x > rcLink.left && point.x < rcLink.right && point.y > rcLink.top && point.y < rcLink.bottom )
{
if( nFlags == MK_LBUTTON )
ShellExecute( NULL, NULL, _T("http://www.csdn.net"), NULL, NULL, SW_NORMAL );
}
CDialog::OnLButtonDown(nFlags, point);
}
CRect rcLink;
m_Static.GetClientRect( &rcLink ); // 这个m_Static就是你
m_Static.ClientToScreen( &rcLink );
ScreenToClient( &rcLink ); if( point.x > rcLink.left && point.x < rcLink.right && point.y > rcLink.top && point.y < rcLink.bottom )
{
// 移动到了static上了
}
hCursor = ::LoadCursor(NULL, IDC_HAND );
那样写可能没效果
恩 是CStatic类型的的变量
但是这样的吧!
先谢达!