惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

V
Visual Studio Blog
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
N
Netflix TechBlog - Medium
博客园 - 叶小钗
大猫的无限游戏
大猫的无限游戏
S
SegmentFault 最新的问题
V
V2EX
IT之家
IT之家
J
Java Code Geeks
Hacker News - Newest:
Hacker News - Newest: "LLM"
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
GbyAI
GbyAI
D
Docker
S
Secure Thoughts
Recent Announcements
Recent Announcements
Webroot Blog
Webroot Blog
Application and Cybersecurity Blog
Application and Cybersecurity Blog
云风的 BLOG
云风的 BLOG
博客园_首页
cs.CV updates on arXiv.org
cs.CV updates on arXiv.org
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
Security Archives - TechRepublic
Security Archives - TechRepublic
酷 壳 – CoolShell
酷 壳 – CoolShell
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
N
News | PayPal Newsroom
S
Security @ Cisco Blogs
I
InfoQ
Last Week in AI
Last Week in AI
SecWiki News
SecWiki News
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
W
WeLiveSecurity
T
Troy Hunt's Blog
Recent Commits to openclaw:main
Recent Commits to openclaw:main
H
Hackread – Cybersecurity News, Data Breaches, AI and More
Attack and Defense Labs
Attack and Defense Labs
美团技术团队
T
The Blog of Author Tim Ferriss
Google DeepMind News
Google DeepMind News
Martin Fowler
Martin Fowler
B
Blog
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
Scott Helme
Scott Helme
T
Tor Project blog
Know Your Adversary
Know Your Adversary
有赞技术团队
有赞技术团队
Hugging Face - Blog
Hugging Face - Blog
Recorded Future
Recorded Future
C
Cyber Attacks, Cyber Crime and Cyber Security
AI
AI
G
Google Developers Blog

博客园 - abraham

I want learn the programming web by C#.Who can give a simple step by step tutorial,please? Today begin new life of blog. I want learn the programming web by C#.Who can give a simple step by step tutorial,please? Today begin new life of blog. create dll formt lib with cpp funcs or c just funcs by hand. pub class into dll in dos by hand step by step. put class into dll by using vc6.0 How To Read a Big Txt File into CEdit and write it as save!. Create a Dlg's Thread and use it,this can use dlg handle. Create a Thread and Use it. Here is a reason why can not log a SQL CString How to Kill Blanks in a CString,but how to kill Chinese Blanks i can not solve. How to get a Chinese character's PinYin automaticly? PE format is very important,so learn it. create a dll by hand. static/register/atuo/extern/volatile/const STL is very important,so we learn. Create COM step by step 2. Create com step by step.1
print a bmp 2
abraham · 2004-03-31 · via 博客园 - abraham

/*

HDC hDC,                  打印机dc

HBITMAP hBmp,         待打印位图

int iX,                          位图的左上角点x坐标

int iY,                           位图的左上角点y坐标

double dScaleX,         打印机分辨率和屏幕分辨率x方向的比值,在没有指定位图显示高度和宽度的时候用的上

double dScaleY,         打印机分辨率和屏幕分辨率y方向的比值,在没有指定位图显示高度和宽度的时候用的上

int iWidth=0,         位图的显示宽度

int iLength=0         位图的显示高度

*/

void Draw(HDC hDC,HBITMAP hBmp,int iX,int iY,double dScaleX=1.0,double dScaleY=1.0,int iWidth=0,int iLength=0)

