Remedy for Form Flicker


Author
Message
Trent Taylor
Trent Taylor
StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)
Group: StrataFrame Developers
Posts: 6.6K, Visits: 6.9K
We actually added this API call to the SF tools namespace.  It will be included in the 1.6.2 build or you could just manually call the API.

Using SF

MicroFour.StrataFrame.Tools.LockScreen.Lock(Me)
MicroFour.StrataFrame.Tools.LockScreen.Unlock()

Using WinAPI Directly (All the SF method does)

<DllImport("user32.dll")> _
Private Shared Function LockWindowUpdate(ByVal hWndLock As IntPtr) As Boolean
End Function

'-- Lock the window
LockWindowUpdate(Me.Handle)

'-- Unlock the Window
LockWindowUpdate(Intptr.Zero)



Ross L Rooker, Sr.
Ross L Rooker, Sr.
StrataFrame Beginner (2 reputation)StrataFrame Beginner (2 reputation)StrataFrame Beginner (2 reputation)StrataFrame Beginner (2 reputation)StrataFrame Beginner (2 reputation)StrataFrame Beginner (2 reputation)StrataFrame Beginner (2 reputation)StrataFrame Beginner (2 reputation)StrataFrame Beginner (2 reputation)
Group: Forum Members
Posts: 2, Visits: 3
Unfortunately it is not just when a form loads. After my form is loaded, clicking on any tab, then back repeatedly, shows the ghost image of the tab clicked from while drawing the control on the page tab clicked to. If it was just on the page load it wouldn't be as bad. My thought would be a lock to the windows 32 desktop on the activation of the page tab and then unlocking after the tab is rendered. Is there any example of the win32 api code required to handle this and what event it should be located in?
Jc Martinez
Jc Martinez
StrataFrame Beginner (24 reputation)StrataFrame Beginner (24 reputation)StrataFrame Beginner (24 reputation)StrataFrame Beginner (24 reputation)StrataFrame Beginner (24 reputation)StrataFrame Beginner (24 reputation)StrataFrame Beginner (24 reputation)StrataFrame Beginner (24 reputation)StrataFrame Beginner (24 reputation)
Group: Forum Members
Posts: 20, Visits: 59
Hi Guys,

Since I’m new to .Net and strataframe I tend to read as many post to see what issues people are having and how they are handled. This one caught my attention in its absurdity Crazy that like Ben points out should not exists and after searching for this issue it seems to be a grieving complaint Angry among .net developers.

In any case its resolution is a little above my head Hehe but besides the solutions before mentioned I found these 2 post that might help others.

Frozen forms for flickering-free updates
http://www.dotnet2themax.com/blogs/fbalena/PermaLink,guid,6336502b-57c5-430d-9d37-7f9be484f6b3.aspx

Practical Tips for Boosting the Performance of Windows Forms Apps
http://msdn.microsoft.com/msdnmag/issues/06/03/WindowsFormsPerformance/

StrataFrame Team
S
StrataFrame Developer (4.2K reputation)StrataFrame Developer (4.2K reputation)StrataFrame Developer (4.2K reputation)StrataFrame Developer (4.2K reputation)StrataFrame Developer (4.2K reputation)StrataFrame Developer (4.2K reputation)StrataFrame Developer (4.2K reputation)StrataFrame Developer (4.2K reputation)StrataFrame Developer (4.2K reputation)
Group: StrataFrame Developers
Posts: 3K, Visits: 2.5K
You'd think for a $1 billion project like .NET 2.0 with 700 programmers, they'd come up with a way to prevent the flicker when forms load... oh well.
StrataFrame Team
S
StrataFrame Developer (4.2K reputation)StrataFrame Developer (4.2K reputation)StrataFrame Developer (4.2K reputation)StrataFrame Developer (4.2K reputation)StrataFrame Developer (4.2K reputation)StrataFrame Developer (4.2K reputation)StrataFrame Developer (4.2K reputation)StrataFrame Developer (4.2K reputation)StrataFrame Developer (4.2K reputation)
Group: StrataFrame Developers
Posts: 3K, Visits: 2.5K
With the way that .NET uses controls that are individually windowed (each control is considered to be its own window wth its own hWnd), the drawing issues at form startup are hard to avoid.  There are some workarounds, but nothing that is simple:

