友情提示:如果本网页打开太慢或显示不完整,请尝试鼠标右键“刷新”本网页!阅读过程发现任何错误请告诉我们,谢谢!! 报告错误
狗狗书籍 返回本书目录 我的书架 我的书签 TXT全本下载 进入书吧 加入书签

VC语言6.0程序设计从入门到精通-第63章

按键盘上方向键 ← 或 → 可快速上下翻页,按键盘上的 Enter 键可回到本书目录页,按键盘上方向键 ↑ 可回到本页顶部!
————未阅读完?加入书签已便下次继续阅读!






                                                                                                                               ·155 ·  


…………………………………………………………Page 165……………………………………………………………

Visual C++ 6。0 程序设计从入门到精通  



                      int cyIcon = GetSystemMetrics(SM_CYICON);  



                      CRect rect;  



                      GetClientRect(&rect);  



                      int x = (rect。Width() cxIcon + 1) / 2;  



                      int y = (rect。Height() cyIcon + 1) / 2;  



         



                      // Draw the icon  



                      dc。DrawIcon(x; y; m_hIcon);  



              }  



              else  



              {        



                      CPaintDC dc(this); // device context for painting  



                      dc。SetTextColor(RGB (180;240;210));      



                      dc。SetBkMode(TRANSPARENT); //设置背景为透明!  



                      CRect rect;  



                      rect。left=150;  



                      rect。right=350;  



                      rect。top=10;  



                      rect。bottom=40;  



                      dc。Rectangle(&rect);  



                      dc。FillRect(▭&m_brush1);  



                      rect。left=10;  



                      rect。right=135;  



                      rect。top=40;  



                      rect。bottom=200;  



                      dc。Rectangle(&rect);  



                      dc。FillRect(▭&m_brush1);  



                      dc。TextOut(WidthX;15;m_str);  



                       dc。TextOut(15;Heighty;m_str);  



              //      CDialog::OnPaint();  



              }  



       }  



       // The system calls this to obtain the cursor to display while the user drags  



       //    the minimized window。  



       HCURSOR CGundongDlg::OnQueryDragIcon()  



        {  



              return (HCURSOR) m_hIcon;  



       }  



       void CGundongDlg::OnTimer(UINT nIDEvent)    



        {  



 ·156 ·  


…………………………………………………………Page 166……………………………………………………………

                                                                                                  第 6 章    文本和字体类  



       // TODO: Add your message handler code here and/or call default  



        DrawV();  



        DrawH();  



       CDialog::OnTimer(nIDEvent);  



}  



void CGundongDlg::DrawV()    //竖直方向滚动函数  



{  



        CRect rect;                          //每次重画区域大小  



       rect。left=10;  



       rect。right=m_str。GetLength()+rect。left+120;  



       CFont * font=GetFont();  



       LOGFONT logFont;  



       font…》GetLogFont(&logFont);  



       rect。top=Heighty;  



       rect。bottom=rect。top+logFont。lfHeight+40;  



       InvalidateRect(&rect);  



       Heighty+=logFont。lfHeight+18;              //每步向下移动距离  



       if(Heighty》=maxHeight) Heighty=15;    // 回到起始位置  



       UpdateWindow();  



}  



void CGundongDlg::DrawH()      //水平向滚动函数  



{      



        CRect rect;                            //每次重画区域大小  



       rect。top=15;  



        CFont * font=GetFont();  



       LOGFONT logFont;  



       font…》GetLogFont(&logFont);  



       rect。bottom=rect。top+logFont。lfHeight+80;  



       rect。left=WidthX…m_str。GetLength()…10;  



       rect。right=rect。left+m_str。GetLength()+150;  



       InvalidateRect(&rect);  



       if(WidthX
返回目录 上一页 下一页 回到顶部 0 0
未阅读完?加入书签已便下次继续阅读!
温馨提示: 温看小说的同时发表评论,说出自己的看法和其它小伙伴们分享也不错哦!发表书评还可以获得积分和经验奖励,认真写原创书评 被采纳为精评可以获得大量金币、积分和经验奖励哦!