![]() |
![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
| Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks. |
| |||||||
![]() |
| |
| | #1 (permalink) |
| | Display an image from powershell? I need, given a file path to a .jpg or .bmp, to display the image on the screen. Here is some code I came across on the net: $file = (get-item "c:\image.jpg") [void][reflection.assembly]::LoadWithPartialName("System.Windows.Forms") $form = new-object Windows.Forms.Form $form.Text = "Image Viewer" $form.width = 1280 $form.height = 1024 $pictureBox = new-object Windows.Forms.PictureBox $pictureBox.Width = 1280 $pictureBox.Height = 1024 $pictureBox.Image = [System.Drawing.Image]::Fromfile($file) $form.controls.add($pictureBox) $form.Add_Shown( { $form.Activate() } ) $form.ShowDialog() I modified the code a little, my problem though is that when $form.showdialog executes, powershell waits for the dialog results (i.e. a user to close the dialog). Is there a way for the script to keep executing and possibly close the dialog itself? Like a simple slide-show type script? |
My System Specs![]() |
| | #2 (permalink) |
| | Re: Display an image from powershell? Doesn't matter any more, I found a nice software program for slide shows for free on the net that works, I have Vista and it has a slideshow program but it causes tearing when watching videos in WMP (on a second monitor) and doing a slide show at the same time. "James" <no@xxxxxx> wrote in message news:B5E11535-671A-4CF5-BA8A-3CD9E405DD72@xxxxxx Quote: >I need, given a file path to a .jpg or .bmp, to display the image on the >screen. Here is some code I came across on > the net: > > $file = (get-item "c:\image.jpg") > > [void][reflection.assembly]::LoadWithPartialName("System.Windows.Forms") > $form = new-object Windows.Forms.Form > $form.Text = "Image Viewer" > $form.width = 1280 > $form.height = 1024 > $pictureBox = new-object Windows.Forms.PictureBox > $pictureBox.Width = 1280 > $pictureBox.Height = 1024 > > $pictureBox.Image = [System.Drawing.Image]::Fromfile($file) > $form.controls.add($pictureBox) > $form.Add_Shown( { $form.Activate() } ) > $form.ShowDialog() > > I modified the code a little, my problem though is that when > $form.showdialog executes, powershell waits for the dialog results (i.e. a > user to close the dialog). Is there a way for the script to keep > executing and possibly close the dialog itself? Like a simple slide-show > type script? |
My System Specs![]() |
![]() |
| Thread Tools | |
| |
Similar Threads | ||||
| Thread | Forum | |||
| can powershell be included in a Win PE boot image? | PowerShell | |||
| Windows programming and image manipulation in Powershell question | PowerShell | |||
| Viewing an image from within Powershell | PowerShell | |||