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.
Locked
User avatar
painter
Posts: 4
Joined: Fri Aug 27, 2010 3:12 pm

3d look of form elements

Post by painter » Fri Aug 27, 2010 3:12 pm

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: 7209
Joined: Tue May 29, 2007 4:43 pm

3d look of form elements

Post by Alexander Riedel » Sat Aug 28, 2010 7:34 am

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
Joined: Fri Aug 27, 2010 3:12 pm

3d look of form elements

Post by painter » Sat Aug 28, 2010 8:18 pm

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
Joined: Fri Aug 27, 2010 3:12 pm

3d look of form elements

Post by painter » Sat Aug 28, 2010 11:06 pm

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: 7209
Joined: Tue May 29, 2007 4:43 pm

3d look of form elements

Post by Alexander Riedel » Sun Aug 29, 2010 5:12 am

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
Joined: Fri Aug 27, 2010 3:12 pm

3d look of form elements

Post by painter » Sun Aug 29, 2010 9:27 pm

Thanks for the help and an excellent program.
PrimalForms awsome.

Locked