Skip to content

Commit 306ccd4

Browse files
committed
Optimize controls
1 parent 5ddaf34 commit 306ccd4

File tree

6 files changed

+49
-19
lines changed

6 files changed

+49
-19
lines changed

BasicPawn/Classes/ClassControlStyle.vb

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -448,11 +448,15 @@ Public Class ClassControlStyle
448448

449449

450450
Public Shared Sub UpdateControls(c As Control)
451+
c.SuspendLayout()
452+
451453
SetColor(c)
452454

453455
For Each i As Control In c.Controls
454456
UpdateControls(i)
455457
Next
458+
459+
c.ResumeLayout()
456460
End Sub
457461

458462
''' <summary>

BasicPawn/Classes/FormMain/ClassTabControl.vb

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -625,15 +625,16 @@ Public Class ClassTabControl
625625
End Sub
626626

627627
Private Sub CreateTextEditor()
628-
g_mSourceTextEditor = New TextEditorControlEx With {
629-
.ContextMenuStrip = g_mFormMain.ContextMenuStrip_RightClick,
630-
.IsIconBarVisible = True,
631-
.ShowTabs = True,
632-
.ShowVRuler = False,
633-
.HideMouseCursor = True,
634-
.Margin = New Padding(0),
635-
.Padding = New Padding(0)
636-
}
628+
g_mSourceTextEditor = New TextEditorControlEx
629+
g_mSourceTextEditor.SuspendLayout()
630+
631+
g_mSourceTextEditor.ContextMenuStrip = g_mFormMain.ContextMenuStrip_RightClick
632+
g_mSourceTextEditor.IsIconBarVisible = True
633+
g_mSourceTextEditor.ShowTabs = True
634+
g_mSourceTextEditor.ShowVRuler = False
635+
g_mSourceTextEditor.HideMouseCursor = True
636+
g_mSourceTextEditor.Margin = New Padding(0)
637+
g_mSourceTextEditor.Padding = New Padding(0)
637638

638639
g_mSourceTextEditor.Document.TextEditorProperties.Font = ClassSettings.g_iSettingsTextEditorFont
639640
g_mSourceTextEditor.Document.TextEditorProperties.IndentationSize = If(ClassSettings.g_iSettingsTabsToSpaces > 0, ClassSettings.g_iSettingsTabsToSpaces, 4)
@@ -646,6 +647,7 @@ Public Class ClassTabControl
646647
g_mSourceTextEditor.Document.FoldingManager.UpdateFoldings(Nothing, Nothing)
647648

648649
g_mSourceTextEditor.Visible = True
650+
g_mSourceTextEditor.ResumeLayout()
649651
End Sub
650652

651653
Public Sub NewIndetifier()

BasicPawn/Controls and Forms/DatabaseViewer/ClassDatabaseViewer.vb

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,12 +31,16 @@ Public Class ClassDatabaseViewer
3131

3232
RemoveItemByName(sName)
3333

34-
Dim mDatabaseViewerItem As New ClassDatabaseViewerItem(sName, sUsername) With {
35-
.Parent = Me,
34+
With New ClassDatabaseViewerItem(sName, sUsername)
35+
.SuspendLayout()
36+
37+
.Parent = Me
3638
.Dock = DockStyle.Top
37-
}
38-
mDatabaseViewerItem.BringToFront()
39-
mDatabaseViewerItem.Show()
39+
.BringToFront()
40+
.Show()
41+
42+
.ResumeLayout()
43+
End With
4044

4145
Me.ResumeLayout()
4246
End Sub

BasicPawn/Controls and Forms/FormMultiCompiler.vb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ Public Class FormMultiCompiler
109109

110110
Me.Invoke(Sub()
111111
ProgressBar_Compiled.Increment(1)
112-
Me.Update()
112+
Me.Refresh()
113113
End Sub)
114114
Next
115115

BasicPawn/Controls and Forms/StartPage/UCStartPage.vb

Lines changed: 24 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,8 @@ Public Class UCStartPage
7676

7777
If (Not bProjectsFound) Then
7878
With New Label
79+
.SuspendLayout()
80+
7981
.Text = "No recent projects found!"
8082
.Font = New Font(Me.Font.FontFamily, 12, FontStyle.Regular)
8183
.AutoSize = False
@@ -84,11 +86,15 @@ Public Class UCStartPage
8486
.Parent = TabPage_RecentProjects
8587
.Dock = DockStyle.Fill
8688
.Show()
89+
90+
.ResumeLayout()
8791
End With
8892
End If
8993

9094
If (Not bFilesFound) Then
9195
With New Label
96+
.SuspendLayout()
97+
9298
.Text = "No recent files found!"
9399
.Font = New Font(Me.Font.FontFamily, 12, FontStyle.Regular)
94100
.AutoSize = False
@@ -97,6 +103,8 @@ Public Class UCStartPage
97103
.Parent = TabPage_RecentFiles
98104
.Dock = DockStyle.Fill
99105
.Show()
106+
107+
.ResumeLayout()
100108
End With
101109
End If
102110

@@ -332,18 +340,21 @@ Public Class UCStartPage
332340
End Function
333341

334342
Public Sub ClearRecentItems()
335-
g_mUCStartPage.TabControl_RecentProjects.SuspendLayout()
343+
g_mUCStartPage.TabPage_RecentFiles.SuspendLayout()
344+
g_mUCStartPage.TabPage_RecentProjects.SuspendLayout()
336345

337346
Dim mRecentItems = GetAllItems()
338347
For i = mRecentItems.Length - 1 To 0 Step -1
339348
mRecentItems(i).Dispose()
340349
Next
341350

342-
g_mUCStartPage.TabControl_RecentProjects.ResumeLayout()
351+
g_mUCStartPage.TabPage_RecentFiles.ResumeLayout()
352+
g_mUCStartPage.TabPage_RecentProjects.ResumeLayout()
343353
End Sub
344354

345355
Public Sub RefreshRecentItems()
346-
g_mUCStartPage.TabControl_RecentProjects.SuspendLayout()
356+
g_mUCStartPage.TabPage_RecentFiles.SuspendLayout()
357+
g_mUCStartPage.TabPage_RecentProjects.SuspendLayout()
347358

348359
ClearRecentItems()
349360

@@ -435,6 +446,8 @@ Public Class UCStartPage
435446
End Select
436447

437448
With New UCStartPageRecentItem(g_mUCStartPage, sFile)
449+
.SuspendLayout()
450+
438451
If (bProjectFile) Then
439452
.Parent = g_mUCStartPage.TabPage_RecentProjects
440453
Else
@@ -444,14 +457,19 @@ Public Class UCStartPage
444457
.Dock = DockStyle.Top
445458
.BringToFront()
446459
.Show()
460+
461+
.ResumeLayout()
447462
End With
448463
Next
449464

450-
g_mUCStartPage.TabControl_RecentProjects.ResumeLayout()
465+
g_mUCStartPage.TabPage_RecentFiles.ResumeLayout()
466+
g_mUCStartPage.TabPage_RecentProjects.ResumeLayout()
451467
End Sub
452468

453469
Private Sub CreateLastModifiedLabel(sText As String, mParent As Control)
454470
With New Label
471+
.SuspendLayout()
472+
455473
.Text = sText
456474
.Font = New Font(.Font.FontFamily, 12, FontStyle.Bold)
457475
.Name &= "@SetForeColorRoyalBlue"
@@ -461,6 +479,8 @@ Public Class UCStartPage
461479
.Dock = DockStyle.Top
462480
.BringToFront()
463481
.Show()
482+
483+
.ResumeLayout()
464484
End With
465485
End Sub
466486
End Class
512 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)