Celebrate National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

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

Posted on 2009-07-02
11
Medium Priority
?
1,039 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 6
  • 5
11 Comments
 
LVL 24

Expert Comment

by:alexey_gusev
ID: 24766330
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
ID: 24766361
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
ID: 24766389
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
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
LVL 24

Accepted Solution

by:
alexey_gusev earned 2000 total points
ID: 24766464
0
 
LVL 8

Author Comment

by:Anthony2000
ID: 24766494
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
 
LVL 24

Expert Comment

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

Author Comment

by:Anthony2000
ID: 24766612
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
ID: 24766615
Like a progress control.
0
 
LVL 24

Expert Comment

by:alexey_gusev
ID: 24766761
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
ID: 31599316
I appreciate your help!!
0

Featured Post

Tutorial: Introduction to Managing a Linux Server

In this tutorial on systemd, we will explore:
-OS/Distro Adoption
-chkconfig and Other Legacy Commands
-Summary and Key Commands

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article helps those who get the 0xc004d307 error when trying to rearm (reset the license) Office 2013 in a Virtual Desktop Infrastructure (VDI) and/or those trying to prep the master image for Microsoft Key Management (KMS) activation. (i.e.- C…
In this modest contribution, I want to share with the IT community (especially system administrators, IT Support Engineers and IT Help Desks) about Windows crashes/hangs and how to deal with these particular problems.
In this video, we discuss why the need for additional vertical screen space has become more important in recent years, namely, due to the transition in the marketplace of 4x3 computer screens to 16x9 and 16x10 screens (so-called widescreen format). …
If you’ve ever visited a web page and noticed a cool font that you really liked the look of, but couldn’t figure out which font it was so that you could use it for your own work, then this video is for you! In this Micro Tutorial, you'll learn yo…
Suggested Courses

730 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