Transparent user control not redrawing properly

  • Thread starter Thread starter Adam Clauss
  • Start date Start date
A

Adam Clauss

I have a completely user-drawn user control in which I enabled transparency
(follownig suggestions at
http://www.c-sharpcorner.com/Upload...rols11152005074108AM/TransparentControls.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, 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
 
Michael Rubinstein said:
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, 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
 
Michael Rubinstein said:
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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top