473,405 Members | 2,444 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,405 software developers and data experts.

Flashing when switching mdi forms

I have a parent form which contains a toolbar. The toolbar controls the
loading and switching to of MDI child forms.

The code for the toolbar click event and one of the subroutines that loads
and shows a child form is:

Private Sub tbMenu_ButtonClick(ByVal sender As System.Object, ByVal e As
System.Windows.Forms.ToolBarButtonClickEventArgs) Handles tbMenu.ButtonClick
Dim btn As System.Windows.Forms.ToolBarButton
For Each btn In Me.tbMenu.Buttons
If Me.Tag = e.Button.Tag Then
btn.Pushed = True
Else
btn.Pushed = False
End If
Next
Select Case e.Button.Tag
Case "0"
AccountEnquiry()
Case "1"
PostInvoice()
Case "99"
Me.Close()
End Select
End Sub
Private Sub AccountEnquiry()
' Account Enuiry
Static frm As New frmPurchaseLedgerAccount
Try
If IsNothing(frm) Then frm = New frmPurchaseLedgerAccount
With frm
..SuspendLayout()
..MdiParent = Me
..WindowState = Windows.Forms.FormWindowState.Maximized
..BringToFront()
..Show()
..ResumeLayout()
End With
Catch
frm = Nothing
AccountEnquiry()
End Try
End Sub
This works fine when the toolbar button is first clicked. The form just
loads and displays.

However, if you then click to another child form and then click back, you
can see the form display and then expand to maximised within the parent form
which flickers and is annoying. I tried inserting the suspendlayout and
resume layouts to see if that helps but it doesn't. Can anybody suggest a
way to stop the flickering?

Thanks in advance
Simon
--
================================
Simon Verona
Dealer Management Service Ltd
Stewart House
Centurion Business Park
Julian Way
Sheffield
S9 1GD

Tel: 0870 080 2300
Fax: 0870 735 0011
Mar 21 '06 #1
3 4362
Hi Simon, I am clear what you mean. Why do you not post the lines (and
only the lines) that show your problem, so that we can replicate the
problem and suggest a solution?

It may just be a matter of use activate() instead of bring to front...
(?)

-tom
Simon Verona ha scritto:
I have a parent form which contains a toolbar. The toolbar controls the
loading and switching to of MDI child forms.

The code for the toolbar click event and one of the subroutines that loads
and shows a child form is:

Private Sub tbMenu_ButtonClick(ByVal sender As System.Object, ByVal e As
System.Windows.Forms.ToolBarButtonClickEventArgs) Handles tbMenu.ButtonClick
Dim btn As System.Windows.Forms.ToolBarButton
For Each btn In Me.tbMenu.Buttons
If Me.Tag = e.Button.Tag Then
btn.Pushed = True
Else
btn.Pushed = False
End If
Next
Select Case e.Button.Tag
Case "0"
AccountEnquiry()
Case "1"
PostInvoice()
Case "99"
Me.Close()
End Select
End Sub
Private Sub AccountEnquiry()
' Account Enuiry
Static frm As New frmPurchaseLedgerAccount
Try
If IsNothing(frm) Then frm = New frmPurchaseLedgerAccount
With frm
.SuspendLayout()
.MdiParent = Me
.WindowState = Windows.Forms.FormWindowState.Maximized
.BringToFront()
.Show()
.ResumeLayout()
End With
Catch
frm = Nothing
AccountEnquiry()
End Try
End Sub
This works fine when the toolbar button is first clicked. The form just
loads and displays.

However, if you then click to another child form and then click back, you
can see the form display and then expand to maximised within the parent form
which flickers and is annoying. I tried inserting the suspendlayout and
resume layouts to see if that helps but it doesn't. Can anybody suggest a
way to stop the flickering?

Thanks in advance
Simon
--
================================
Simon Verona
Dealer Management Service Ltd
Stewart House
Centurion Business Park
Julian Way
Sheffield
S9 1GD

Tel: 0870 080 2300
Fax: 0870 735 0011


Mar 21 '06 #2


<to**************@uniroma1.it> wrote in message
news:11**********************@v46g2000cwv.googlegr oups.com...
Hi Simon, I am clear what you mean. Why do you not post the lines (and
only the lines) that show your problem, so that we can replicate the
problem and suggest a solution?

It may just be a matter of use activate() instead of bring to front...
(?)

-tom
Simon Verona ha scritto:
I have a parent form which contains a toolbar. The toolbar controls the
loading and switching to of MDI child forms.

