Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

請問一下mfc有透明色的方法嗎 用在dc上面

0 views
Skip to first unread message

unread,
Mar 17, 2002, 6:24:24 AM3/17/02
to
如提 謝謝
--
[1;31mO [1;32mr [1;33mi [1;34mg [1;35mi [1;36mn [1;31m: [1;36m<不良牛牧場> [1;33mzoo.ee.ntu.edu.tw [1;32m(140.112.18.36) [m
[1;32mWelcome to SimFarm BBS [1;36m-- [m [1;31mFrom : [ [m182.c129.ethome.net.tw [1;31m] [m

深邃之藍

unread,
Mar 17, 2002, 11:05:26 AM3/17/02
to
※ 引述《vbvc...@zoo.ee.ntu.edu.tw (超)》之銘言:
> 如提 謝謝


應該是沒有...我知道direct x有
--
[1;32m※ Origin: [33m明新技術學院 藍色國度 [37m<bbs.mhit.edu.tw> [m
[1;31m◆ From : [36m61-217-208-155.HINET-IP.hinet.net [m

好久沒這樣了~~~

unread,
Mar 18, 2002, 6:19:10 AM3/18/02
to
※ 引述《ddsc...@bbs.mhit.edu.tw (深邃之藍)》之銘言:

> ※ 引述《vbvc...@zoo.ee.ntu.edu.tw (超)》之銘言:
> > 如提 謝謝
> 應該是沒有...我知道direct x有

有阿~~~但是mfc不提供,妳要自己時做出...
圖檔講解...03.bmp:底色是黑色(colorkey)再來上面就是要顯示的東西
03mask.bmp:底色是黑色(colorkey),要顯示得範圍則給它變為白色
就這樣...試試看吧

void CForm01View::ShowImage(CString str)
{

#ifndef _DEBUG
str.Delete(str.GetLength()-1,1);

#else
str="E:\\圖檔\\小圖檔\\03.bmp";

#endif

//
// 秀圖...............................................................
//
CPoint point;
point.x=70;
point.y=330;

// str.Delete(str.GetLength()-1,1);
HDC hdcMemImag;
HDC hdcMemMask;

hBitmapImag=(HBITMAP)LoadImage(NULL,str,IMAGE_BITMAP,0,0,
LR_LOADFROMFILE|LR_CREATEDIBSECTION);
// 判斷hBmp是否有圖形.
GetObject(
hBitmapImag,sizeof(BITMAP),&bitmap);
cxBitmap=bitmap.bmWidth;
cyBitmap=bitmap.bmHeight;


// 建立MemoryDC.
hdcMemImag=CreateCompatibleDC(NULL);
SelectObject(hdcMemImag,hBitmapImag);


// create the monochrome...
#ifndef _DEBUG
str.Delete(str.GetLength()-1,1);
#else
str="E:\\圖檔\\小圖檔\\03_MASK.bmp";
#endif

hBitmapMask=(HBITMAP)LoadImage(NULL,str,IMAGE_BITMAP,0,0,
LR_LOADFROMFILE|LR_CREATEDIBSECTION);
hdcMemMask=CreateCompatibleDC(NULL);
SelectObject(hdcMemMask,hBitmapMask);

// MASK the original image.
BitBlt(hdcMemImag,0,0,cxBitmap,cyBitmap,
hdcMemMask,0,0,SRCAND);

DeleteDC(hdcMemImag);
DeleteDC(hdcMemMask);


////////////////////////////////////////////////
//

hdcMemImag=CreateCompatibleDC(NULL);
SelectObject(hdcMemImag,hBitmapImag);

hdcMemMask=CreateCompatibleDC(NULL);
SelectObject(hdcMemMask,hBitmapMask);

CClientDC adc(this);

BitBlt(adc,point.x,point.y, // 50,150,
cxBitmap,cyBitmap,
hdcMemMask,0,0,0x220326);

BitBlt(adc,point.x,point.y, // 50,150,
cxBitmap,cyBitmap,
hdcMemImag,0,0,SRCPAINT);

DeleteDC(hdcMemImag);
DeleteDC(hdcMemMask);
DeleteObject(hBitmapMask);
DeleteObject(hBitmapImag);
}

--
[1;32m※ Origin: [33m大葉大學戀戀紅城 [37m<bbs.dyu.edu.tw> [m
[1;32m※ From : [36mswtc241-170.adsl.seed.net.tw [m

0 new messages