Create Themes?

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.
jvierra
Posts: 13882
Joined: Tue May 22, 2007 9:57 am
Contact:

Re: Create Themes?

Post by jvierra » Wed Apr 10, 2019 2:07 pm

Ok David. Drop a hint. Which method are you working on???

Sounds good to me so far.

User avatar
JohnTitor
Posts: 153
Joined: Fri Nov 17, 2017 8:49 pm

Re: Create Themes?

Post by JohnTitor » Wed Apr 10, 2019 2:13 pm

I did see this..

https://twitter.com/jbirley/status/1113588744286871552

Either way, I'm excited. Like jvierra said we need hints!

User avatar
davidc
Posts: 5913
Joined: Thu Aug 18, 2011 4:56 am

Re: Create Themes?

Post by davidc » Wed Apr 10, 2019 2:21 pm

Just in regards to themes and WinForms. Nothing too fancy.
David
SAPIEN Technologies, Inc.

jvierra
Posts: 13882
Joined: Tue May 22, 2007 9:57 am
Contact:

Re: Create Themes?

Post by jvierra » Wed Apr 10, 2019 2:25 pm

Here is a themer on steroids for WinForms https://www.codeproject.com/Articles/75 ... rms-Themes

There are quite few using various methods. Most work at the compiler level which is actually easy to build in Visual Studio using either a settings file or a custom XML file. XML can be databound to forms.

I just use the XML and walk the XML hierarchy and use the tags, names and properties to apply customization.

All of these methods are not true themes but allow most customizations. Getting fancy in PS requires al lot of "paint" overrides.

It would be excellent if Sapien would work on implementing support for data binding and for adding third party controls.

jvierra
Posts: 13882
Joined: Tue May 22, 2007 9:57 am
Contact:

Re: Create Themes?

Post by jvierra » Wed Apr 10, 2019 2:46 pm

When the PSF files were all XML I would just cut the XML and place it in a new file then edit it to add property changes. I can't find that old project. I guess PSFs have not been XML for quite some time.

jvierra
Posts: 13882
Joined: Tue May 22, 2007 9:57 am
Contact:

Re: Create Themes?

Post by jvierra » Wed Apr 10, 2019 2:49 pm

Here is a part of an old PFF file. It cn be easily bulk edited to allow it to be used as a base for a style setter.

Code: Select all

<FileID>a71c33c8-f804-404b-8d3b-e67696b5e014</FileID>
  <FileVersion>1.2</FileVersion>
  <Object type="System.Windows.Forms.Form, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" name="form1" children="Controls">
    <Property name="AcceptButton">
      <Reference name="buttonOK" />
    </Property>
    <Property name="ClientSize">284, 262</Property>
    <Property name="FormBorderStyle">FixedDialog</Property>
    <Property name="MaximizeBox">False</Property>
    <Property name="MinimizeBox">False</Property>
    <Property name="Name">form1</Property>
    <Property name="StartPosition">CenterScreen</Property>
    <Property name="Text">Form</Property>
    <Event name="Load">FormEvent_Load</Event>
    <Object type="System.Windows.Forms.Button, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" name="buttonDisable" children="Controls">
      <Property name="Font">Microsoft Sans Serif, 8.25pt, style=Bold</Property>
      <Property name="Location">177, 42</Property>
      <Property name="Name">buttonDisable</Property>
      <Property name="Size">75, 23</Property>
      <Property name="TabIndex">3</Property>
      <Property name="Text">Disable</Property>
      <Property name="UseVisualStyleBackColor">True</Property>
      <Event name="Click">buttonDisable_Click</Event>
    </Object>
  
The plus is all of the controls ae in the correct hierarchy and many of the properties can be set at runtime. The XML was a good bootstrap.

jvierra
Posts: 13882
Joined: Tue May 22, 2007 9:57 am
Contact:

Re: Create Themes?

Post by jvierra » Wed Apr 10, 2019 3:03 pm

JohnTitor wrote:
Wed Apr 10, 2019 2:13 pm
I did see this..

https://twitter.com/jbirley/status/1113588744286871552

Either way, I'm excited. Like jvierra said we need hints!
Yup. Got that from the Team blog last week. It will be the first version that can truly run cross-platform with few limitations. Soon no more 5.1.

Locked