1)  Show the form somewhere off screen (like (10000, 10000) and once the SetVisibleCore has existed (or once the Shown event fires), the move its location back to the screen

2)  For panels, show the panel off screen, once it's done rendering, use the Control.DrawToBitmap() method to take a snapshot of the panel, show a picture box in place of the panel with the picture, relocate the panel to slide it underneath the picture, and lastly, hide the picture.

There are other ways, but thinks like WM_SETREDRAW and LockWindow only work for one window handle at a time, and only affect the form, not all controls on the form.

The second option is what we ended up having to do for PracticeStudio.NET because the way our interface works, it doesn't have forms, just pages that open up as tabs.

Greg McGuffey
Greg McGuffey
Strategic Support Team Member (3.4K reputation)
Group: Forum Members
Posts: 2K, Visits: 6.6K
Good to see back on the forum, ben!
Ben Hayat
Ben Hayat
Advanced StrataFrame User (516 reputation)Advanced StrataFrame User (516 reputation)Advanced StrataFrame User (516 reputation)Advanced StrataFrame User (516 reputation)Advanced StrataFrame User (516 reputation)Advanced StrataFrame User (516 reputation)Advanced StrataFrame User (516 reputation)Advanced StrataFrame User (516 reputation)Advanced StrataFrame User (516 reputation)
Group: Forum Members
Posts: 374, Visits: 1.2K
What I want to happen is basically draw the form invisibly, then once all the forms are drawn show the entire form.


You may want to set the Opacity=0 or .25 first and then when all controls are drawn, you can set to 1 through a loop to give it a nice effect.

..ßen
Ross L Rooker, Sr.
Ross L Rooker, Sr.
StrataFrame Beginner (2 reputation)StrataFrame Beginner (2 reputation)StrataFrame Beginner (2 reputation)StrataFrame Beginner (2 reputation)StrataFrame Beginner (2 reputation)StrataFrame Beginner (2 reputation)StrataFrame Beginner (2 reputation)StrataFrame Beginner (2 reputation)StrataFrame Beginner (2 reputation)
Group: Forum Members
Posts: 2, Visits: 3
Is the flicker issue resolved in the framework when using tabbed forms?
Brad Vick
Brad Vick
StrataFrame Beginner (33 reputation)StrataFrame Beginner (33 reputation)StrataFrame Beginner (33 reputation)StrataFrame Beginner (33 reputation)StrataFrame Beginner (33 reputation)StrataFrame Beginner (33 reputation)StrataFrame Beginner (33 reputation)StrataFrame Beginner (33 reputation)StrataFrame Beginner (33 reputation)
Group: Forum Members
Posts: 33, Visits: 88




We try not to use tabs, instead we are using the panel manager and breaking the controls down inside individual panels.



Any ideas?
StrataFrame Team
S
StrataFrame Developer (4.2K reputation)StrataFrame Developer (4.2K reputation)StrataFrame Developer (4.2K reputation)StrataFrame Developer (4.2K reputation)StrataFrame Developer (4.2K reputation)StrataFrame Developer (4.2K reputation)StrataFrame Developer (4.2K reputation)StrataFrame Developer (4.2K reputation)StrataFrame Developer (4.2K reputation)
Group: StrataFrame Developers
Posts: 3K, Visits: 2.5K
Yes, we have experienced it... and the only solution we have found was to places sets of controls on separate tabs on the page.  The DoubleBuffer property on the form didn't do anything for us, either, and there is no way to completely lock a form and prevent drawing or to force the form to only draw one time.  Anyone else have a suggestion?
GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Similar Topics

Reading This Topic

Login

Explore
Messages
Mentions
Search