• <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 閱讀(3080) 評論(0)  編輯 收藏 引用 所屬分類: 圖像處理

            久久精品九九亚洲精品天堂| 久久精品国产99国产精偷| 亚洲一区中文字幕久久| 99国产精品久久| 久久久久亚洲?V成人无码| 久久综合色老色| 99久久99这里只有免费费精品 | 国内精品久久久久影院免费| 伊人久久综在合线亚洲2019| 美女久久久久久| 国产精品无码久久久久久| 久久久久无码专区亚洲av| 99久久免费国产精精品| 亚洲日韩欧美一区久久久久我 | 久久有码中文字幕| 久久久久久久亚洲Av无码| 综合久久一区二区三区| 88久久精品无码一区二区毛片 | 97久久精品人妻人人搡人人玩| 久久久久久国产精品无码下载 | 久久精品国产亚洲av瑜伽| 成人资源影音先锋久久资源网| 亚洲人成网站999久久久综合| 国产精品久久久久久影院| 久久无码AV中文出轨人妻| 99久久精品国产毛片| 国内精品久久久久影院日本| 亚洲一级Av无码毛片久久精品| 久久国产精品99久久久久久老狼| 欧美日韩久久中文字幕| 久久精品无码一区二区三区免费| 狠狠色丁香婷婷久久综合不卡| 成人午夜精品无码区久久| 久久99热这里只频精品6| 久久久久香蕉视频| 久久久久亚洲AV成人网人人软件| 99久久精品日本一区二区免费| 久久香蕉国产线看观看精品yw| 精品久久人人爽天天玩人人妻| 亚洲性久久久影院| 无码AV中文字幕久久专区|