471,610 Members | 1,373 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,610 software developers and data experts.

Transparent user control not redrawing properly

I have a completely user-drawn user control in which I enabled transparency
(follownig suggestions at
http://www.c-sharpcorner.com/UploadF...tControls.aspx)

The user control does not contain any other controls; I manually draw
contents in the OnPaint override I created.

My problem is that the control does not always draw itself properly.
Sometimes NONE of the control appears (on top of the 'background' controls).
Other times, only part of the control appears. Dragging the control so it
is offscreen and back on, or minimizing and restoring sometimes forces it to
redraw, sometimes not. The whole thing just seems very inconsistent.

Possibly, part of the problem is I am drawing it on top of a MapPoint map
(using the MapPoint ActiveX control). I have put manual calls to
SendToFront() on my user control everytime the 'view' of the MapPoint
control (and SendToBack() on the MapPoint control).

I'm not convinced that this is a 'layer' problem though, as that would not
cause PART of my control to draw itself, and part to not draw. If I remove
the transparency, everything seems to work fine, my user control is always
visible.

Any suggestions?

--
Adam Clauss

Feb 19 '07 #1
4 2782
Adam, can you draw the map in memory? I don't know if the current
MapPoint Control version supports drawing in memory. I did not work with
MapPoint since the 2002 release. The mapping ActiveX I am using supports
drawing to memory DC. Instead of interfering with Paint() events on the
surface of the form I intercept those requiring the map to be redrawn, make
the ActiveX draw the map in memory, draw whatever else I need to be drawn
'transparently' in memory as well, then paint the composite image onto the
form.

Michael

"Adam Clauss" <ca*****@tamu.eduwrote in message
news:12*************@corp.supernews.com...
>I have a completely user-drawn user control in which I enabled transparency
(follownig suggestions at
http://www.c-sharpcorner.com/UploadF...tControls.aspx)

The user control does not contain any other controls; I manually draw
contents in the OnPaint override I created.

My problem is that the control does not always draw itself properly.
Sometimes NONE of the control appears (on top of the 'background'
controls). Other times, only part of the control appears. Dragging the
control so it is offscreen and back on, or minimizing and restoring
sometimes forces it to redraw, sometimes not. The whole thing just seems
very inconsistent.

Possibly, part of the problem is I am drawing it on top of a MapPoint map
(using the MapPoint ActiveX control). I have put manual calls to
SendToFront() on my user control everytime the 'view' of the MapPoint
control (and SendToBack() on the MapPoint control).

I'm not convinced that this is a 'layer' problem though, as that would not
cause PART of my control to draw itself, and part to not draw. If I
remove the transparency, everything seems to work fine, my user control is
always visible.

Any suggestions?

--
Adam Clauss

Feb 19 '07 #2
"Michael Rubinstein" <mSPAM_REMOVEr@mŽubinstein.comwrote in message
news:53*************@mid.individual.net...
Adam, can you draw the map in memory? I don't know if the current
MapPoint Control version supports drawing in memory. I did not work with
MapPoint since the 2002 release. The mapping ActiveX I am using supports
drawing to memory DC. Instead of interfering with Paint() events on the
surface of the form I intercept those requiring the map to be redrawn,
make the ActiveX draw the map in memory, draw whatever else I need to be
drawn 'transparently' in memory as well, then paint the composite image
onto the form.

Michael
That is certainly something I will look into. How is it you are going about
getting the control to draw to a memory surface rather than the active
display? I do not see anything particularly obvious like that on the
MapPoint control (we are using the 2006 version).

On a side note... what kind of mapping technology is it you are using (if
you can discuss)?

--
Adam Clauss
Feb 19 '07 #3
Adam, I am using MapPro71 ActiveX by UnderTow Software
www.undertowsoftware.com . UnderTow Software currently offers only US and
Canada maps. This is a major limitation. The ability of MapPro71 to render
to a memory DC is the main reason I am using it. MapPro offers two methods
for drawing directly to any DC, including Printer DC and memory DC. Drawing
directly to the active display is fine until you need adding your own images
on top of what the ActiveX already painted. This what you fighting with,
right? I used MapPoint in the past and was quite frustrated with the limited
number and size of it's built-in pushpins and even more the way pushpins are
labeled. In my applications I let the ActiveX draw map only. I draw my own
custom images and labels on top of the map and have full control of their
looks.

Michael

"Adam Clauss" <ca*****@tamu.eduwrote in message
news:12*************@corp.supernews.com...
"Michael Rubinstein" <mSPAM_REMOVEr@mŽubinstein.comwrote in message
news:53*************@mid.individual.net...
> Adam, can you draw the map in memory? I don't know if the current
MapPoint Control version supports drawing in memory. I did not work with
MapPoint since the 2002 release. The mapping ActiveX I am using supports
drawing to memory DC. Instead of interfering with Paint() events on the
surface of the form I intercept those requiring the map to be redrawn,
make the ActiveX draw the map in memory, draw whatever else I need to be
drawn 'transparently' in memory as well, then paint the composite image
onto the form.

Michael

That is certainly something I will look into. How is it you are going
about getting the control to draw to a memory surface rather than the
active display? I do not see anything particularly obvious like that on
the MapPoint control (we are using the 2006 version).

On a side note... what kind of mapping technology is it you are using (if
you can discuss)?

--
Adam Clauss


Feb 19 '07 #4
"Michael Rubinstein" <mSPAM_REMOVEr@mŽubinstein.comwrote in message
news:53*************@mid.individual.net...
Adam, I am using MapPro71 ActiveX by UnderTow Software
www.undertowsoftware.com . UnderTow Software currently offers only US and
Canada maps. This is a major limitation. The ability of MapPro71 to render
to a memory DC is the main reason I am using it. MapPro offers two methods
for drawing directly to any DC, including Printer DC and memory DC.
Drawing directly to the active display is fine until you need adding your
own images on top of what the ActiveX already painted. This what you
fighting with, right? I used MapPoint in the past and was quite frustrated
with the limited number and size of it's built-in pushpins and even more
the way pushpins are labeled. In my applications I let the ActiveX draw
map only. I draw my own custom images and labels on top of the map and
have full control of their looks.

Michael
That sounds like it may do EXACTLY what we need. We are not set on using
MapPoint, we were just exlporing it as an option. We're basically in a
'proof-of-concept' mode right now.

Thank you for the suggestions, I'll investigate it further.

--
Adam Clauss
Feb 19 '07 #5

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

1 post views Thread by Efkas | last post: by
3 posts views Thread by Steve Koon | last post: by
8 posts views Thread by Grahammer | last post: by
4 posts views Thread by jcrouse | last post: by
1 post views Thread by FredC | last post: by
1 post views Thread by XIAOLAOHU | last post: by
reply views Thread by CCCYYYY | last post: by
1 post views Thread by ZEDKYRIE | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.