Skip to content

Instantly share code, notes, and snippets.

@kencoba
Created May 15, 2017 05:50
Show Gist options
  • Save kencoba/40734b6c0e918395e28fb79cb549f187 to your computer and use it in GitHub Desktop.
Save kencoba/40734b6c0e918395e28fb79cb549f187 to your computer and use it in GitHub Desktop.
This is for control PowerPoint with PowerShell.
Class Points {
[double] $Left
[double] $Top
[double] $Width
[double] $Height
[Points] Magnify([double] $percent) {
$center_X = $this.Left + ($this.Width / 2)
$center_Y = $this.Top + ($this.Height /2)
$newWidth = $this.Width * $percent
$newHeight = $this.Height * $percent
$newLeft = $this.Left + ($this.Width - $newWidth) / 2
$newTop = $this.Top + ($this.Height - $newHeight) / 2
return New-Object Points($newLeft, $newTop, $newWidth, $newHeight)
}
Points([double] $Left, [double] $Top, [double] $Width, [double] $Height) {
$this.Left = $Left
$this.Top = $Top
$this.Width = $Width
$this.Height = $Height
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment