MFC操作——滚动字幕

1,将CreditStatic.h CreditStatic.cpp文件添加到工程目录下,并加到程序中

在客户区画直线等图形时,
发现当其最小化或者其他窗口遮挡时,出现窗口重绘,而将原来绘制的图形删除,上网上搜索知道,绘制图形的代码必须放置在Ondraw函数中,才能避免重绘时图形消失(因为一直在响应WM_PAINT消息,不断的重绘),但是这样做却只能保存最近的一次绘图,只适用于单幅固定的图形,对于其中有多幅图形就不能这么做了,解决的思路是:考虑到MFC时
文档/视图
类,视图CView负责数据的显示和修改,文档CDocument类负责数据的存储和加载,从而把数据管理和显示方法分离开来。我们在CDocument类中添加一个CBitMap对象,将每次中间绘图时的客户区的内容保存成BitMap,当所有的操作都执行好以后,将最终的BitMap拷贝到屏幕中,这就是所谓的内存缓存画图方式。这么做还有一个好处就是更新是看不到闪烁。

2,在相应的对话框中添加变量:CCreditStatic m_static;

具体代码如下:

3,在相应的对话框中添加静态文本,并修改其ID为:IDC_DISPLAY_STATIC

1、中间图形处理过程(事先已经在CDrawDoc类中添加了变量CBitmap
m_bmpBuf;):

4,在相应的对话框的OnInitDialog函数中添加代码如下:

void CDrawView::OnLButtonUp(UINT nFlags, CPoint point)
{
 CDC *pDC = GetDC();
 CDrawDoc *pDoc = GetDocument();
 CDC dcMem;

m_static.SubclassDlgItem(IDC_DISPLAY_STATIC,this);

dcMem.CreateCompatibleDC(NULL);
 CRect rect;
 GetClientRect(&rect); //获取客户区域
 pDoc->m_bmpBuf.DeleteObject();
 pDoc->m_bmpBuf.CreateCompatibleBitmap(pDC,rect.Width(),rect.Height());
 CBitmap *pOldBitmap =
dcMem.SelectObject(&pDoc->m_bmpBuf);//将创建好的m_bmpBuf添加到临时的CDC的Object中,类似于在墙上先糊上墙纸^_^,先在墙纸上作画,最后将最终形成的画拷贝到墙上。
 m_ptEnd = point;

m_static.SetBkImage(IDB_BITMAP1);

 dcMem.BitBlt(0,0,rect.Width(),rect.Height(),pDC,0,0,SRCCOPY);

m_static.SetCredits(pArrCredit,|);

 dcMem.SelectObject(pOldBitmap);
//将pDC即当前客户区里面的内容拷贝到临时的MEM中,MEM虽然过后会被delete掉,但是它更新了CDocument类中的m_bmpBuf
 m_bDraw = false;
 dcMem.DeleteDC();
}

m_static.SetSpeed(1);

2、最终显示(在OnDraw中实现):

m_static.SetColor(BACKGROUND_COLOR, RGB(0,0,0));

void CDrawView::OnDraw(CDC* pDC)
{
 CDrawDoc* pDoc = GetDocument();
 ASSERT_VALID(pDoc);
 if (!pDoc)
  return;
 CRect rect;
 GetClientRect(&rect);
 CDC dcMem;//以下是输出位图的标准操作
 CBitmap *pOldBitmap = NULL;
 dcMem.CreateCompatibleDC(NULL);
 pOldBitmap = dcMem.SelectObject(&pDoc->m_bmpBuf);
 
 pDC->BitBlt(0,0,rect.Width(),rect.Height(),&dcMem,0,0,SRCCOPY);
 dcMem.SelectObject(pOldBitmap); //将dcMeM中的bitmap拷贝到当前客户区
 dcMem.DeleteDC();

m_static.SetTransparent();

}

m_static.StartScrolling();

 

其中::pArrCredit为char*类型,里边放要显示的字幕,在相应对话框的CDlg中声明并初始化,如::

char *pArrCredit = { ¸感谢你||购买本书||

本书会让你受益匪浅||本书作者||

BITMAP1^|||

};

[plain]view plaincopyprint?

1.CreditStatic.cpp的代码:

//CreditStatic.cpp:implementationfile

//

#includestdafx.h

#includeCreditStatic.h

#ifdef_DEBUG

#definenewDEBUG_NEW

#undefTHIS_FILE

