Skip to content

Commit ff05d12

Browse files
1 parent 2e955c8 commit ff05d12

5 files changed

Lines changed: 32 additions & 17 deletions

File tree

examples/calc.ps1

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
$calc = dialog create "Admin Calculator" 0 0 148 229
1+
DPIAware
2+
VisualStyle
3+
$calc = dialog create "Admin Calculator" 0 0 148 229
24
$calc.FormBorderStyle = 6
35

46
$calc.maximumsize = new-object System.Drawing.Size((148 * $(screeninfo scale)),(229 * $(screeninfo scale)))

examples/cursor.ps1

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
DPIAware
2+
VisualStyle
13
$Form = dialog create "TEST CURSOR" 0 0 321 196
24
$List1 = dialog add $Form ListBox 10 10 180 144 "ListBox1"
35
$reset = dialog add $Form Button 16 221 75 23 "reset"

examples/vds-ide-noscale.ps1

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
VisualStyle
2+
13
if ((Get-Module -ListAvailable vds).count -gt 1){
24
$global:module = $(path $(Get-Module -ListAvailable vds)[0].path)
35
}

examples/vds-ide.ps1

Lines changed: 2 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,5 @@
1-
info $null 2>$null
2-
$vscreen = [System.Windows.Forms.SystemInformation]::VirtualScreen.height
3-
if ((get-host).version.major -eq 5) {
4-
[xml]$xml = @"
5-
<Window
6-
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
7-
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
8-
</Window>
9-
"@
10-
$dum = (New-Object System.Xml.XmlNodeReader $xml)
11-
$win = [Windows.Markup.XamlReader]::Load($dum)
12-
}
13-
14-
$screen = [System.Windows.Forms.SystemInformation]::VirtualScreen.height
15-
16-
$global:ctscale = ($screen/$vscreen)
1+
DPIAware
2+
VisualStyle
173

184
if ((Get-Module -ListAvailable vds).count -gt 1){
195
$global:module = $(path $(Get-Module -ListAvailable vds)[0].path)

vds.psm1

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,20 @@ using System.Drawing;
66
using System.Runtime.InteropServices;
77
using System.Windows.Forms;
88
using System.ComponentModel;
9+
using System.Collections.Generic;
910
1011
public class vds {
12+
13+
public static void SetCompat()
14+
{
15+
// SetProcessDPIAware();
16+
Application.EnableVisualStyles();
17+
Application.SetCompatibleTextRenderingDefault(false);
18+
}
19+
20+
[System.Runtime.InteropServices.DllImport("user32.dll")]
21+
public static extern bool SetProcessDPIAware();
22+
1123
[DllImport("user32.dll")]
1224
public static extern bool InvertRect(IntPtr hDC, [In] ref RECT lprc);
1325
@@ -321,6 +333,17 @@ $global:fieldsep = "|"
321333
$global:database = new-object System.Data.Odbc.OdbcConnection
322334
set-alias run invoke-expression
323335

336+
function VisualStyle() {
337+
[vds]::SetCompat()
338+
}
339+
340+
function DPIAware($a) {
341+
$vscreen = [System.Windows.Forms.SystemInformation]::VirtualScreen.height
342+
[vds]::SetProcessDPIAware()
343+
$screen = [System.Windows.Forms.SystemInformation]::VirtualScreen.height
344+
$global:ctscale = ($screen/$vscreen)
345+
}
346+
324347
function abs($a) {
325348
<#
326349
.SYNOPSIS

0 commit comments

Comments
 (0)