Quantcast
Channel: PowerShell.com – PowerShell Scripts, Tips, Forums, and Resources: Active Threads
Viewing all articles
Browse latest Browse all 8411

Displaying a jpg or icon image, this doesn't work.

$
0
0

I am trying to get this to work but it won't

  $Image = [system.drawing.image]::fromfile('c:\users\Public\Public Pictures\Sample Pictures\Desert.jpg')

  $form = new system.windows.forms.form
  $form.BackgroundImage = $image;$form.text = $Filename

  $size = $Image.size;$size.width += 8;$size.Height += 30
  $form.size = $size

  $form.topmost = $true
  $Form.Add_Shown({$form.topmost = $false})
  $form.showdialog()

Here is the error:

Exception calling "FromFile" with "1" argument(s): "c:\users\Public\Public Pict
ures\Sample Pictures\Desert.jpg"
At line:6 char:44
+   $Image = [system.drawing.image]::fromfile <<<< ('c:\users\Public\Public Pic
tures\Sample Pictures\Desert.jpg')
    + CategoryInfo          : NotSpecified: (:) [], MethodInvocationException
    + FullyQualifiedErrorId : DotNetMethodException
 
The term 'new' is not recognized as the name of a cmdlet, function, script file
, or operable program. Check the spelling of the name, or if a path was include
d, verify that the path is correct and try again.
At line:8 char:14
+   $form = new <<<<  system.windows.forms.form
    + CategoryInfo          : ObjectNotFound: (new:String) [], CommandNotFound
   Exception
    + FullyQualifiedErrorId : CommandNotFoundException

Thank you in advance...... Goo


Viewing all articles
Browse latest Browse all 8411

Latest Images

Trending Articles



Latest Images