We all love PowerShell, because it is great tool for automation and creating scripts.
Sometimes GUI’s are useful too, sometime for fun and sometime it good to write our own tool for the company users.
Like creating a GUI toll about the information of users, disk space, or whatever you think of.
I use “PowerShell Studio 2012” for creating GUI’s. It is one of the best tool available out there for creating GUI’s, but unfortunate it is a paid one.
You can download the evaluation version of PowerShell Studio 2012 from this link : http://www.sapien.com/software/primalforms
I am writing these post by using “PowerShell Studio 2012”, but logic behind it is same.
As in GUI we are going to use Button, labels etc, and the functionality of these are same, in spite of how you are creating them.
Creating Form.
To create a new blank form,
1. Open PowerShell studio
2. Click on “New”
3. And click on “New Form”
5. It will show you few templates, choose one as per you need.
6. I am selecting “Empty Form”. And Click on “Select”
Form
Now, You, will see 3 screens, one is containing “Toolbox” which contain all graphic elements, in middle we have our new black form, and the third one the “Properties” windows. If you click any element, properties windows shows that element’s properties.
Customise form.
Now, let’s customize our form.
Changing form name.
To change the name of the form, click on the form, and in the property window , you see the “Text” field and in the front of it, you will see the value of the form, change is as per your need.
I am changing the value to “My First Form”.
You can see that the name of the form is changed.
Setting Transparency.
Sometime, you may want to look you form fancy, and a little bit transparent, to set the transparency of the form , we use the “Opacity” field of the form properties, by default it is set to 100%. You can set it you any values below 100% as per your needs.
I am changing the opacity of the form to 50%
Now run the file and you can see how transparent our form became.
Keep your form always to the top.
If you want to keep your GUI form, always on the top of the other windows, change the “Top Most” value to “false” to ”true”.
Changing form background.
Changing background colour.
To change the background colour for the form, click on “BackColor” under “Appearance” tab and and choose the colour which you like to have in you form.
Using image as background.
We can also use the image as background, , under “appearance” tab, click on “BackgroundImage”, and click on browse icon, and select the image which you want to use as background image.
Choose the image and click on “Open”
Now you can see that background image is set, and you can also set the “background image layout” to “Tile,Center,Stretch,zoom” by clicking on “BackgroundImageLayout” field properties.
That’s all for today. See you in next post.
Regards
Aman Dhally
There is a free Community Edition for download on Sapien's web site.
ReplyDelete