[Closed] exposing parameters for dotnet objects
Applying ‘showproperties’,‘showmethods’, ‘showevents’, exposes all of the dotnet controls to a degree, but how do I get their parameters/values etc…for example, I know button.forecolor obviously requires ((dotNetClass “System.Drawing.Color”).FromArgb r g b), and the booleans are clearly true or false or off and on ; but what about things like : .FlatAppearance , FlatStyle , BackgroundImag ,BackgroundImageLayout ,BindingContext ,Bottom ,Disposing ,Dock , etc etc ? To date I have been getting by by examining other peoples scripts, but this gets tiring. I dont want to go online everytime to look at pages of documentation, is there an easier way? Thnx for your time and patience.
for most properties you can use the property itself to create a new instance of a class / enum.
eg:
panel = dotnetobject "System.Windows.Forms.Panel"
panel.FlatStyle = panel.FlatStyle.Flat
instead of:
panel.FlatStyle = (dotnetclass "System.Windows.Forms.FlatStyle").Flat
also using methods:
panel.BackColor = panel.BackColor.FromARGB r g b
yes but in those cases where I don’t know how to set the property, like ‘BackgroundImageLayout ’ for example, what can I do?
In most cases this script will give you all informations that related to specific dotnet control.
But MSDN Lib will help you to find out how to properly use each ctrl
Show DotNet Property
setting BackgroundImageLayout is no different to FlatStyle
panel.BackgroundImageLayout = panel.BackgroundImageLayout.Stretch
if by “don’t know how” you mean you don’t know what it is for, then you have to look it up in the docs just like you do with maxscript.
Google BackgroundImageLayout. Click first link (MSDN Control.BackgroundImageLayout Property). You will see the property type is “System.Windows.Forms.ImageLayout”. Click the link to it. There’s your info. < 2 seconds. Same logic can be applied to most things.
Thnx guys. I guess the answer is – no you can’t – go to the documentation…that’s all i really needed to confirm. The thing is, I don’t as a matter of policy, have web enabled on the same partition as my work…too many dangers, so I have to go from one start up to another to access web stuff. tedious.
If you install microsoft visual studio express (free), you can download offline versions of the .Net documentation.
You can extract a whole load of information without even having to go to a help file, but If you are struggling with this, it wouldn’t hurt. A simple showproperties call on the class returned by the property is enough in this case.
show (dotnetobject "panel")
....
.BackgroundImageLayout : <System.Windows.Forms.ImageLayout>
......
show (dotnetclass "ImageLayout")
....
.Center : <System.Windows.Forms.ImageLayout>, read-only, static
.None : <System.Windows.Forms.ImageLayout>, read-only, static
.Stretch : <System.Windows.Forms.ImageLayout>, read-only, static
.Tile : <System.Windows.Forms.ImageLayout>, read-only, static
.Zoom : <System.Windows.Forms.ImageLayout>, read-only, static
......
panel.BackgroundImageLayout = panel.BackgroundImageLayout.Stretch
the information is all there – You just need to decifer it. For example, a static class in dotnet does not need to be instantiated. So you will use the class and not an object (like you do with dotnet colours, which is also a static class)
If you need to get the terminology straight, I wrote a dotnet 101 a while back. It explains step by step on how dotnet works and how to get the information that you need when you’re stumped.
For me, I use visual studio like Lo says – just create the ui element in a new project and view the designer file that gets generated.
Ah yes, thnx pete – that’s more or less what I was looking for. Very helpful. I have read yr dotnet101. Waiting for dotnet 201… thnx guys.