3d look of form elements

This forum can be browsed by the general public. Posting is no longer allowed as the product has been discontinued.
This topic is 13 years and 6 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.
User avatar
painter
Posts: 4
Last visit: Sun Aug 29, 2010 9:27 pm

3d look of form elements

Post by painter »

Hi,

I have created a simple one button form with PrimalForms (Community Edition) v1.0.8.0

When I open it from the Powershell ISE the button has rounded corners and a 3D look.

When I open the form straight with powershell the button is boxey and plain.

I have XP SP3.

Any tips?

Thanks
User avatar
Alexander Riedel
Posts: 8479
Last visit: Thu Mar 28, 2024 9:29 am
Answers: 19
Been upvoted: 37 times

3d look of form elements

Post by Alexander Riedel »

That is a pretty common occurance. The visual design of standard windows controls depends on which version of common controls is loaded.




Modern applications use a manifest to pull in a new version of those controls. Older applications, applications without manifest (e.g. console applications) or applications meant to be compatible with previous Windows versions don't do that.






Please refer to these articles:
http://www.sapien.com/blog/2009/01/15/s ... -features/
http://www.sapien.com/blog/2008/09/07/w ... -manifest/
http://www.sapien.com/blog/2008/09/05/s ... manifests/
Alexander Riedel
SAPIEN Technologies, Inc.
User avatar
painter
Posts: 4
Last visit: Sun Aug 29, 2010 9:27 pm

3d look of form elements

Post by painter »

Hi, Thanks for the info.

So, to get the more modern GUI look and feel I need a manifest.
And to use a manifest, the code must be run from an exe.

I don't want to package my scripts, so can you confirm there is no point investigating this further?

Cheers. painter2010-08-29 03:18:56
User avatar
painter
Posts: 4
Last visit: Sun Aug 29, 2010 9:27 pm

3d look of form elements

Post by painter »

Actually I found adding the following in bold under this section worked
(and I did not have to run powershell -sta as stated where I found the tip)

#region Import the Assemblies[reflection.assembly]::loadwithpartialname("System.Drawing") | Out-Null[reflection.assembly]::loadwithpartialname("System.Windows.Forms") | Out-Null
[System.Windows.Forms.Application]::EnableVisualStyles()

Can you see this causing any problems?
User avatar
Alexander Riedel
Posts: 8479
Last visit: Thu Mar 28, 2024 9:29 am
Answers: 19
Been upvoted: 37 times

3d look of form elements

Post by Alexander Riedel »

Yes, you are correct, I forgot about that call. It shouldn't have any side effects. The STA flag usually depends more on what type of control you use rather than how it is drawn.
As far as I recall file dialogs and some grids require STA.
Alexander Riedel
SAPIEN Technologies, Inc.
User avatar
painter
Posts: 4
Last visit: Sun Aug 29, 2010 9:27 pm

3d look of form elements

Post by painter »

Thanks for the help and an excellent program.
PrimalForms awsome.
This topic is 13 years and 6 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.