listview items changing adding subitem with forecolor

Ask questions about creating Graphical User Interfaces (GUI) in PowerShell and using WinForms controls.
Forum rules
Do not post any licensing information in this forum.

Any code longer than three lines should be added as code using the 'Select Code' dropdown menu or attached as a file.
This topic is 3 years and 2 months old and has exceeded the time allowed for comments. Please begin a new topic or use the search feature to find a similar but newer topic.
Locked
crunchingnumbers
Posts: 3
Last visit: Sun Apr 07, 2024 11:17 am

listview items changing adding subitem with forecolor

Post by crunchingnumbers »

To help you better we need some information from you.

*** Please fill in the fields below. If you leave fields empty or specify 'latest' rather than the actual version your answer will be delayed as we will be forced to ask you for this information. ***

Product, version and build: 2021 5.8.183
Operating system: windows 10 x64
PowerShell version(s): 5-7

Code: Select all

        [Codebox=html5 file=Untitled.html][/Codebox]   [quote]Anyone got an example of this from Sapien to set the forecolor for a subitem 
                 The only important property you need to set for a ListViewSubItemis the Text property.
                 Via the Script Editor:
                 The SubItems property has the following methods to add ListViewSubItems:
                 [ListViewSubItem] Add ([ListViewSubItem] item)
                 Adds an existing ListViewItem.ListViewSubItem to the collection.
                 [ListViewSubItem] Add ([String] text)
                 Adds a subitem to the collection with specified text.
                 [ListViewSubItem] Add ([String] text, [Color] foreColor, [Color] backColor, [Font] font)
                 Adds a subitem to the collection with specified text, foreground color, background color, and font settings.[/quote]
                   [b]     Example Use: 
                        $subItem = $listitem.SubItems.Add('Installed')
[/b]

$ListViewItem.SubItems.add($Status) works no problem.
$ListViewItem.SubItems.add($Status, $Color, $Color, $Font) - does not do anything other than se the $status value as if the remaining parms did not exist.

I have scoured the web and all I could find was MS doc guidance which regardless of language doesn't work either.
User avatar
brittneyr
Site Admin
Posts: 1670
Last visit: Tue Apr 16, 2024 7:31 am
Answers: 39
Been upvoted: 31 times

Re: listview items changing adding subitem with forecolor

Post by brittneyr »

[Topic moved to PowerShell GUIs forum by moderator]
Brittney
SAPIEN Technologies, Inc.
This topic is 3 years and 2 months old and has exceeded the time allowed for comments. Please begin a new topic or use the search feature to find a similar but newer topic.
Locked