本文整理汇总了C++中CStatusBar::CommandToIndex方法的典型用法代码示例。如果您正苦于以下问题:C++ CStatusBar::CommandToIndex方法的具体用法?C++ CStatusBar::CommandToIndex怎么用?C++ CStatusBar::CommandToIndex使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CStatusBar
的用法示例。
在下文中一共展示了CStatusBar::CommandToIndex方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: OnMouseMove
void CBaseView::OnMouseMove(UINT nFlags, CPoint point)
{
CWnd::OnMouseMove(nFlags, point);
CStatusBar* pStatusBar = DYNAMIC_DOWNCAST(CStatusBar,
AfxGetMainWnd()->GetDlgItem(AFX_IDW_STATUS_BAR));
ASSERT(pStatusBar != NULL);
Point2d pnt((float)point.x, (float)point.y);
pnt *= m_graph->xf.displayToModel();
CString str;
int index = pStatusBar->CommandToIndex(ID_INDICATOR_X);
if (index >= 0)
{
str.Format(_T("X: %.2lf"), pnt.x);
pStatusBar->SetPaneText(index, str);
}
index = pStatusBar->CommandToIndex(ID_INDICATOR_Y);
if (index >= 0)
{
str.Format(_T("Y: %.2lf"), pnt.y);
pStatusBar->SetPaneText(index, str);
}
}
示例2: OnOpenDocument
BOOL CCOXRayDoc::OnOpenDocument(LPCTSTR lpszPathName)
{
if (!CDocument::OnOpenDocument(lpszPathName))
return FALSE;
// TODO: 在此添加您专用的创建代码
USES_CONVERSION;
char *filename = W2A(lpszPathName);
if (m_pHWorkImage == NULL)
{
m_pHWorkImage = new HImage();
}
if (m_pOriginImage == NULL)
{
m_pOriginImage = new HImage();
}
// 清空Undo
ClearUndoDraw();
ClearUndoImage();
m_UndoType.RemoveAll();
m_Stopwatch.Start();
HImage Image;
try
{
*m_pHWorkImage = HImage::ReadImage(filename);
}
catch (HException &except)
{
CString strErrorMsg;
strErrorMsg.Format(_T("读图像失败,请确认是否为图像格式!"));
AfxMessageBox(strErrorMsg);
return FALSE;
}
m_Stopwatch.Stop();
// 转换为8位3通道
// if (GetImageBits(*m_pHWorkImage) == 16)
// {
// *m_pHWorkImage = ConvertImage(*m_pHWorkImage,IPL_DEPTH_8U,3);
// }
// 备份原始图像
*m_pOriginImage = *m_pHWorkImage;
m_dbZoomFactor = 1;
m_nChanels = m_pHWorkImage->CountChannels();
// 转换为灰度图像
// if (m_nChanels > 1)
// {
// *m_pHWorkImage = m_pHWorkImage->Rgb1ToGray();
// m_nChanels = 1;
// }
CString strTime,strInfo,strExt,strZoom;
strExt = CUtils::GetFileExt(lpszPathName);
strExt.MakeUpper();
int bits = GetImageBits(m_pHWorkImage->GetImageType()[0].S());
bits *= m_nChanels;
strTime.Format(_T("Time: %.2f s"),m_Stopwatch.GetSecond());
strInfo.Format(_T("%s %dx%dx%d"),strExt,m_pHWorkImage->Width(),m_pHWorkImage->Height(),bits);
strZoom.Format(_T("%.0f%%"),m_dbZoomFactor * 100);
CStatusBar *pStatusBar = ((CMainFrame *)AfxGetMainWnd())->GetStatusBar();
int nIndex = pStatusBar->CommandToIndex(ID_INDICATOR_TIME);
pStatusBar->SetPaneText(nIndex,strTime);
nIndex = pStatusBar->CommandToIndex(ID_INDICATOR_IMG_INFO);
pStatusBar->SetPaneText(nIndex,strInfo);
nIndex = pStatusBar->CommandToIndex(ID_INDICATOR_ZOOM);
pStatusBar->SetPaneText(nIndex,strZoom);
//UpdateAllViews(NULL,WM_USER_NEWIMAGE);
OnBtnFitWindow();
return TRUE;
}