Thanks, I've tried a variant of that (used by the previous developer on
other forms so I guiess there's precedent) of starting a "LoadTimer" at the
end of the FormLoad event. This then does the rest of the GUI work
(including checks for the vertical scrollbar) and (I'm guessing) is
effectively the same as the FormShown event.
Works fine now.
Note that in VS 2005 and C# using .NET 2.0 (specifically the CF version),
there is no shown event for a System.Windows.Form control. Is this a new
form event? The list of events is:
Activated
Click, Closed, Closing, Deactivate, DoubleClick, EnabledChanged, GotFocus,
HelpRequested, KeyDown/Press/Up, Load, LostFocus, MouseDown/Move/Up, Paint,
ParentChanged, Resize, TextChanged, Validated, Validating
The idea of using a timer to complete loading seems reasonable to me.
Thanks again for the help and Merry Christmas.
Alain
"Peter Duniho" <(E-Mail Removed)> wrote in message
news:CI6dnSlsOo0t-(E-Mail Removed)...
> On 12/22/11 8:06 AM, Alain Dekker wrote:
>> Hi, found one problem. It should be:
>> int nStyle = GetWindowLong(hWnd, GWL_STYLE); // private const int
>> GWL_STYLE = -16;
>>
>> and not:
>> int nStyle = GetWindowLong(hWnd, WS_VSCROLL);
>>
>> but I still have a problem. The very first time the form is loaded, the
>> scrollbar returns "false" (not visible). You check it again once it is
>> fully
>> loaded and it returns "true" (yes I am visible). Why is it false to start
>> with, but then corrects itself after the Form Load event has completed?
>
> Try handling the Shown event rather than Load.
>
> I don't know 100% that will work for sure (I try not to write code that
> relies on whether the scroll bar is visible or not), but it's worth
> trying.
>
> Pete
|