Solved

Transparent rectangle drawn on top of lines MFC on Windows CE 5.0

Posted on 2009-07-02
11
1,010 Views
Last Modified: 2013-12-21
I would like to draw a transparent color filled rectangle on some static lines. The width of this rectangle changes in real time. How do I accomplish this? The background color is white.

Thank you in advance.
0
Comment
Question by:Anthony2000
  • 6
  • 5
11 Comments
 
LVL 24

Expert Comment

by:alexey_gusev
Comment Utility
do you mean like DrawFocusRect() or DrawEdge() Win32 API?

otherwise there is Rectangle() function which uses current pen to draw the frame and current brush to fill it.

moreover, you can SetBkMode() to transparent
0
 
LVL 8

Author Comment

by:Anthony2000
Comment Utility
What I need is a snippet of code, can you supply one? Here is what I have tried:


	brushFill.DeleteObject();

	brushFill.CreateSolidBrush(m_colorNeedle) ;
 

	pDC->SetBkMode(TRANSPARENT);

	pBrushOld = pDC->SelectObject(&brushFill) ;
 

	// draw the rectangle

	pDC->Polygon(m_pointRectangle, 5) ;
 

	// restore the brush (but keep the pen!)

	pDC->SelectObject(pBrushOld) ;

Open in new window

0
 
LVL 8

Author Comment

by:Anthony2000
Comment Utility
Also, I am developing using Visual Studio 6.0, but it will need to work on Windows CE using eVC++ 4.0. Thanks for your help.
0
 
LVL 24

Accepted Solution

by:
alexey_gusev earned 500 total points
Comment Utility
0
 
LVL 8

Author Comment

by:Anthony2000
Comment Utility
Well, those functions will draw the rectangle, but what about filling it with a transparent color? How do I accomplish that? Thanks again for your help.
0
Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

 
LVL 24

Expert Comment

by:alexey_gusev
Comment Utility
0
 
LVL 24

Expert Comment

by:alexey_gusev
Comment Utility
that do you exactly mean by "transparent colour" ? could you please explain it in more details?
0
 
LVL 8

Author Comment

by:Anthony2000
Comment Utility
Lets say that I have a picture box with text in it. I want to fill in part of the rectangle with a color. So, that part of the text has a blue background  and the rest has a white background. I just wanted to avoid re-drawing the text. Does this help?
0
 
LVL 8

Author Comment

by:Anthony2000
Comment Utility
Like a progress control.
0
 
LVL 24

Expert Comment

by:alexey_gusev
Comment Utility
well, if you change any part of the area then it will be Invalidate()'ed, so you'll get WM_PAINT eventually. thus you'd definitely have to redraw the text somehow. what you could do is to draw the text transparently, so it doesn't matter that's the background.
0
 
LVL 8

Author Closing Comment

by:Anthony2000
Comment Utility
I appreciate your help!!
0

Featured Post

Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

Join & Write a Comment

The use of stolen credentials is a hot commodity this year allowing threat actors to move laterally within the network in order to avoid breach detection.
Today, still in the boom of Apple, PC's and products, nearly 50% of the computer users use Windows as graphical operating systems. If you are among those users who love windows, but are grappling to keep the system's hard drive optimized, then you s…
This video Micro Tutorial explains how to clone a hard drive using a commercial software product for Windows systems called Casper from Future Systems Solutions (FSS). Cloning makes an exact, complete copy of one hard disk drive (HDD) onto another d…
The viewer will learn how to successfully create a multiboot device using the SARDU utility on Windows 7. Start the SARDU utility: Change the image directory to wherever you store your ISOs, this will prevent you from having 2 copies of an ISO wit…

728 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

9 Experts available now in Live!

Get 1:1 Help Now