Skip to content

Commit c74906d

Browse files
committed
Update MOD_Set All Colours.iLogicVb
1 parent 9deaa5b commit c74906d

File tree

1 file changed

+29
-2
lines changed

1 file changed

+29
-2
lines changed

Scripts/MOD_Set All Colours.iLogicVb

Lines changed: 29 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
1-
Imports System.Windows.Forms
1+
Imports System.Windows.Forms
2+
AddReference "System.Drawing.dll"
23
Imports System.Drawing
4+
Imports Inventor
5+
Imports clsSharedFunctions ' Globally import so it's available to all classes
36
' Title: Set All Colours
47
' Description: Change all parts to be the same colour
58
' Version: 0.2
@@ -44,6 +47,7 @@ Public Class RunMyForm
4447

4548
' Create new instance of the custom form (sends appearance list to form)
4649
Dim myfrm As New CustomForm(appearanceList)
50+
ScaleForm(myfrm)
4751

4852
Dim strAppearance As String = ""
4953
Dim bClearOverride As Boolean = True
@@ -164,7 +168,7 @@ Public Class CustomForm
164168
'.MinimizeBox = False
165169
.StartPosition = FormStartPosition.CenterScreen
166170
.Width = 300
167-
.Height = 175
171+
.Height = 200
168172
.TopMost = True
169173
.Text = "Set Part Colours"
170174
.Name = "Set Part Colours"
@@ -236,6 +240,7 @@ Public Class CustomForm
236240
' Set default dialog result
237241
Me.DialogResult = System.Windows.Forms.DialogResult.None
238242

243+
239244
End Sub
240245

241246
Private Sub CustomForm_FormClosing(ByVal sender As Object, ByVal e As System.Windows.Forms.FormClosingEventArgs) Handles Me.FormClosing
@@ -291,4 +296,26 @@ Public Class CustomForm
291296
End If
292297
End Sub
293298

299+
300+
301+
End Class
302+
303+
Public Class clsSharedFunctions
304+
305+
Public Shared strAppName As String = "Set All Colours"
306+
307+
Public Shared Sub ScaleForm(WindowsForm As System.Windows.Forms.Form)
308+
Using g As System.Drawing.Graphics = WindowsForm.CreateGraphics
309+
Dim sngScaleFactor As Single = 1
310+
Dim sngFontFactor As Single = 1
311+
If g.DpiX > 96 Then
312+
sngScaleFactor = g.DpiX / 96
313+
'sngFontFactor = 96 / g.DpiY
314+
End If
315+
If WindowsForm.AutoScaleDimensions = WindowsForm.CurrentAutoScaleDimensions Then
316+
'ucWindowsFormHost.ScaleControl(WindowsForm, sngFontFactor)
317+
WindowsForm.Scale(sngScaleFactor)
318+
End If
319+
End Using
320+
End Sub
294321
End Class

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy