PowerShell In GUI Blog

PowerShell GUI Box Just In A Few Clicks

Archive for the ‘System.Windows.Forms.ImageList’ Category

Which Icons Are Shipped With Object Browser?

leave a comment »

Actually, what is the easiest way to display icons? Create a control like ListView? Maybe. Let’s create a handful of windows, just to observe how short the code might be.

First, import both modules, SuiteCore and ObjectBrowser (here and thereafter the PSDevStudioLite modules set is in use).

After that you are able to use the function set shipped with the package. The following simple code creates windows, which in turn demostrate icons.

cls
function createWindows
{
    for($private:i = 0; $private:i -lt $imagesList.Count; $private:i++)
    {
        $tw2 = New-SEToolWindow -Control (([System.Windows.Forms.ListBox]$lb = New-Object System.Windows.Forms.ListBox) | %{$lb;}) `
            -TitleBarText ("aaa" + $private:i) `
            -WindowName ("aaaaa" + $private:i) `
            -Image $imagesList[$imagesList.Keys[$private:i]] `
            -Visible $false -State TabbedDocument;
        Write-Host $private:i $imagesList.Keys[$private:i]
        $se.ToolWindows[("aaaaa" + $private:i)].Visible = $true;
    }
}

createWindows;

In the GUI you might easily see all of them by clicking a triangle, allowing you to make a list of all open documents:

To clean up the document list is also simply, even somewhat simpler that to fill up:

function removeWindows
{
for($private:i = 0; $private:i -lt $imagesList.Count; $private:i++)
{
Remove-SEToolWindow -WindowName ("aaaaa" + $private:i);
}
}

removeWindows;

 

Requirements: PSDevStudioLite.SuiteCore 1.0.0.4 Beta and higher, PSDevStudioLite.ObjetBrowser 1.0.0.4 Beta ang higher.

http://www.box.net/shared/ot56ct7ngl

Note: all above are never be supported by quest, wasn’t and won’t be.

Advertisements