staticcharTHIS_FILE[]=__FILE__;

#endif

#defineDISPLAY_TIMER_ID150//timerid

/////////////////////////////////////////////////////////////////////////////

//CCreditStatic

CCreditStatic::CCreditStatic()

{

m_Colors[0]=RGB(0,0,0);//Black

m_Colors[1]=RGB(255,0,0);//Red

m_Colors[2]=RGB(255,255,0);//Yellow

m_Colors[3]=RGB(0,255,255);//Turquoise

m_Colors[4]=RGB(255,255,255);//White

m_TextHeights[0]=21;

m_TextHeights[1]=19;

m_TextHeights[2]=17;

m_TextHeights[3]=15;

m_nCurrentFontHeight=m_TextHeights[NORMAL_TEXT_HEIGHT];

m_Escapes[0]=t;

m_Escapes[1]=n;

m_Escapes[2]=r;

m_Escapes[3]=^;

m_DisplaySpeed[0]=70;

m_DisplaySpeed[1]=40;

m_DisplaySpeed[2]=10;

m_CurrentSpeed=1;

m_ScrollAmount=-1;

m_bProcessingBitmap=FALSE;

m_ArrIndex=NULL;

m_nCounter=1;

m_nClip=0;

m_bFirstTime=TRUE;

m_bDrawText=FALSE;

m_bFirstTurn=TRUE;

m_Gradient=GRADIENT_NONE;

m_bTransparent=FALSE;

n_MaxWidth=0;

TimerOn=0;

}

CCreditStatic::~CCreditStatic()

{

}

BEGIN_MESSAGE_MAP(CCreditStatic,CStatic)

//{{AFX_MSG_MAP(CCreditStatic)

ON_WM_PAINT()

ON_WM_ERASEBKGND()

ON_WM_TIMER()

ON_WM_DESTROY()

//}}AFX_MSG_MAP

END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////

//CCreditStaticmessagehandlers

BOOLCCreditStatic::StartScrolling()

{

//滚动字符为空,返回

if(m_ArrCredit.IsEmpty())

returnFALSE;

if(m_BmpMain.m_hObject!=NULL){

m_BmpMain.DeleteObject();

m_BmpMain.m_hObject=NULL;

}

//设置定时间隔

TimerOn=SetTimer(DISPLAY_TIMER_ID,m_DisplaySpeed[m_CurrentSpeed],NULL);

ASSERT(TimerOn!=0);

m_ArrIndex=m_ArrCredit.GetHeadPosition();

m_nCounter=1;

m_nClip=0;

m_bFirstTime=TRUE;

m_bDrawText=FALSE;

returnTRUE;

}

//结束滚动

voidCCreditStatic::EndScrolling()

{

//结束定时

KillTimer(DISPLAY_TIMER_ID);

TimerOn=0;

if(m_BmpMain.m_hObject!=NULL){

m_BmpMain.DeleteObject();

m_BmpMain.m_hObject=NULL;

}

}

//得到分开的字符串,用来滚动显示

voidCCreditStatic::SetCredits(LPCTSTRcredits,chardelimiter)

{

char*str,*ptr1,*ptr2;

ASSERT(credits);

if((str=strdup(credits))==NULL)

return;

m_ArrCredit.RemoveAll();

ptr1=str;

//得到分开的字符串,其中/表示行与行之间的间隔

while((ptr2=strchr(ptr1,delimiter))!=NULL){

*ptr2=;

m_ArrCredit.AddTail(ptr1);

ptr1=ptr2+1;

}

m_ArrCredit.AddTail(ptr1);

free(str);

m_ArrIndex=m_ArrCredit.GetHeadPosition();

m_nCounter=1;

m_nClip=0;

m_bFirstTime=TRUE;

m_bDrawText=FALSE;

}

voidCCreditStatic::SetCredits(UINTnID,chardelimiter)

{

CStringcredits;

if(!credits.LoadString(nID))

return;

SetCredits((LPCTSTR)credits,delimiter);

}

//设置滚动速度

voidCCreditStatic::SetSpeed(UINTindex,intspeed)

{

ASSERT(index=DISPLAY_FAST);

if(speed)

m_DisplaySpeed[index]=speed;

m_CurrentSpeed=index;

}

//设置颜色,包括前景和背景

voidCCreditStatic::SetColor(UINTindex,COLORREFcol)

{

ASSERT(index=NORMAL_TEXT_COLOR);

m_Colors[index]=col;

}

