![]() |
![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
|
Welcome to Vista Forums we are your forum to discuss Windows Vista x64 and x86 systems. Whether you need help or just want to post an idea you have on Vista, this is the forum for you.
br> br> |
| |||||||
![]() |
| | Thread Tools | Display Modes |
| | #1 (permalink) |
| Guest | Viewing an image from within Powershell I want to create a separate window (with the system.windows.forms class) and view images from a URL through the new window. As my .NET skills are lacking, this is what I've managed to whip up so far: [Reflection.Assembly]::LoadWithPartialName("System.Windows.Forms") $form = new-object System.Windows.Forms.form $form.MaximizeBox = $false; $form.MinimizeBox = $false; $form.StartPosition = [System.Windows.Forms.FormStartPosition]::CenterScreen $form.FormBorderStyle = [System.Windows.Forms.FormBorderStyle]::FixedDialog $form.ShowDialog() I'm still uncertain how I would go about pulling images from the web and viewing it from this window (System.Windows.Media.Imaging maybe?). Also how do I set the autosize property correctly so that the window resizes itself according to the image size? |
| | #2 (permalink) |
| Guest | RE: Viewing an image from within Powershell I've found a way to draw the image. Does anyone know how to get the image to update at an interval? "Luke" wrote: > I want to create a separate window (with the system.windows.forms class) and > view images from a URL through the new window. As my .NET skills are lacking, > this is what I've managed to whip up so far: > > [Reflection.Assembly]::LoadWithPartialName("System.Windows.Forms") > $form = new-object System.Windows.Forms.form > $form.MaximizeBox = $false; > $form.MinimizeBox = $false; > $form.StartPosition = [System.Windows.Forms.FormStartPosition]::CenterScreen > $form.FormBorderStyle = [System.Windows.Forms.FormBorderStyle]::FixedDialog > $form.ShowDialog() > > I'm still uncertain how I would go about pulling images from the web and > viewing it from this window (System.Windows.Media.Imaging maybe?). Also how > do I set the autosize property correctly so that the window resizes itself > according to the image size? |
| | #3 (permalink) |
| Guest | Re: Viewing an image from within Powershell On Aug 10, 10:08 am, Luke <L...@discussions.microsoft.com> wrote: > I've found a way to draw the image. Does anyone know how to get the image to > update at an interval? > > "Luke" wrote: > > I want to create a separate window (with the system.windows.forms class) and > > view images from a URL through the new window. As my .NET skills are lacking, > > this is what I've managed to whip up so far: > > > [Reflection.Assembly]::LoadWithPartialName("System.Windows.Forms") > > $form = new-object System.Windows.Forms.form > > $form.MaximizeBox = $false; > > $form.MinimizeBox = $false; > > $form.StartPosition = [System.Windows.Forms.FormStartPosition]::CenterScreen > > $form.FormBorderStyle = [System.Windows.Forms.FormBorderStyle]::FixedDialog > > $form.ShowDialog() > > > I'm still uncertain how I would go about pulling images from the web and > > viewing it from this window (System.Windows.Media.Imaging maybe?). Also how > > do I set the autosize property correctly so that the window resizes itself > > according to the image size? [Reflection.Assembly]::LoadWithPartialName("System.Windows.Forms") $form = new-object System.Windows.Forms.form $form.MaximizeBox = $false; $form.MinimizeBox = $false; $form.StartPosition = [System.Windows.Forms.FormStartPosition]::CenterScreen $form.FormBorderStyle = [System.Windows.Forms.FormBorderStyle]::FixedDialog $urls = "http://www.google.com/intl/en_ALL/images/logo.gif", ` "http://groups.google.com/groups/img/3nb/groups_medium.gif", ` "http://www.google.com/ig/images/igoogle_logo_sm.gif", ` "http://docs.google.com/images/doclist/logo_docs.gif" $script:urlIndex = 0 function NextImage { if ( $script:urlIndex -gt $urls.Length - 1 ) { $script:urlIndex = 0 } $webRequest = [System.Net.WebRequest]::Create( $urls[ $script:urlIndex ] ) $webResponse = $webRequest.GetResponse() $image = New-Object System.Drawing.Bitmap $webResponse.GetResponseStream() $webResponse.Close() $imageLabel.Image = $image $imageLabel.Size = $image.Size $form.ClientSize = $image.Size $script:urlIndex++ } $imageLabel = New-Object System.Windows.Forms.Label $imageLabel.add_Click( [System.EventHandler] { NextImage } ) $form.Controls.Add( $imageLabel ) NextImage $imageTimer = New-Object System.Windows.Forms.Timer $imageTimer.Interval = 2000 $imageTimer.add_Tick( [System.EventHandler] { NextImage } ) $imageTimer.Start() $form.ShowDialog() This will move to the next image when you click on the label, or every two seconds on a timer. Good luck. Jeff |
| | #4 (permalink) |
| Guest | Re: Viewing an image from within Powershell > This will move to the next image when you click on the label, or every > two seconds on a timer. > > Good luck. > > Jeff > Super cool! Thanks for sharing. Marco -- ---------------- PowerGadgets MVP http://www.powergadgets.com/mvp Blog: http://marcoshaw.blogspot.com |
| |
| |
![]() |
| Thread Tools | |
| Display Modes | |
| |
Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| can powershell be included in a Win PE boot image? | James | PowerShell | 5 | 2 Weeks Ago 05:26 PM |
| Acronis True Image recovery of Vista Image | mrh981 | Vista General | 1 | 07-01-2008 09:57 PM |
| "Copy/paste functionality has been disabled while viewing the3 image." | Paul J. Perillo | Vista General | 0 | 02-18-2008 09:44 PM |
| Windows programming and image manipulation in Powershell question | hasten | PowerShell | 0 | 02-16-2008 03:22 PM |
| Reduce Image viewing size in Windows Mail Program | Josh | Vista mail | 2 | 09-04-2007 07:10 AM |