The code for the toolbar click event and one of the subroutines that
loads
and shows a child form is:

Private Sub tbMenu_ButtonClick(ByVal sender As System.Object, ByVal e As
System.Windows.Forms.ToolBarButtonClickEventArgs) Handles
tbMenu.ButtonClick
Dim btn As System.Windows.Forms.ToolBarButton
For Each btn In Me.tbMenu.Buttons
If Me.Tag = e.Button.Tag Then
btn.Pushed = True
Else
btn.Pushed = False
End If
Next
Select Case e.Button.Tag
Case "0"
AccountEnquiry()
Case "1"
PostInvoice()
Case "99"
Me.Close()
End Select
End Sub
Private Sub AccountEnquiry()
' Account Enuiry
Static frm As New frmPurchaseLedgerAccount
Try
If IsNothing(frm) Then frm = New frmPurchaseLedgerAccount
With frm
.SuspendLayout()
.MdiParent = Me
.WindowState = Windows.Forms.FormWindowState.Maximized
.BringToFront()
.Show()
.ResumeLayout()
End With
Catch
frm = Nothing
AccountEnquiry()
End Try
End Sub
This works fine when the toolbar button is first clicked. The form just
loads and displays.

However, if you then click to another child form and then click back, you
can see the form display and then expand to maximised within the parent
form
which flickers and is annoying. I tried inserting the suspendlayout and
resume layouts to see if that helps but it doesn't. Can anybody suggest
a
way to stop the flickering?

Thanks in advance
Simon
--
================================
Simon Verona
Dealer Management Service Ltd
Stewart House
Centurion Business Park
Julian Way
Sheffield
S9 1GD

Tel: 0870 080 2300
Fax: 0870 735 0011


Ok.

It's hard to tell exactly which line causes the problem.

What I'm trying to do is manage MDI forms in code using a toolstrip with
buttons on.

Each time a button on the toolstrip is clicked, the mdi child form for that
button will be created is it doesn't exist and then maximised to fill the
parent mdi form space.

The code I use to instantiate the child form and then display it is :

Private Sub AccountEnquiry()
' Account Enuiry
Static frm As New frmPurchaseLedgerAccount
Try
If IsNothing(frm) Then frm = New frmPurchaseLedgerAccount
With frm
.SuspendLayout()
.MdiParent = Me ' Makes sure the child form is a mdi child
.WindowState = Windows.Forms.FormWindowState.Maximized ' this
maximises it to fill the window
.BringToFront() ' This makes sure it is the front mdi child
.Show() ' Shows the form
.ResumeLayout()
End With
Catch
' It hits here if the child form has been previously displayed and then
closed - it's then disposed so just needs setting to nothing and then
redisplaying
frm = Nothing
AccountEnquiry()
End Try
End Sub

On first instantiation the form just "shows" - already maximised in the
parent.

However, if the form already is instantiated and the user is simply
switching back to it, then the form will display in "normal" size (ie not
maximised) and will then "expand" to fill the window. This gives a
noticeable and annoying flickering.

Does that clarify?

Regards
Simon
Mar 22 '06 #3

"Simon Verona" <no****@nomail.zzz> wrote in message
news:OB**************@TK2MSFTNGP11.phx.gbl...


<to**************@uniroma1.it> wrote in message
news:11**********************@v46g2000cwv.googlegr oups.com...
Hi Simon, I am clear what you mean. Why do you not post the lines (and
only the lines) that show your problem, so that we can replicate the
problem and suggest a solution?

It may just be a matter of use activate() instead of bring to front...
(?)

-tom
Simon Verona ha scritto:
I have a parent form which contains a toolbar. The toolbar controls the
loading and switching to of MDI child forms.

The code for the toolbar click event and one of the subroutines that
loads
and shows a child form is:

Private Sub tbMenu_ButtonClick(ByVal sender As System.Object, ByVal e As
System.Windows.Forms.ToolBarButtonClickEventArgs) Handles
tbMenu.ButtonClick
Dim btn As System.Windows.Forms.ToolBarButton
For Each btn In Me.tbMenu.Buttons
If Me.Tag = e.Button.Tag Then
btn.Pushed = True
Else
btn.Pushed = False
End If
Next
Select Case e.Button.Tag
Case "0"
AccountEnquiry()
Case "1"
PostInvoice()
Case "99"
Me.Close()
End Select
End Sub
Private Sub AccountEnquiry()
' Account Enuiry
Static frm As New frmPurchaseLedgerAccount
Try
If IsNothing(frm) Then frm = New frmPurchaseLedgerAccount
With frm
.SuspendLayout()
.MdiParent = Me
.WindowState = Windows.Forms.FormWindowState.Maximized
.BringToFront()
.Show()
.ResumeLayout()
End With
Catch
frm = Nothing
AccountEnquiry()
End Try
End Sub
This works fine when the toolbar button is first clicked. The form just
loads and displays.

