MFC创建了一个对话框(有状态栏和编辑框) 如何在对话框底部的状态栏中显示编辑框中的行号和列号 当鼠标在某行时,在状态栏中显示编辑框中的行号和列号 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 每次edit框的selectchange都要重新设置状态栏! 添加个消息响应函数OnMouseMove(UINT nFlags, CPoint point)然后将point的值进行一下格式化CString m_str = "";m_str.Format("x=%d,y=%d",point.x,point.y); 1>.在串表中加:static UINT indicators[] ={ ID_SEPARATOR, // status line indicator ID_INDICATOR_LINE, ID_INDICATOR_COLUMN, ID_SEPARATOR, // ID_INDICATOR_SCRL,};2>.初始化时: m_wndStatusBar.SetPaneText(0,"Can You See Status Bar?"); UINT nID; UINT nStyle; int cxWidth; m_wndStatusBar.GetPaneInfo(1, nID, nStyle, cxWidth ); cxWidth+=15; m_wndStatusBar.SetPaneInfo(1, nID, nStyle, cxWidth ); //每当行列变化时: m_wndStatusBar.SetPaneText(1,"L= 100"); m_wndStatusBar.SetPaneText(2,"C= 100"); 重写CEdit类,处理WM_LBUTTONDOWN消息,类似这样:void CNewEdit::OnLButtonDown(UINT nFlags, CPoint point) { // TODO: Add your message handler code here and/or call default CEdit::OnLButtonDown(nFlags, point); int n = CharFromPos(point); int nLineIndex = HIWORD(n); int nCharIndex = LOWORD(n); int nColIndex = nCharIndex - LineIndex(-1); CString str; str.Format(_T("Line: %d, Col: %d"), nLineIndex, nColIndex); AfxMessageBox(str);} 把点击的行数取出放入状态栏不就行了,那些都有对应的api的 啥也别想,先定义两全局变量X,Y表示位置剩下的问题就简单了,一分为二1,如何得到行列数保存到X,Y里2,如何在状态栏显示X,Y这下各是各的,问题简单化了吧? 通过VC对Access表进行添加操作 谁来讲一下ODBC/MFC 中3个类的分别作用??如何详细的理解这3个类?? 大家谁知道那里能找到MP3的编码方式? 如何改变消息框中BUTTON的大小? cpu资源问题 139端口用来干什么的? 如何把硬盘上的位图加载到资源当中? 为何GetIcon()得到的图标不一定是窗口左上角的图标? 各位大侠,请推荐一本用vc或c++实现winsock编程的的书! 如何实现DELPHI的普通FORM调用DELPHI的ACTIVE FORM的成员? 重启电脑后服务进程启动时报错 关于处理 异常的疑问。
然后将point的值进行一下格式化
CString m_str = "";
m_str.Format("x=%d,y=%d",point.x,point.y);
static UINT indicators[] =
{
ID_SEPARATOR, // status line indicator
ID_INDICATOR_LINE,
ID_INDICATOR_COLUMN,
ID_SEPARATOR, //
ID_INDICATOR_SCRL,
};
2>.初始化时:
m_wndStatusBar.SetPaneText(0,"Can You See Status Bar?");
UINT nID;
UINT nStyle;
int cxWidth;
m_wndStatusBar.GetPaneInfo(1, nID, nStyle, cxWidth );
cxWidth+=15;
m_wndStatusBar.SetPaneInfo(1, nID, nStyle, cxWidth );
//每当行列变化时:
m_wndStatusBar.SetPaneText(1,"L= 100");
m_wndStatusBar.SetPaneText(2,"C= 100");
{
// TODO: Add your message handler code here and/or call default
CEdit::OnLButtonDown(nFlags, point); int n = CharFromPos(point);
int nLineIndex = HIWORD(n);
int nCharIndex = LOWORD(n);
int nColIndex = nCharIndex - LineIndex(-1);
CString str;
str.Format(_T("Line: %d, Col: %d"), nLineIndex, nColIndex);
AfxMessageBox(str);
}
2,如何在状态栏显示X,Y这下各是各的,问题简单化了吧?