Dissappearing Controls !
From: Ian Wolstenholme (IanWolstenholme245_at_yahoo.com)
Date: 01/12/05
- Next message: K.K.: "C# Generics: breaking encapsulation?"
- Previous message: Rockard: "Problems with ActiveX controls in Windows ME"
- Messages sorted by: [ date ] [ thread ]
Date: Wed, 12 Jan 2005 14:23:30 -0000
I have a display made up of a user control hierarchy. I have built this up
over time and done the most of the debugging so I am happy with it's
operation.
When we started doing the testing, we came upon an out of memory error after
adding around 270 of the display bars to the control. I did some digging and
worked out that it was because of the number of active windows within the
display that was causing the problem.
I then started reading up on user controls and found the topics concerning
developing 'Windowless' controls. I spent some time converting my controls
into windowless controls and although I can now add more than 270 bars, they
are not drawing the display correctly.
I then went away from the parent application and back to a testbed
environment using a single form to host the lower levels of the user control
hierarchy.
I have a windowless user control (which represents the outline of a project
on a Gantt type display), which is made up of several constituent Microsoft
controls, all of which are windowless. There are some labels, some shapes
and a couple of image controls. When I place this on a blank form, the
functionality of this seems to be fine. I should also mention that the user
control has a transparent background.
I then go up to the next level, which is to place this first user control,
my project bar, onto a container so that it can be moved left and right and
have a background. It is at this point that things seem to go wrong (the
container is also windowless).
When I go through the control lifetime, (going from design time to run
time), I go through the Initialise event, where I setup my default
properties, then I go into the ReadProperties event where I draw the display
(This display was being prevented from being drawn/updated in the initialise
event because the other client controls haven't been sited on the container
at this point). Everything works fine at this point.
In the read properties event, I try to change one of the member properties.
The display is then re-drawn. This updates the constituent controls ok, all
the correct images are visible and the control sizes are fine. Then I go to
change the width of the user control. I try the line:
UserControl.Width=<a long number>
At this point, BEFORE the UserControl_Resize event is fired, the display of
the control goes blank. It reverts to the grey background of the form which
is the container.
By all accounts the display should be there. All constituent controls are
visible, all their top, height, left and width properties indicate that they
should be visible in the window and there are no other controls that they
could hide behind. It's as if the control has cleared itself ready to be
redrawn.
I have tried to use the Refresh method of the user control, I have also
tried to use the Refresh method of all constituent controls in the user
control's controls collection. None of these actually cause the display to
be re-drawn.
Can you advise of any way around this problem?
Thanks
Ian
- Next message: K.K.: "C# Generics: breaking encapsulation?"
- Previous message: Rockard: "Problems with ActiveX controls in Windows ME"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|