本文整理汇总了C++中Viewer::GoodScrollPos方法的典型用法代码示例。如果您正苦于以下问题:C++ Viewer::GoodScrollPos方法的具体用法?C++ Viewer::GoodScrollPos怎么用?C++ Viewer::GoodScrollPos使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Viewer
的用法示例。
在下文中一共展示了Viewer::GoodScrollPos方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: WndProcViewer
LRESULT CALLBACK Viewer::WndProcViewer(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
WORD id;
POINTS pts;
Viewer *v;
if(!g_viewer) goto exit1;
v=g_viewer;
switch(msg) {
case WM_ERASEBKGND:
return 1;
case WM_PAINT:
{
PAINTSTRUCT paintStruct;
HDC hdc;
HBRUSH hbr1;
int rv;
hdc = BeginPaint(hwnd, &paintStruct);
if(v->m_dib) {
v->GoodScrollPos();
// paint the image
SetStretchBltMode(hdc,COLORONCOLOR);
rv=StretchDIBits(hdc,
v->m_imgpos_x,v->m_imgpos_y,v->m_stretchedwidth,v->m_stretchedheight,
0,0,v->m_dib->biWidth,v->m_dib->biHeight,
v->m_bits,(LPBITMAPINFO)v->m_dib,
DIB_RGB_COLORS,SRCCOPY);
if(rv==GDI_ERROR || rv<1) {
RECT r1;
// Failure probably means we've exceeded the video system's
// stretching limits. Draw a black rectangle instead.
r1.left=v->m_imgpos_x;
r1.top=v->m_imgpos_y;
r1.right=v->m_imgpos_x+v->m_stretchedwidth;
r1.bottom=v->m_imgpos_y+v->m_stretchedheight;
FillRect(hdc,&r1,(HBRUSH)GetStockObject(BLACK_BRUSH));
}
// paint the background
ExcludeClipRect(hdc,
v->m_imgpos_x, v->m_imgpos_y,
v->m_imgpos_x+v->m_stretchedwidth, v->m_imgpos_y+v->m_stretchedheight);
if(globals.window_bgcolor==TWPNG_WBG_SYSDEFAULT) {
FillRect(hdc,&v->m_clientrect,GetSysColorBrush(COLOR_WINDOW));
}
else {
if(globals.window_bgcolor==TWPNG_WBG_SAMEASIMAGE && v->m_imghasbgcolor)
hbr1 = CreateSolidBrush(v->m_imgbgcolor);
else
hbr1 = CreateSolidBrush(globals.custombgcolor);
FillRect(hdc,&v->m_clientrect,hbr1);
DeleteObject(hbr1);
}
}
else {
FillRect(hdc,&v->m_clientrect,GetSysColorBrush(COLOR_WINDOW));
if(v->m_errorflag) {
SetTextColor(hdc,RGB(128,0,0));
SetBkColor(hdc,RGB(255,255,255));
SetBkMode(hdc,OPAQUE);
SelectObject(hdc,GetStockObject(ANSI_VAR_FONT));
DrawText(hdc,v->m_errormsg,-1,&v->m_clientrect,
DT_NOPREFIX|DT_WORDBREAK);
}
}
EndPaint(hwnd, &paintStruct);
return 0;
}
case WM_INITMENU:
{
HMENU m;
m=(HMENU)wParam;
EnableMenuItem(m,ID_COPYIMAGE,MF_BYCOMMAND|(v->m_dib?MF_ENABLED:MF_GRAYED));
CheckMenuItem(m,ID_GAMMACORRECT,MF_BYCOMMAND|
(globals.use_gamma?MF_CHECKED:MF_UNCHECKED));
CheckMenuItem(m,ID_CORRECTNONSQUARE,MF_BYCOMMAND|
(globals.viewer_correct_nonsquare?MF_CHECKED:MF_UNCHECKED));
CheckMenuItem(m,ID_BG_CUSTOM,MF_BYCOMMAND|
(globals.use_custombg==1 && globals.use_imagebg==0 ? MF_CHECKED:MF_UNCHECKED));
CheckMenuItem(m,ID_BG_IMAGEORCUSTOM,MF_BYCOMMAND|
(globals.use_custombg && globals.use_imagebg ? MF_CHECKED:MF_UNCHECKED));
CheckMenuItem(m,ID_BG_STRIPALPHA,MF_BYCOMMAND|
(globals.use_custombg==0 && globals.use_imagebg==0 ? MF_CHECKED:MF_UNCHECKED));
CheckMenuItem(m,ID_WBG_SAMEASIMAGE,MF_BYCOMMAND|
(globals.window_bgcolor==TWPNG_WBG_SAMEASIMAGE?MF_CHECKED:MF_UNCHECKED));
CheckMenuItem(m,ID_WBG_SYSDEFAULT,MF_BYCOMMAND|
(globals.window_bgcolor==TWPNG_WBG_SYSDEFAULT?MF_CHECKED:MF_UNCHECKED));
CheckMenuItem(m,ID_WBG_CUSTOM,MF_BYCOMMAND|
(globals.window_bgcolor==TWPNG_WBG_CUSTOM?MF_CHECKED:MF_UNCHECKED));
//.........这里部分代码省略.........