//设置字符高度

voidCCreditStatic::SetTextHeight(UINTindex,intheight)

{

ASSERT(index=NORMAL_TEXT_HEIGHT);

m_TextHeights[index]=height;

}

voidCCreditStatic::SetEscape(UINTindex,charescape)

{

ASSERT(index=DISPLAY_BITMAP);

m_Escapes[index]=escape;

}

voidCCreditStatic::SetGradient(UINTvalue)

{

ASSERT(value=GRADIENT_LEFT_LIGHT);

m_Gradient=value;

}

//设置是否透明

voidCCreditStatic::SetTransparent(BOOLbTransparent)

{

m_bTransparent=bTransparent;

}

voidCCreditStatic::OnPaint()

{

CPaintDCdc(this);//devicecontextforpainting

if(TimerOn)return;

CDCmemDC;

memDC.CreateCompatibleDC(dc);

CBitmap*pOldMemDCBitmap=NULL;

CRectm_ScrollRect;

GetClientRect(m_ScrollRect);

if(m_BmpMain.m_hObject==NULL){

CDCmemDC2;

CBitmapbitmap;

memDC2.CreateCompatibleDC(dc);

bitmap.CreateCompatibleBitmap(dc,m_ScrollRect.Width(),m_ScrollRect.Height());

CBitmap*pOldMemDC2Bitmap=(CBitmap*)memDC2.SelectObject(bitmap);

DrawCredit(memDC2,m_ScrollRect);

AddBackGround(memDC2,m_ScrollRect,m_ScrollRect);

pOldMemDCBitmap=(CBitmap*)memDC.SelectObject(m_BmpMain);

memDC.BitBlt(0,0,m_ScrollRect.Width(),m_ScrollRect.Height(),

memDC2,0,0,SRCCOPY);

memDC2.SelectObject(pOldMemDC2Bitmap);

}

else

pOldMemDCBitmap=(CBitmap*)memDC.SelectObject(m_BmpMain);

dc.BitBlt(0,0,m_ScrollRect.Width(),m_ScrollRect.Height(),

memDC,0,0,SRCCOPY);

}

BOOLCCreditStatic::OnEraseBkgnd(CDC*pDC)

{

returnTRUE;

//returnCStatic::OnEraseBkgnd(pDC);

}

//************************************************************************

//OnTimer

//

//Oneachofthedisplaytimers,scrollthewindow1unit.Each20

//units,fetchthenextarrayelementandloadintoworkstring.Call

//InvalidateandUpdateWindowtoinvoketheOnPaintwhichwillpaint

//thecontentsofthenewlyupdatedworkstring.

//************************************************************************

voidCCreditStatic::OnTimer(UINTnIDEvent)

{

//非设置的定时器ID,返回

if(nIDEvent!=DISPLAY_TIMER_ID)

{

CStatic::OnTimer(nIDEvent);

return;

}

BOOLbCheck=FALSE;

//如果上次读入的字符串表示的不是位图名字

if(!m_bProcessingBitmap){

//根据m_nCurrentFontHeight高度决定需要多少次time响应才换一行字符显示

if(m_nCounter++%m_nCurrentFontHeight==0)

{

m_nCounter=1;

//读出字符串队列中下一行要显示的字符串

m_szWork=m_ArrCredit.GetNext(m_ArrIndex);

if(m_bFirstTurn)

bCheck=TRUE;

if(m_ArrIndex==NULL){

m_bFirstTurn=FALSE;

m_ArrIndex=m_ArrCredit.GetHeadPosition();

}

m_nClip=0;

m_bDrawText=TRUE;

}

}

CClientDCdc(this);

CRectm_ScrollRect;

GetClientRect(m_ScrollRect);//得到整个CStatic的客户区坐标

CRectm_ClientRect(m_ScrollRect);//用来表示滚动字符的范围

m_ClientRect.left=(m_ClientRect.Width()-n_MaxWidth)/2;

m_ClientRect.right=m_ClientRect.left+n_MaxWidth;

MoveCredit(dc,m_ScrollRect,m_ClientRect,bCheck);//实现字幕滚动1单元

AddBackGround(dc,m_ScrollRect,m_ClientRect);//添加背景

CStatic::OnTimer(nIDEvent);

}

//设置背景

voidCCreditStatic::AddBackGround(CDC*pDC,CRectm_ScrollRect,CRectm_ClientRect)

