为什么我的继承了CScrollView的类在显示图像之后没有那个滚轴呀??? 我写了一个继承CScrollView的类能显示图像但我在OnUpdate处进行SetScrollSizes时出错并且view的右边和下面没有滚轴why????? 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 没有滚轴我知道是怎么回事了但在OnUpdate函数中还是有错,代码如下: switch (lHint) { case WM_USER_NEWIMAGE: { m_tracker.m_rect = CRect(0,0,0,0); CWstArchivesDoc* pDoc = GetDocument(); CxImage* ima = pDoc->GetImage(); if (ima) { int px=GetScrollPos(SB_HORZ); int py=GetScrollPos(SB_VERT); CSize sz(GetTotalSize()); int x=(int)(ima->GetWidth()*pDoc->GetZoomFactor()); int y=(int)(ima->GetHeight()*pDoc->GetZoomFactor()); SetScrollSizes(MM_TEXT, CSize(x,y));///出错 CSize sz2(GetTotalSize()); CWnd* pFrame=GetParentFrame(); RECT rClient; pFrame->GetClientRect(&rClient); if (sz.cx!=0 && sz.cy!=0) { if (x > rClient.right) SetScrollPos(SB_HORZ,sz2.cx*px/sz.cx); else SetScrollPos(SB_HORZ,0); if (y > rClient.bottom) SetScrollPos(SB_VERT,sz2.cy*py/sz.cy); else SetScrollPos(SB_VERT,0); } if (!(pFrame->IsIconic()||pFrame->IsZoomed())){ RECT rMainCl,rFrame,rMainFr; ((CMainFrame *)(AfxGetApp()->m_pMainWnd))->GetClientRect(&rMainCl); ((CMainFrame *)(AfxGetApp()->m_pMainWnd))->GetWindowRect(&rMainFr); pFrame->GetWindowRect(&rFrame); pFrame->SetWindowPos(0,0,0, (4+rFrame.right-rFrame.left-rClient.right+rClient.left)+ min(rMainCl.right-(rFrame.left-rMainFr.left+12),x), (4+rFrame.bottom-rFrame.top-rClient.bottom+rClient.top)+ min(rMainCl.bottom-(rFrame.top-rMainFr.top+12),y), SWP_NOMOVE|SWP_NOZORDER); //ResizeParentToFit(1); } if (!ima->SelectionIsValid()) KillTimer(1);#ifdef VATI_EXTENSIONS ima->SetJpegQuality(theApp.m_optJpegQuality);#endif pDoc->m_hmax = 0; } break; } default: { CWstArchivesDoc* pDoc = GetDocument(); if (pDoc){ CxImage* ima = pDoc->GetImage(); if (ima){ if (pDoc->GetStretchMode()) SetScrollSizes(MM_TEXT, CSize(0,0)); else SetScrollSizes(MM_TEXT,CSize((int)(ima->GetWidth()*pDoc->GetZoomFactor()), (int)(ima->GetHeight()*pDoc->GetZoomFactor()))); } } } } CScrollView::OnUpdate(pSender, lHint, pHint); PicExTest的一点小问题 [vs2005 c++]制作程序启动画面问题? 菜鸟求救啊?如何载入并显示一副图啊?很急,在线等 请 找错误! 新手求救阿!!ado连接sql 50分,怎么样使SDI程序,开始运行时,一个视图也不打开!谢谢! visual stdio.net beta 2 是否有时间限制? 新手的一个问题 如何虚拟硬盘或光驱! api hook startdoc 32位进程异常 100分求教一个高难度Shell编程问题,但您只需简要回答,谢谢! 急救,请帮忙
但在OnUpdate函数中还是有错,代码如下: switch (lHint)
{
case WM_USER_NEWIMAGE:
{
m_tracker.m_rect = CRect(0,0,0,0); CWstArchivesDoc* pDoc = GetDocument();
CxImage* ima = pDoc->GetImage();
if (ima)
{
int px=GetScrollPos(SB_HORZ);
int py=GetScrollPos(SB_VERT);
CSize sz(GetTotalSize());
int x=(int)(ima->GetWidth()*pDoc->GetZoomFactor());
int y=(int)(ima->GetHeight()*pDoc->GetZoomFactor());
SetScrollSizes(MM_TEXT, CSize(x,y));///出错
CSize sz2(GetTotalSize()); CWnd* pFrame=GetParentFrame();
RECT rClient;
pFrame->GetClientRect(&rClient); if (sz.cx!=0 && sz.cy!=0)
{
if (x > rClient.right)
SetScrollPos(SB_HORZ,sz2.cx*px/sz.cx);
else
SetScrollPos(SB_HORZ,0);
if (y > rClient.bottom)
SetScrollPos(SB_VERT,sz2.cy*py/sz.cy);
else
SetScrollPos(SB_VERT,0);
} if (!(pFrame->IsIconic()||pFrame->IsZoomed())){
RECT rMainCl,rFrame,rMainFr;
((CMainFrame *)(AfxGetApp()->m_pMainWnd))->GetClientRect(&rMainCl);
((CMainFrame *)(AfxGetApp()->m_pMainWnd))->GetWindowRect(&rMainFr);
pFrame->GetWindowRect(&rFrame);
pFrame->SetWindowPos(0,0,0,
(4+rFrame.right-rFrame.left-rClient.right+rClient.left)+
min(rMainCl.right-(rFrame.left-rMainFr.left+12),x),
(4+rFrame.bottom-rFrame.top-rClient.bottom+rClient.top)+
min(rMainCl.bottom-(rFrame.top-rMainFr.top+12),y),
SWP_NOMOVE|SWP_NOZORDER);
//ResizeParentToFit(1);
} if (!ima->SelectionIsValid())
KillTimer(1);#ifdef VATI_EXTENSIONS
ima->SetJpegQuality(theApp.m_optJpegQuality);
#endif
pDoc->m_hmax = 0;
} break;
}
default:
{
CWstArchivesDoc* pDoc = GetDocument();
if (pDoc){
CxImage* ima = pDoc->GetImage();
if (ima){
if (pDoc->GetStretchMode())
SetScrollSizes(MM_TEXT, CSize(0,0));
else
SetScrollSizes(MM_TEXT,CSize((int)(ima->GetWidth()*pDoc->GetZoomFactor()),
(int)(ima->GetHeight()*pDoc->GetZoomFactor())));
}
}
}
}
CScrollView::OnUpdate(pSender, lHint, pHint);