{

         HPALETTE hPal;

         BITMAP                     bm;

         BITMAPINFOHEADER         bi;

         LPBITMAPINFOHEADER          lpbi;

         DWORD                      dwLen;

         HANDLE                     hDIB;

         HANDLE                     handle;

         HDC                            hDC1;

         if(GetDeviceCaps(hDC,RASTERCAPS) & RC_PALETTE )

         {

                   UINT nSize = sizeof(LOGPALETTE) + (sizeof(PALETTEENTRY) * 256);

                  LOGPALETTE *pLP = (LOGPALETTE *) new BYTE[nSize];

                  pLP->palVersion = 0x300;

                  pLP->palNumEntries =GetSystemPaletteEntries( hDC, 0, 255, pLP->palPalEntry );

                  hPal=CreatePalette(pLP );

                   delete[] pLP;

         }

         if (hPal==NULL)         hPal = (HPALETTE) GetStockObject(DEFAULT_PALETTE);

         ::GetObject(hBmp,sizeof(bm),(LPSTR)&bm);

         bi.biSize             = sizeof(BITMAPINFOHEADER);

         bi.biWidth                   = bm.bmWidth;

         bi.biHeight                    = bm.bmHeight;

         bi.biPlanes                    = 1;

         bi.biBitCount                 = bm.bmPlanes * bm.bmBitsPixel;

         bi.biCompression         = BI_RGB;

         bi.biSizeImage              = 0;

         bi.biXPelsPerMeter       = 0;

         bi.biYPelsPerMeter       = 0;

         bi.biClrUsed                   = 0;

         bi.biClrImportant = 0;

         int nColors = (1 << bi.biBitCount);

         if( nColors > 256 )

                  nColors = 0;

         dwLen  = bi.biSize + nColors * sizeof(RGBQUAD);

         hDC1 = ::GetDC(NULL);

         hPal = SelectPalette(hDC1,hPal,FALSE);

         RealizePalette(hDC1);

         hDIB = GlobalAlloc(GMEM_FIXED,dwLen);

         if (!hDIB)

         {

                  SelectPalette(hDC1,hPal,FALSE);

                  ::ReleaseDC(NULL,hDC1);

                  DeleteObject(hPal);

                   return ;

         }

         lpbi = (LPBITMAPINFOHEADER)hDIB;

         *lpbi = bi;

         ::GetDIBits(hDC1, hBmp, 0L, (DWORD)bi.biHeight,

                  (LPBYTE)NULL, (LPBITMAPINFO)lpbi, (DWORD)DIB_RGB_COLORS);

         bi = *lpbi;

         if (bi.biSizeImage == 0)

                  bi.biSizeImage = ((((bi.biWidth * bi.biBitCount) + 31) & ~31) / 8)* bi.biHeight;

         dwLen += bi.biSizeImage;

         if (handle = GlobalReAlloc(hDIB, dwLen, GMEM_MOVEABLE))

                   hDIB = handle;

         else

         {

                  GlobalFree(hDIB);

                  SelectPalette(hDC1,hPal,FALSE);

                  ::ReleaseDC(NULL,hDC1);

                  DeleteObject(hPal);

                   return ;

         }

         lpbi = (LPBITMAPINFOHEADER)hDIB;

         BOOL bGotBits = GetDIBits( hDC1, hBmp,0L,(DWORD)bi.biHeight,(LPBYTE)lpbi+ (bi.biSize + nColors * sizeof(RGBQUAD)),

                  (LPBITMAPINFO)lpbi,(DWORD)DIB_RGB_COLORS);

         if( !bGotBits )

         {

                  GlobalFree(hDIB);

                  SelectPalette(hDC1,hPal,FALSE);

                  ::ReleaseDC(NULL,hDC1);

                  DeleteObject(hPal);

                   return;

         }

         if(iWidth==0||iLength==0)

         {

                  iWidth=lpbi->biWidth;

                  iLength=lpbi->biHeight;

                  iWidth=(int)(dScaleX*iWidth);

                  iLength=(int)(iLength*dScaleY);

         }

         StretchDIBits(hDC,iX,iY,iWidth,iLength,0,0,lpbi->biWidth,lpbi->biHeight,(LPBYTE)lpbi                     // address for bitmap bits

                   + (bi.biSize + nColors * sizeof(RGBQUAD)),(LPBITMAPINFO)lpbi,DIB_RGB_COLORS,SRCCOPY);

         SelectPalette(hDC1,hPal,FALSE);

         ::ReleaseDC(NULL,hDC1);

         DeleteObject(hDIB);

         DeleteObject(hPal);

}

// 附:得到一个DC位图的代码

HBITMAP GetSrcBit(HDC hDC,DWORD BitWidth, DWORD BitHeight)

{

         HDC hBufDC;

         HBITMAP hBitmap, hBitTemp;

         hBufDC = CreateCompatibleDC(hDC);

         hBitmap = CreateCompatibleBitmap(hDC, BitWidth, BitHeight);

         hBitTemp = (HBITMAP) SelectObject(hBufDC, hBitmap);

         StretchBlt(hBufDC, 0, 0, BitWidth, BitHeight,

                   hDC, 0, 0, BitWidth, BitHeight, SRCCOPY);

         hBitmap = (HBITMAP) SelectObject(hBufDC, hBitTemp);

         ::DeleteDC(hBufDC);

         return hBitmap;

}