{

CDCmemDC;

memDC.CreateCompatibleDC(pDC);

if(m_bitmap.m_hObject==NULL)

{

CBitmap*pOldBitmap=memDC.SelectObject(m_BmpMain);

pDC-BitBlt(0,0,m_ScrollRect.Width(),m_ScrollRect.Height(),

memDC,0,0,SRCCOPY);

memDC.SelectObject(pOldBitmap);

return;

}

//Drawbitmapinthebackgroundifonehasbeenset

//Nowcreateamask

CBitmapbitmap;

bitmap.CreateCompatibleBitmap(pDC,m_ClientRect.Width(),m_ClientRect.Height());

CBitmap*pOldMemDCBitmap=memDC.SelectObject(bitmap);

CDCtempDC;

tempDC.CreateCompatibleDC(pDC);

CBitmap*pOldTempDCBitmap=tempDC.SelectObject(m_BmpMain);

memDC.BitBlt(0,0,m_ClientRect.Width(),m_ClientRect.Height(),tempDC,

m_ClientRect.left,m_ClientRect.top,SRCCOPY);

CDCmaskDC;

maskDC.CreateCompatibleDC(pDC);

CBitmapmaskBitmap;

//Createmonochromebitmapforthemask

maskBitmap.CreateBitmap(m_ClientRect.Width(),m_ClientRect.Height(),1,1,NULL);

CBitmap*pOldMaskDCBitmap=maskDC.SelectObject(maskBitmap);

memDC.SetBkColor(m_bTransparent?RGB(192,192,192):m_Colors[BACKGROUND_COLOR]);

//CreatethemaskfromthememoryDC

maskDC.BitBlt(0,0,m_ClientRect.Width(),m_ClientRect.Height(),memDC,0,0,SRCCOPY);

tempDC.SelectObject(pOldTempDCBitmap);

pOldTempDCBitmap=tempDC.SelectObject(m_bitmap);

CDCimageDC;

CBitmapbmpImage;

imageDC.CreateCompatibleDC(pDC);

bmpImage.CreateCompatibleBitmap(pDC,m_ScrollRect.Width(),m_ScrollRect.Height());

CBitmap*pOldImageDCBitmap=imageDC.SelectObject(bmpImage);

if(pDC-GetDeviceCaps(RASTERCAPS)RC_PALETTEm_pal.m_hObject!=NULL)

{

pDC-SelectPalette(m_pal,FALSE);

pDC-RealizePalette();

imageDC.SelectPalette(m_pal,FALSE);

澳门新葡亰3522平台游戏,}

//Getxandyoffset

//DrawbitmapintiledmannertoimageDC

for(inti=0;im_ScrollRect.right;i+=m_cxBitmap)

for(intj=0;jm_ScrollRect.bottom;j+=m_cyBitmap)

imageDC.BitBlt(i,j,m_cxBitmap,m_cyBitmap,tempDC,0,0,SRCCOPY);

//SetthebackgroundinmemDCtoblack.UsingSRCPAINTwithblackandanyother

//colorresultsintheothercolor,thusmakingblackthetransparentcolor

memDC.SetBkColor(RGB(0,0,0));

memDC.SetTextColor(RGB(255,255,255));

memDC.BitBlt(0,0,m_ClientRect.Width(),m_ClientRect.Height(),maskDC,0,0,SRCAND);

//Settheforegroundtoblack.Seecommentabove.

imageDC.SetBkColor(RGB(255,255,255));

imageDC.SetTextColor(RGB(0,0,0));

imageDC.BitBlt(m_ClientRect.left,m_ClientRect.top,m_ClientRect.Width(),m_ClientRect.Height(),

maskDC,0,0,SRCAND);

//Combinetheforegroundwiththebackground

imageDC.BitBlt(m_ClientRect.left,m_ClientRect.top,m_ClientRect.Width(),m_ClientRect.Height(),

memDC,0,0,SRCPAINT);

//Drawthefinalimagetothescreen

pDC-BitBlt(0,0,m_ScrollRect.Width(),m_ScrollRect.Height(),

imageDC,0,0,SRCCOPY);

imageDC.SelectObject(pOldImageDCBitmap);

maskDC.SelectObject(pOldMaskDCBitmap);

tempDC.SelectObject(pOldTempDCBitmap);

memDC.SelectObject(pOldMemDCBitmap);

}

