You're "memGraphicsDC" class had a good number of method calls that needed
to be translated, using best guess, too. It wasn't as simple as just
swapping out "memGraphicsDC" with Graphics. I also got a few
exceptions,
all
resource related, when I finally got it to compile and run. Some of the
main
reasons why a complete example that just unzips and repros the issue is a
good idea. The issue turns out to be that you were referencing the Size
property from within the "getter" of the Size property definition. So
it
just keeps calling itself which eventually results in a stack overflow.
You'll need to change the code to call to the base as shown below.
// Old
public new System.Drawing.Size Size
{
get
{
return Size;
}
set
{
...
}
}
// New
public new System.Drawing.Size Size
{
get
{
return base.Size;
}
set
{
...
}
}
--
Tim Wilson
.Net Compact Framework MVP
Actually, I thought up a better way overnight. The form that
instantiates
the header (rather than another control for now) is quite small. I have
difficulty believing you need much more. This class would probably help
as
it would create the header within a header that triggered the problem.
That
was the header inside the Name column. The main header is docked and
does
not appear to have an issue with its location property.
----------
Will Pittenger
E-Mail: mailto:will.pittenger1 at gmail.com
All mail filtered by Qurb (
www.qurb.com)
"Tim Wilson" <TIM(UNDERSCORE)WILSON(AT)ROGERS(PERIOD)COM> wrote in
message
Just shoot the zip over to the following email account and I can
pick
it
up
from there. The email address is, of course, mangled.
dllhell [remove] AT hotmail [dot] com
--
Tim Wilson
.Net Compact Framework MVP
I have no way to get it onto the server. The text file unzipped
was
only
101K. That was refused until I zipped it. The solution would be much
larger even zipped. (MS must be skimping there.)
The memGraphicsDC class is nothing special. I was actually about
to
remove
it due to .NET having everything it was meant to do. Replace the
memGraphicsDC parameters with a Graphics object and replace any
references
to memDC.DrawSurface with that Graphics object. In the paint handler,
use
the paint event argument handler for the Graphics object.
----------
Will Pittenger
E-Mail: mailto:will.pittenger1 at gmail.com
All mail filtered by Qurb (
www.qurb.com)
"Tim Wilson" <TIM(UNDERSCORE)WILSON(AT)ROGERS(PERIOD)COM> wrote in
message
Can you post an entire solution containing your custom UserControl,
all
supporting custom classes, and a win forms application that
demonstrates
the
problem at runtime? Ideally if I could have something that I can
just
unzip,
load into VS, and then hit F5 and watch it blow up then at least
I
could
start helping after I see the problem. The code that you posted
doesn't
compile because it's missing a definition for "memGraphicsDC".
And
once
I
get it to compile I'll need to be able to reproduce the error. So
it's
for
these two reasons that it would be nice to have an entire
solution
(zipped
of course).
--
Tim Wilson
.Net Compact Framework MVP
The class has just over 3000 lines. (Several nested classes are
included.)
I am attaching the entire class. If I attempt to simplify the
file,
the
problem would probably disappear. It would also take me a while to
get
the
code to work again. The class is intended to be a header (like the
one
in
Explorer). Normally, the header would always be docked. One of
the
nested
classes (colDef) represents one of the columns. It serves as
the
column's
definition (hence the name) and paints the column inside the
header.
Now, I brought colDef up because I built in a way to allow the
column
to
host a header. This allows for, say a name field, to be split into
several
fields. (In that case: First Name, Middle Initial, and Last Name.)
When
the header is the top level header, it is, as mentioned, docked and
there
is
no problem. When a column hosts the header, it puts the header
into
position with the fixChildHeaderPosAndSize member.
----------
Will Pittenger
E-Mail: mailto:will.pittenger1 at gmail.com
All mail filtered by Qurb (
www.qurb.com)
"Tim Wilson" <TIM(UNDERSCORE)WILSON(AT)ROGERS(PERIOD)COM> wrote in
message
Can you post the complete source code for your custom control, as
well
as
the code that's being used to instantiate the control and add it
to
the
container, so we can take a look at it?
--
Tim Wilson
.Net Compact Framework MVP
message
I have a Control derived class. When the parent of the control
changes
the
control's Location property, the stack overflows. I have not
found
a
way
to
find out what was on the stack when it does overflow. All I
know
is
that
the program is either stopped due to an exception at the end of
Main
or
has
exited after the Stack Overflow exception. (Both cases are
Debug
builds
running in the debugger.)
After a lot of trial and error (mostly the latter with a dose of
confusion
thrown in), I finally tracked the last statement of mine
executed
to
a
line
where, as mentioned, the parent sets the child's location. The
location
property is not overridden. I have not subscribed to the
child's
LocationChanged event.
I tried full rebuilds in case the executable was corrupt. I
tried
rebooting
in case Windows was the cause. Neither helped.
Any ideas?