Page 1 of 5

GUI - Display data - table format - color? how?

Posted: Sun Nov 04, 2018 2:56 pm
by lontru
Hi

How do i view data like this gui below in powershell studio? table with formatted headers?

Image

Re: GUI - Display data - table format - color? how?

Posted: Sun Nov 04, 2018 3:02 pm
by jvierra
Only two choices. Either use a RichTextBox control with custom output, use a DataGridView with custom painting and coloring or use ListView with custom building.

Re: GUI - Display data - table format - color? how?

Posted: Sun Nov 04, 2018 3:03 pm
by jvierra
There are really only three choices. Either use a RichTextBox control with custom output, use a DataGridView with custom painting and coloring or use ListView with custom building.

Re: GUI - Display data - table format - color? how?

Posted: Sun Nov 04, 2018 6:34 pm
by Alexander Riedel
You could generate HTML and use a browser view. But the control in the screenshot (.NET app) is most likely a Listview with groups.
A C# example is here: http://csharphelper.com/blog/2014/08/use-listview-groups-in-c/
Should be relatively easy to transfer.

Re: GUI - Display data - table format - color? how?

Posted: Sun Nov 04, 2018 6:56 pm
by jvierra
Ahh. yes. The web browser would also be quite easy. I missed that one. To get colored headers and other styles use a CSS style sheet.

The bigger issue is that the example shows a list and not a table. This may be a misuse of nomenclature and a list is what is required. If a table is really what you want then it would have one very wide row which would not be very useful visually. It is a table if you really do want to show a table of properties and values. My guess is that the control being used is a DataGridView. If that is true then you can just set the headers colors and make rows alternate colors for readability.

"ExportTo-Csv" can build a colorized list fairly easily.

Re: GUI - Display data - table format - color? how?

Posted: Sun Nov 04, 2018 7:30 pm
by jvierra
After another look at the image I agree with Alex. It is likely a grouped ListView.

Re: GUI - Display data - table format - color? how?

Posted: Mon Nov 05, 2018 12:33 am
by lontru
Thanks for all the feedback im looking into your suggestions

Re: GUI - Display data - table format - color? how?

Posted: Mon Nov 05, 2018 2:21 pm
by lontru

Code: Select all

$button_search_Click={
	Add-ListViewItem -ListView $listview_systeminfo -Items "Computer Name" -Group "General" -ImageIndex 0 -SubItems "General"
	Add-ListViewItem -ListView $listview_systeminfo -Items "User" -Group "General" -ImageIndex 0 -SubItems "General"
	Add-ListViewItem -ListView $listview_systeminfo -Items "Last Restart" -Group "General" -ImageIndex 0 -SubItems "General"
}

Image

not getting the expected result want to format is like the exsample above.

Property;Value?

How do i provide the value with the property?

Re: GUI - Display data - table format - color? how?

Posted: Mon Nov 05, 2018 2:30 pm
by jvierra
You have to add items that have subitems with those names.

Re: GUI - Display data - table format - color? how?

Posted: Thu Nov 08, 2018 3:43 pm
by lontru
Image

Got a little further since I posted.

Is there a way to get the data in the listview
Want to make a button to export the data to a file