voidCCreditStatic::DrawBitmap(CDC*pDC,CDC*pDC2,CRect*rBitmap)

{

if(!m_bTransparent||m_bitmap.m_hObject!=NULL){

pDC-BitBlt(rBitmap-left,rBitmap-top,rBitmap-Width(),rBitmap-Height(),

pDC2,0,0,SRCCOPY);

return;

}

//创建与pDC兼容的设备

CDCmemDC;

memDC.CreateCompatibleDC(pDC);

//创建兼容位图并且选进设备

CBitmapbitmap;

bitmap.CreateCompatibleBitmap(pDC,rBitmap-Width(),rBitmap-Height());

CBitmap*pOldMemDCBitmap=memDC.SelectObject(bitmap);

//将pDC2中的位图拷贝到memDC

memDC.BitBlt(0,0,rBitmap-Width(),rBitmap-Height(),pDC2,0,0,SRCCOPY);

CDCmaskDC;

maskDC.CreateCompatibleDC(pDC);

//创建单色位图并且选入设备

CBitmapmaskBitmap;

maskBitmap.CreateBitmap(rBitmap-Width(),rBitmap-Height(),1,1,NULL);

CBitmap*pOldMaskDCBitmap=maskDC.SelectObject(maskBitmap);

memDC.SetBkColor(RGB(192,192,192));//背景为系统色

//将memDC中的位图拷贝到maskDC,maskDC中的的1表示位图背景色,0表示前景,即位图

maskDC.BitBlt(0,0,rBitmap-Width(),rBitmap-Height(),memDC,0,0,SRCCOPY);

CDCimageDC;

CBitmapbmpImage;

imageDC.CreateCompatibleDC(pDC);

bmpImage.CreateCompatibleBitmap(pDC,rBitmap-Width(),rBitmap-Height());

CBitmap*pOldImageDCBitmap=imageDC.SelectObject(bmpImage);

//将pDC中对应位图背景区域拷贝到imageDC

imageDC.BitBlt(0,0,rBitmap-Width(),rBitmap-Height(),pDC,rBitmap-left,rBitmap-top,SRCCOPY);

//下面的代码实现透明位图,见msdn的DrawingTransparentBitmaps

//SetthebackgroundinmemDCtoblack.UsingSRCPAINTwithblackandanyother

//colorresultsintheothercolor,thusmakingblackthetransparentcolor

//设置背景为黑色

memDC.SetBkColor(RGB(0,0,0));

memDC.SetTextColor(RGB(255,255,255));

memDC.BitBlt(0,0,rBitmap-Width(),rBitmap-Height(),maskDC,0,0,SRCAND);

//设置前景为黑色

imageDC.SetBkColor(RGB(255,255,255));

imageDC.SetTextColor(RGB(0,0,0));

imageDC.BitBlt(0,0,rBitmap-Width(),rBitmap-Height(),maskDC,0,0,SRCAND);

//得到透明的位图

imageDC.BitBlt(0,0,rBitmap-Width(),rBitmap-Height(),memDC,0,0,SRCPAINT);

//将位图移动到合适位置

pDC-BitBlt(rBitmap-left,rBitmap-top,rBitmap-Width(),rBitmap-Height(),

imageDC,0,0,SRCCOPY);

imageDC.SelectObject(pOldImageDCBitmap);

maskDC.SelectObject(pOldMaskDCBitmap);

memDC.SelectObject(pOldMemDCBitmap);

}

voidCCreditStatic::FillGradient(CDC*pDC,CRect*m_ScrollRect,CRect*m_FillRect,COLORREFcolor)

