Skip to content

Commit

Permalink
No commit message
Browse files Browse the repository at this point in the history
  • Loading branch information
brandoncomputer committed Apr 18, 2022
1 parent 2e955c8 commit ff05d12
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 17 deletions.
4 changes: 3 additions & 1 deletion examples/calc.ps1
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
$calc = dialog create "Admin Calculator" 0 0 148 229
DPIAware
VisualStyle
$calc = dialog create "Admin Calculator" 0 0 148 229
$calc.FormBorderStyle = 6

$calc.maximumsize = new-object System.Drawing.Size((148 * $(screeninfo scale)),(229 * $(screeninfo scale)))
Expand Down
2 changes: 2 additions & 0 deletions examples/cursor.ps1
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
DPIAware
VisualStyle
$Form = dialog create "TEST CURSOR" 0 0 321 196
$List1 = dialog add $Form ListBox 10 10 180 144 "ListBox1"
$reset = dialog add $Form Button 16 221 75 23 "reset"
Expand Down
2 changes: 2 additions & 0 deletions examples/vds-ide-noscale.ps1
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
VisualStyle

if ((Get-Module -ListAvailable vds).count -gt 1){
$global:module = $(path $(Get-Module -ListAvailable vds)[0].path)
}
Expand Down
18 changes: 2 additions & 16 deletions examples/vds-ide.ps1
Original file line number Diff line number Diff line change
@@ -1,19 +1,5 @@
info $null 2>$null
$vscreen = [System.Windows.Forms.SystemInformation]::VirtualScreen.height
if ((get-host).version.major -eq 5) {
[xml]$xml = @"
<Window
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
</Window>
"@
$dum = (New-Object System.Xml.XmlNodeReader $xml)
$win = [Windows.Markup.XamlReader]::Load($dum)
}

$screen = [System.Windows.Forms.SystemInformation]::VirtualScreen.height

$global:ctscale = ($screen/$vscreen)
DPIAware
VisualStyle

if ((Get-Module -ListAvailable vds).count -gt 1){
$global:module = $(path $(Get-Module -ListAvailable vds)[0].path)
Expand Down
23 changes: 23 additions & 0 deletions vds.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,20 @@ using System.Drawing;
using System.Runtime.InteropServices;
using System.Windows.Forms;
using System.ComponentModel;
using System.Collections.Generic;
public class vds {
public static void SetCompat()
{
// SetProcessDPIAware();
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
}
[System.Runtime.InteropServices.DllImport("user32.dll")]
public static extern bool SetProcessDPIAware();
[DllImport("user32.dll")]
public static extern bool InvertRect(IntPtr hDC, [In] ref RECT lprc);
Expand Down Expand Up @@ -321,6 +333,17 @@ $global:fieldsep = "|"
$global:database = new-object System.Data.Odbc.OdbcConnection
set-alias run invoke-expression

function VisualStyle() {
[vds]::SetCompat()
}

function DPIAware($a) {
$vscreen = [System.Windows.Forms.SystemInformation]::VirtualScreen.height
[vds]::SetProcessDPIAware()
$screen = [System.Windows.Forms.SystemInformation]::VirtualScreen.height
$global:ctscale = ($screen/$vscreen)
}

function abs($a) {
<#
.SYNOPSIS
Expand Down

0 comments on commit ff05d12

Please sign in to comment.