However, if you then click to another child form and then click back,
you
can see the form display and then expand to maximised within the parent
form
which flickers and is annoying. I tried inserting the suspendlayout and
resume layouts to see if that helps but it doesn't. Can anybody suggest
a
way to stop the flickering?

Thanks in advance
Simon
--
================================
Simon Verona
Dealer Management Service Ltd
Stewart House
Centurion Business Park
Julian Way
Sheffield
S9 1GD

Tel: 0870 080 2300
Fax: 0870 735 0011


Ok.

It's hard to tell exactly which line causes the problem.

What I'm trying to do is manage MDI forms in code using a toolstrip with
buttons on.

Each time a button on the toolstrip is clicked, the mdi child form for
that button will be created is it doesn't exist and then maximised to fill
the parent mdi form space.

The code I use to instantiate the child form and then display it is :

Private Sub AccountEnquiry()
' Account Enuiry
Static frm As New frmPurchaseLedgerAccount
Try
If IsNothing(frm) Then frm = New frmPurchaseLedgerAccount
With frm
.SuspendLayout()
.MdiParent = Me ' Makes sure the child form is a mdi child
.WindowState = Windows.Forms.FormWindowState.Maximized ' this
maximises it to fill the window
.BringToFront() ' This makes sure it is the front mdi child
.Show() ' Shows the form
.ResumeLayout()
End With
Catch
' It hits here if the child form has been previously displayed and then
closed - it's then disposed so just needs setting to nothing and then
redisplaying
frm = Nothing
AccountEnquiry()
End Try
End Sub

On first instantiation the form just "shows" - already maximised in the
parent.

However, if the form already is instantiated and the user is simply
switching back to it, then the form will display in "normal" size (ie not
maximised) and will then "expand" to fill the window. This gives a
noticeable and annoying flickering.

Does that clarify?

Regards
Simon

Typical

A eureka moment just after I post !

If you put a frm.hide statement before the maximise statement in the code,
it then works with no flickering.

Regards
Simon

--
================================
Simon Verona
Dealer Management Service Ltd
Stewart House
Centurion Business Park
Julian Way
Sheffield
S9 1GD

Tel: 0870 080 2300
Fax: 0870 735 0011
Mar 22 '06 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: rikesh | last post by:
Hi Does anyone know how to make a table row flash in a certain colour, depending on a DB value? I have a helpdesk application listing statuses of Agents and the calls queued on the system. ...
9
by: Phillip Parr | last post by:
Hello, I know there is no way in Javascript to make the task bar flash when your window is minimised. However, I found out recently that if a javascript alert is sent to netscape when the window...
2
by: Xam | last post by:
Hello Everybody Can you let me know of a javascript/dom routine that will automatically put the flashing cursor in the first text box in my form so that it is ready for entry rather than the...
4
by: Randy Harris | last post by:
Strange problem on A2K. A continuous form is getting some sort of strobe effect on several systems that have been upgraded to Windows XP (never saw the problem on Win2K). One of the text boxes is...
1
by: Terry | last post by:
I've seen several posts from people who have seen this flashing in TreeView's when resizing a form. I've noticed it in my app, but only in the child windows. For example, my main form has a...
2
by: Johann Blake | last post by:
The following is a bug I have discovered using tab pages and threads and I am looking for a workaround. Create a new Windows Forms application and add a tab control with two tab pages. Add a...
1
by: Thilo Frank | last post by:
I want to add a flashing text cursor to my selfmade user control. Is there an existing class availible for this problem or do I have to write a thread, which flashs the cursor? THX for your help...
0
by: Access NewBee | last post by:
Hi, I am upgrading an Access 2000 ADP connected to SQL 2000 DB to Access 2003. I have several parent forms which have sub-forms and a tab control. The sub-forms are not deeper than one level on any...
11
by: Andrus | last post by:
1. Run code 2. Resize window Observed: Listbox flashes during resize. How to remove this flashing ? Andrus.
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.