ThinkChat2.0新版上线,更智能更精彩,支持会话、画图、阅读、搜索等,送10W Token,即刻开启你的AI之旅 广告
```c++ void CCBitmapDlg::OnPaint() { CPaintDC dc(this); // 用于绘制的设备上下文 CBitmap bmp; bmp.LoadBitmap(IDB_WOLF);//位图平铺 加载 bmp格式的图片 BITMAP bm;//定义一个空的位图信息结构体 bmp.GetBitmap(&bm);//获取位图信息 把值赋值到bm CDC mdc;//CMenDc CClientDC CPaintDC CWindowDC mdc.CreateCompatibleDC(&dc);//代入一个DC模板 mdc.SelectObject(&bmp);//选择位图 dc.SetStretchBltMode(HALFTONE); dc.StretchBlt(10,10,bm.bmHeight * 20, bm.bmHeight * 2, &mdc, 0,0,bm.bmWidth,bm.bmHeight,SRCCOPY);//拉伸/压缩 dc.BitBlt(20,20,280,210,&mdc, 0,0,SRCCOPY);//mdc来源DC 位图输出函数 dc.BitBlt(bm.bmWidth + 30,bm.bmHeight + 30, bm.bmWidth*2/3,bm.bmHeight*2/3,&mdc, bm.bmWidth/3,bm.bmHeight/3,SRCCOPY); // dc.StretchBlt(10,bm.bmHeight/2 + 30, bm.bmWidth / 2, bm.bmHeight / 2, &mdc, 0,0,bm.bmWidth,bm.bmHeight,SRCCOPY);//拉伸/压缩 dc.StretchBlt(bm.bmWidth + 30,bm.bmHeight + 10, bm.bmWidth / 2, bm.bmHeight / 2, &mdc, bm.bmWidth,0,-bm.bmWidth,bm.bmHeight,SRCCOPY);//翻转 dc.StretchBlt(bm.bmWidth + 30,bm.bmHeight + 10, bm.bmWidth / 2, bm.bmHeight / 2, &mdc, bm.bmWidth,0,-bm.bmWidth,bm.bmHeight,SRCCOPY);//翻转 HBITMAP hBitmap = bmp; CBitmap* pBitmap = CBitmap::FromHandle(hBitmap); } ```