• <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>
            穩定盈利的期貨交易方法-量化趨勢交易

            alantop -專業量化投資者

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

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

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

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

            這里需要注意的是從文件加載位圖,并不是通過調用CBitmap的成員函數完成。
            而是使用SDK函數LoadImage,通過將其返回值賦值給CBitmap的成員變量m_hObject而完成對CBitmap的對象的賦值過程。
            此處的強制類型可以不使用,使用是強調的意思。

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

            完全從文件加載位圖,雙緩沖代碼如下,放在OnDraw(CDC* pDC)函數中即可。
                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 閱讀(3073) 評論(0)  編輯 收藏 引用 所屬分類: 圖像處理

            久久中文字幕视频、最近更新 | 亚洲国产精品热久久| 国产精品一久久香蕉国产线看观看| 久久精品a亚洲国产v高清不卡| 波多野结衣中文字幕久久| 99久久精品免费国产大片| 理论片午午伦夜理片久久| 人妻精品久久久久中文字幕一冢本| 国产成人久久久精品二区三区| 思思久久99热只有频精品66| 精品久久久噜噜噜久久久| 亚洲AV伊人久久青青草原| 国产精品免费福利久久| 久久这里只精品99re66| 免费观看久久精彩视频| 久久综合亚洲色HEZYO国产| 日韩精品久久无码中文字幕| 日日狠狠久久偷偷色综合免费| 精品熟女少妇av免费久久| 久久无码高潮喷水| 精品久久久久久国产牛牛app| 久久国产精品成人片免费| 思思久久好好热精品国产| 精品免费久久久久国产一区| 精品无码久久久久久午夜| 久久亚洲AV无码精品色午夜| 久久精品亚洲欧美日韩久久| 99久久er这里只有精品18| 一本色道久久88—综合亚洲精品| 久久精品亚洲男人的天堂| 久久精品中文字幕有码| 久久不射电影网| 久久96国产精品久久久| 精品熟女少妇a∨免费久久| 狠狠88综合久久久久综合网 | 伊人丁香狠狠色综合久久| 久久久久99精品成人片直播| 亚洲国产另类久久久精品黑人 | 国产成人精品久久二区二区| 伊人伊成久久人综合网777| 久久露脸国产精品|