Re: Odd behavior with WindowState
- From: AMercer <AMercer@xxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Wed, 12 Dec 2007 09:46:00 -0800
... I would suggest it's better to solve the
problem than apply a workaround to every form whether it needs it or not.
I disagree, see below for why.
Can you post some code that demonstrates this problem?
Ok, here's one. Make a form with no controls. In its load event, put
ControlBox = True ' forces a draw normal state
Threading.Thread.Sleep(1000) ' so you see it if your machine is very fast
WindowState = FormWindowState.Maximized ' later, a maximized draw
For what follows, I assume that you are able to reproduce the double draw
effect.
My earlier post stated that setting Visible to true will force a draw in the
load event. The above ControlBox assignment is a second case. I assert
that there are more double draw cases, and I don't know what they are, so
don't ask me to dig out any more. Knowing two leaves me uncertain about the
whole picture, and if I come up with a third, I will still be uncertain. The
burden is not on me to do this research, testing, and documentation, it is on
Microsoft. Nowhere in the documentation about Visible and ControlBox is the
idea of an immediate draw discussed. Also, please don't tell me that I
should set ControlBox in the designer. It will probably fix this problem,
but the documentation gives no reason to prefer the designer over code. I
see no merit in replacing my workaround (with no basis in the documentation)
with a 'do it in the designer' workaround (also with no basis in the
documentation).
As far as the load event goes, the double draw phenomenon is what the
workaround addresses. So, once more and with gusto, I stand by visible false
at the top and true at the bottom. It takes care of all of the double draw
behaviors, including those that I know about and those that I don't know
about. The workaround has never failed me, although it sounds like it is not
helping the OP solve his problem. FYI, I started using this workaround a
while ago, back in the vs2003 fw1.1 days. One could argue that it is time
revisit it - against that, this roof ain't broke, so why fix it?
.
- Follow-Ups:
- Re: Odd behavior with WindowState
- From: Michael C
- Re: Odd behavior with WindowState
- References:
- Odd behavior with WindowState
- From: Jerad Rose
- RE: Odd behavior with WindowState
- From: AMercer
- Re: Odd behavior with WindowState
- From: Herfried K. Wagner [MVP]
- Re: Odd behavior with WindowState
- From: AMercer
- Re: Odd behavior with WindowState
- From: Michael C
- Odd behavior with WindowState
- Prev by Date: DesignSurface et al
- Next by Date: graphic Drag/drop challenge
- Previous by thread: Re: Odd behavior with WindowState
- Next by thread: Re: Odd behavior with WindowState
- Index(es):
Relevant Pages
|