Click here to Skip to main content
15,915,319 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
QuestionDraw a transparent rectangle Pin
$uresh $hanmugam12-Oct-07 18:52
$uresh $hanmugam12-Oct-07 18:52 
AnswerRe: Draw a transparent rectangle Pin
led mike12-Oct-07 19:11
led mike12-Oct-07 19:11 
GeneralRe: Draw a transparent rectangle Pin
Mark Salsbery13-Oct-07 7:22
Mark Salsbery13-Oct-07 7:22 
AnswerRe: Draw a transparent rectangle Pin
chandu00412-Oct-07 19:58
chandu00412-Oct-07 19:58 
GeneralRe: Draw a transparent rectangle Pin
$uresh $hanmugam12-Oct-07 22:29
$uresh $hanmugam12-Oct-07 22:29 
GeneralRe: Draw a transparent rectangle Pin
chandu00413-Oct-07 0:04
chandu00413-Oct-07 0:04 
GeneralRe: Draw a transparent rectangle Pin
Mark Salsbery13-Oct-07 7:19
Mark Salsbery13-Oct-07 7:19 
GeneralRe: Draw a transparent rectangle Pin
Mark Salsbery13-Oct-07 7:33
Mark Salsbery13-Oct-07 7:33 
Rectangle draws a rectangle filled with the current selected brush.

Try selecting a null/hollow brush into the memDC instead of setting the background
mode to transparent

CBrush HollowBrush;
HollowBrush.CreateStockObject(HOLLOW_BRUSH);
CBrush *pOldBrush = m_memDC.SelectObject(&HollowBrush);
...
<draw your rectangle>
...
m_memDC.SelectObject(pOldBrush);

It's also a good idea to get into the habit of saving objects
previously selected into DCs so you can select them back in
when you're done with the DC.  This will prevent resource leak problems.

Also....what happens if the bitmap isn't compatible with the memDC??

Mark



Mark Salsbery
Microsoft MVP - Visual C++

Java | [Coffee]

AnswerRe: Draw a transparent rectangle Pin
Hamid_RT12-Oct-07 20:50
Hamid_RT12-Oct-07 20:50 
QuestionAcesssing printer Pin
Deepu Antony12-Oct-07 18:46
Deepu Antony12-Oct-07 18:46 
AnswerRe: Acesssing printer Pin
led mike12-Oct-07 19:05
led mike12-Oct-07 19:05 
AnswerRe: Acesssing printer Pin
Hamid_RT12-Oct-07 20:53
Hamid_RT12-Oct-07 20:53 
QuestionLibrary including problem Pin
ashishbhatt12-Oct-07 17:42
ashishbhatt12-Oct-07 17:42 
AnswerRe: Library including problem Pin
zakkas248312-Oct-07 18:24
zakkas248312-Oct-07 18:24 
GeneralRe: Library including problem Pin
ashishbhatt12-Oct-07 18:42
ashishbhatt12-Oct-07 18:42 
GeneralRe: Library including problem Pin
zakkas248312-Oct-07 18:58
zakkas248312-Oct-07 18:58 
Questionabout data packet Pin
Michel_Huang12-Oct-07 15:40
Michel_Huang12-Oct-07 15:40 
AnswerRe: about data packet Pin
chandu00412-Oct-07 17:39
chandu00412-Oct-07 17:39 
AnswerRe: about data packet Pin
led mike12-Oct-07 18:51
led mike12-Oct-07 18:51 
GeneralRe: about data packet Pin
Michel_Huang14-Oct-07 16:53
Michel_Huang14-Oct-07 16:53 
AnswerRe: about data packet Pin
Mike Dimmick14-Oct-07 11:00
Mike Dimmick14-Oct-07 11:00 
GeneralRe: about data packet Pin
Michel_Huang14-Oct-07 16:53
Michel_Huang14-Oct-07 16:53 
QuestionBitdepth of avi file Pin
nripun12-Oct-07 12:35
nripun12-Oct-07 12:35 
AnswerRe: Bitdepth of avi file Pin
Mark Salsbery12-Oct-07 14:47
Mark Salsbery12-Oct-07 14:47 
QuestionFund Raising Thermometer Pin
Naturalwoman12-Oct-07 12:25
Naturalwoman12-Oct-07 12:25 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.