• <ins id="pjuwb"></ins>
    <blockquote id="pjuwb"><pre id="pjuwb"></pre></blockquote>
    <noscript id="pjuwb"></noscript>
          <sup id="pjuwb"><pre id="pjuwb"></pre></sup>
            <dd id="pjuwb"></dd>
            <abbr id="pjuwb"></abbr>
            穩(wěn)定盈利的期貨交易方法-量化趨勢(shì)交易

            alantop -專業(yè)量化投資者

            愛好:量化投資,逆向工程,滲透
            隨筆 - 595, 文章 - 0, 評(píng)論 - 921, 引用 - 0
            數(shù)據(jù)加載中……

            從文件中加載位圖,雙緩沖顯示

            上一篇講了如何從資源中加載位圖,這里講如何從文件中加載。
            資源加載位圖 http://m.shnenglu.com/alantop/archive/2008/03/13/44395.html

            整個(gè)程序的流程是一樣的,不明白的,可以看上一篇。
            這里主要的 不同是怎樣產(chǎn)生CBitmap對(duì)象。
            從資源中加載是:
                CBitmap bmp;
                bmp
            .LoadBitmap(IDB_BITMAP1)
            從文件中加載是:
                CBitmap bitmap;
                bitmap
            .m_hObject=(HBITMAP)::LoadImage(NULL,"test.bmp",IMAGE_BITMAP,500,400,LR_LOADFROMFILE);

            這里需要注意的是從文件加載位圖,并不是通過(guò)調(diào)用CBitmap的成員函數(shù)完成。
            而是使用SDK函數(shù)LoadImage,通過(guò)將其返回值賦值給CBitmap的成員變量m_hObject而完成對(duì)CBitmap的對(duì)象的賦值過(guò)程。
            此處的強(qiáng)制類型可以不使用,使用是強(qiáng)調(diào)的意思。

            注意: When you no longer need the memory DC, call the DeleteDC function.

            完全從文件加載位圖,雙緩沖代碼如下,放在OnDraw(CDC* pDC)函數(shù)中即可。
                CBitmap bitmap;
                bitmap
            .m_hObject=(HBITMAP)::LoadImage(NULL,"test.bmp",IMAGE_BITMAP,500,400,LR_LOADFROMFILE);
                
            if (bitmap.m_hObject)
                {
                    
            // Get the size of the bitmap
                    BITMAP bmpInfo;
                    bitmap
            .GetBitmap(&bmpInfo);
                    
                    
            // Create an in-memory DC compatible with the
                    // display DC we're using to paint

                    CDC dcMemory;
                    dcMemory
            .CreateCompatibleDC(pDC);
                    
                    
            // Select the bitmap into the in-memory DC
                    CBitmap* pOldBitmap = dcMemory.SelectObject(&bitmap);
                    
                    
            // Find a centerpoint for the bitmap in the client area
                    CRect rect;
                    GetClientRect(
            &rect);
                    int nX 
            = rect.left + (rect.Width() - bmpInfo.bmWidth) / 2;
                    int nY 
            = rect.top + (rect.Height() - bmpInfo.bmHeight) / 2;
                    
                    POINT ptstart
            , ptend;
                    ptstart
            .= ptstart.= 0;
                    ptend
            .= ptend.= 500;
                    
                    
                    dcMemory
            .MoveTo(ptstart);
                    dcMemory
            .LineTo(ptend);
                        
                    
            // Copy the bits from the in-memory DC into the on-
                    // screen DC to actually do the painting. Use the centerpoint
                    // we computed for the target offset.

                    pDC->BitBlt(0, 0, bmpInfo.bmWidth * 2, bmpInfo.bmHeight * 2, &dcMemory, 
                        
            0, 0, SRCCOPY);
                    
                    dcMemory
            .SelectObject(pOldBitmap);
                    
                    SIZE si;
                    si
            .cx = bmpInfo.bmWidth;
                    si
            .cy = bmpInfo.bmHeight;
                    SetScrollSizes(MM_TEXT
            , si);
                }
                
            else
                    TRACE0(
            "ERROR: Where's IDB_BITMAP1?\n");

            posted on 2008-03-14 07:29 AlanTop 閱讀(3088) 評(píng)論(0)  編輯 收藏 引用 所屬分類: 圖像處理

            婷婷久久综合九色综合绿巨人| 亚洲中文字幕久久精品无码APP| 亚洲国产成人久久综合碰碰动漫3d| 99久久国产主播综合精品| 久久综合伊人77777麻豆| 日韩人妻无码一区二区三区久久 | 国产日产久久高清欧美一区| 999久久久国产精品| 亚洲国产精品无码成人片久久| 9191精品国产免费久久| 久久久久高潮毛片免费全部播放| 狠狠人妻久久久久久综合| 伊人久久大香线蕉亚洲| 久久久久香蕉视频| 99久久国产综合精品五月天喷水| 久久妇女高潮几次MBA| 欧美精品丝袜久久久中文字幕 | 久久久久国产| 丁香五月网久久综合| 奇米综合四色77777久久| 午夜精品久久久内射近拍高清| 国产精品美女久久久网AV| 精品久久香蕉国产线看观看亚洲 | 久久精品亚洲欧美日韩久久| 77777亚洲午夜久久多喷| 久久久久国产精品人妻 | 国产成人精品久久二区二区| 国色天香久久久久久久小说| 久久精品二区| 色综合合久久天天给综看| 人妻丰满?V无码久久不卡| 久久久久久青草大香综合精品| 精品国产综合区久久久久久| 国产成人香蕉久久久久| 97精品国产97久久久久久免费| 久久精品国产福利国产秒| 欧美777精品久久久久网| 欧美综合天天夜夜久久| www亚洲欲色成人久久精品| 久久精品?ⅴ无码中文字幕| 久久婷婷午色综合夜啪|