{

floatfStep,fRStep,fGStep,fBStep;//Howlargeiseachband?

intiOnBand;//Loopindex

WORDR=GetRValue(color);

WORDG=GetGValue(color);

WORDB=GetBValue(color);

//Determinehowlargeeachbandshouldbeinordertocoverthe

//clientwith256bands(oneforeverycolorintensitylevel)

if(m_Gradient%2){

fRStep=(float)R/255.0f;

fGStep=(float)G/255.0f;

fBStep=(float)B/255.0f;

}else{

fRStep=(float)(255-R)/255.0f;

fGStep=(float)(255-G)/255.0f;

fBStep=(float)(255-B)/255.0f;

}

COLORREFOldCol=pDC-GetBkColor();

//Startfillingbands

fStep=(float)m_ScrollRect-Width()/256.0f;

for(iOnBand=(256*m_FillRect-left)/m_ScrollRect-Width();

(int)(iOnBand*fStep)m_FillRect-rightiOnBand256;iOnBand++){

CRectr((int)(iOnBand*fStep),m_FillRect-top,

(int)((iOnBand+1)*fStep),m_FillRect-bottom+1);

COLORREFcol;

switch(m_Gradient){

caseGRADIENT_RIGHT_DARK:

col=RGB((int)(R-iOnBand*fRStep),(int)(G-iOnBand*fGStep),(int)(B-iOnBand*fBStep));

break;

caseGRADIENT_RIGHT_LIGHT:

col=RGB((int)(R+iOnBand*fRStep),(int)(G+iOnBand*fGStep),(int)(B+iOnBand*fBStep));

break;

caseGRADIENT_LEFT_DARK:

col=RGB((int)(iOnBand*fRStep),(int)(iOnBand*fGStep),(int)(iOnBand*fBStep));

break;

caseGRADIENT_LEFT_LIGHT:

col=RGB(255-(int)(iOnBand*fRStep),255-(int)(iOnBand*fGStep),255-(int)(iOnBand*fBStep));

break;

default:

return;

}

pDC-FillSolidRect(r,col);

}

pDC-SetBkColor(OldCol);

}

#defineSCROLLDC

voidCCreditStatic::MoveCredit(CDC*pDC,CRectm_ScrollRect,CRectm_ClientRect,BOOLbCheck)

{

CDCmemDC,memDC2;

//创建兼容的设备

memDC.CreateCompatibleDC(pDC);

memDC2.CreateCompatibleDC(pDC);

//决定背景颜色,如果初始设置为透明并且有背景位图,就选择系统色,否则选择设置的背景色

COLORREFBackColor=(m_bTransparentm_bitmap.m_hObject!=NULL)?RGB(192,192,192):m_Colors[BACKGROUND_COLOR];

CBitmap*pOldMemDCBitmap=NULL;

CBitmap*pOldMemDC2Bitmap=NULL;

#ifdefSCROLLDC

CRectr1;

#endif

//初始句柄为空

if(m_BmpMain.m_hObject==NULL){

//创建与设备兼容的位图

m_BmpMain.CreateCompatibleBitmap(pDC,m_ScrollRect.Width(),m_ScrollRect.Height());

//将位图选入设备

pOldMemDCBitmap=(CBitmap*)memDC.SelectObject(m_BmpMain);

//选择是用梯度还是背景色填充设备memDC的背景

if(m_Gradientm_bitmap.m_hObject==NULL)

FillGradient(memDC,m_ScrollRect,m_ScrollRect,m_Colors[BACKGROUND_COLOR]);

else

memDC.FillSolidRect(m_ScrollRect,BackColor);

}else

pOldMemDCBitmap=(CBitmap*)memDC.SelectObject(m_BmpMain);

if(m_ClientRect.Width()0){

#ifndefSCROLLDC//如果不支持设备滚动

CBitmapbitmap;

bitmap.CreateCompatibleBitmap(pDC,m_ClientRect.Width(),m_ClientRect.Height());

pOldMemDC2Bitmap=memDC2.SelectObject(bitmap);

//memDC向上滚动一行,利用设备拷贝

memDC2.BitBlt(0,0,m_ClientRect.Width(),m_ClientRect.Height()-abs(m_ScrollAmount),

memDC,m_ClientRect.left,abs(m_ScrollAmount),SRCCOPY);

memDC.BitBlt(m_ClientRect.left,0,m_ClientRect.Width(),m_ClientRect.Height(),

memDC2,0,0,SRCCOPY);

memDC2.SelectObject(pOldMemDC2Bitmap);

pOldMemDC2Bitmap=NULL;

#else//如果支持设备滚动

CRgnRgnUpdate;

//memDC向上滚动一行,利用设备拷贝

memDC.ScrollDC(0,m_ScrollAmount,(LPCRECT)m_ScrollRect,(LPCRECT)m_ClientRect,RgnUpdate,

(LPRECT)r1);

}

else{

//r1存储着要更新的区域位置

r1=m_ScrollRect;

r1.top=r1.bottom-abs(m_ScrollAmount);

#endif

}

m_nClip=m_nClip+abs(m_ScrollAmount);

//*********************************************************************

//FONTSELECTION

CFontm_fntArial;

CFont*pOldFont=NULL;