create dotnetcontrol buttons inside function

I want to create buttons depending on certain things!
So here is what I need:

fn myfunction=
(
...
 
for i=1 to IDcount do
(
     dotnetcontrol ID_btn[i] "System.Windows.Forms.Button" width:20 height:60 pos:[27,i*153]
     ID_btn[i].backcolor  = (dotnetcolor 70 70 70)
     ID_btn[i].flatstyle = dotnetobject "System.Windows.Forms.FlatStyle" Flat
     ID_btn[i].text="1"
     ID_btn[i].foreColor = (dotnetcolor 200 200 200)
)
)

How to make it work?

Comments

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
barigazy's picture

It's very difficult to

It's very difficult to perform. Now there's nothing I can think of. I will probably tried to add different beckcolor of DataGrid row. For example red rows will represent multimaterial, green VRayMaterial, gray Standard etc. This is just en idea.

barigazy

artrender.info's picture

does it mean that I need to use just 2 columns?

to receive my result?
Is it possible with using this to get this:
http://www.scriptspot.com/files/wanted.jpg ?

barigazy's picture

...

I not know, I've never tried something like this. You can use first column for material names and second for numbers but you know best what you need.

barigazy

artrender.info's picture

Barigazy

When do you sleep?

barigazy's picture

I finish some project right

I finish some project right now. :) I can't sleep, maybe later :)

barigazy

artrender.info's picture

I think it's much better approach to my wish

but how to split horizontally the right panel?

try(destroyDialog testR)catch()
rollout testR "Test" width:400 height:400
(
	dotnetcontrol pn "MaxCustomControls.MaxUserControl" pos:[5,5] 
 
	on testR open do 
	(
		--pn.backcolor = pn.backcolor.black
		pn.backcolor = (dotNetClass "System.Drawing.Color").fromARGB (((colorMan.getColor #background) * 255)[1] as integer) (((colorMan.getColor #background) * 255)[2] as integer) (((colorMan.getColor #background) * 255)[3] as integer)
		--pn.BorderStyle = pn.BorderStyle.FixedSingle
		pn.width = 390 ; pn.height = 390 
		sp = dotnetobject "SplitContainer" 
		sph = dotnetobject "SplitContainer" 
		--sp.dock = sp.dock.fill
		sp.width = 378 ; sp.height = 378
		sph.width = 185 ; sph.height = 378
		sp.Location = dotNetObject "System.Drawing.Point" (pn.pos.x) (pn.pos.y)
		sph.Location = dotNetObject "System.Drawing.Point" (pn.pos.x+185) (pn.pos.y)
		--sp.splitterWidth = 2
		sp.panel1.backColor = sp.panel1.backColor.DarkGray
		--sp.panel2.backColor = sp.panel1.backColor.LightGray
		sph.panel1.backColor = sph.panel1.backColor.Darkblue
		--sp.Panel1Collapsed = true
		sp.Panel1MinSize = sp.width/2
		sph.Panel1MinSize = sph.height/2
		sph.Orientation = sph.Orientation.Horizontal
		--sp.SplitterDistance = 100--pn.width/2
		pn.controls.add sp
                pn.controls.add sph
	)
)
createDialog testR

and how to make each part to work as buttons?

barigazy's picture

As its name implies, these

As its name implies, these control is Container. You need to put something inside, buttons or another container.

barigazy

artrender.info's picture

Thank you, barigazy!!!

I will try your code a bit later, now I'm working on a 3d project a little!

barigazy's picture

Split Container

Here is en example of Split Container control.Maybe this is beter solution then FLP

try(destroyDialog testR)catch()
rollout testR "Test" width:400 height:400
(
	dotnetcontrol pn "MaxCustomControls.MaxUserControl" pos:[5,5] 
 
	on testR open do 
	(
		pn.backcolor = pn.backcolor.black
		pn.BorderStyle = pn.BorderStyle.FixedSingle
		pn.width = 390 ; pn.height = 390 
		sp = dotnetobject "SplitContainer" 
		--sp.dock = sp.dock.fill
		sp.width = 378 ; sp.height = 378
		sp.Location = dotNetObject "System.Drawing.Point" (pn.pos.x) (pn.pos.y)
		sp.splitterWidth = 2
		sp.panel1.backColor = sp.panel1.backColor.DarkGray
		sp.panel2.backColor = sp.panel1.backColor.LightGray
		--sp.Panel1Collapsed = true
		sp.Panel1MinSize = sp.width/2
		--sp.SplitterDistance = 100--pn.width/2
		pn.controls.add sp
	)
)
createDialog testR

barigazy

artrender.info's picture

I've found such info

http://stackoverflow.com/questions/7741392/flowlayout-control-keeps-addi...

They said to set the WrapContents property to false

BitmapLister.FLP.WrapContent=false
BitmapLister.FLP.WrapContent.false
BitmapLister.FLP.WrapContent=BitmapLister.FLP.WrapContent.false
BitmapLister.FLP.WrapContent=FLP.WrapContent.false

all of them give error

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.