Notifications
Clear all
[Closed] Create buttons at routime
Page 2 / 2
Prev
Nov 30, 2009 11:13 am
Yes yes Cyfer i know… it will be beter with maxCustomControls ,
but in 3DsMax9 they are not implemented yet.
keyboard entry can be handled with on focus enableAccelerators = false
max min size is the properties in System.windows.form to
form.MinimumSize : <System.Drawing.Size>
form.MaximumSize : <System.Drawing.Size>
Nov 30, 2009 11:13 am
nop , I tryed but I can’t
- how to set grid size ? (there I found only some autosize property)
- how to disable labels editing? (read only)
- to use every cel as button (not found)
- how to load icons in the cells (not found)
fn netDrRect pos size =
(
dotnetObject "Drawing.Rectangle" pos.x pos.y size.x size.y
)
try fo.close() catch()
fo = dotnetobject "form"
fo.Height = 100+58+20
fo.Width = 200+10+20
gri= dotnetobject "DataGridView"
gri.Bounds = netDrRect [0, 20] [200, 100]
gri.ColumnCount = 6
gri.RowCount = 3
gri.GridColor = gri.GridColor.fromARGB 216 71 32
gri.backcolor = gri.GridColor.fromARGB 202 227 32
gri.ColumnHeadersHeight = 4
gri.RowHeadersWidth = 4
gri.AllowUserToResizeColumns = false
gri.AllowUserToResizeRows = false
--gri.RowHeadersVisible = false
--gri.ColumnHeadersVisible = false
gri.AutoResizeColumns()
gri.AutoResizeRows()
fo.controls.add(gri)
fo.show()
-Im looking for a way to create a fom filed with buttons with icons on them , which will be fastest than my first version.
-Two controllers Botom and right , which can add or remove rows/columns like in the picture.
Nov 30, 2009 11:13 am
dataGridView with buttons:
try(form.close()) catch()
form = dotnetobject "MaxCustomControls.Maxform"
--form = dotnetobject "Form"
form.size = dotnetobject "System.Drawing.Size" 200 300
addc = dotnetobject "Button"
addc.text = "Add Cell"
addc.Dock = addc.Dock.Top
delc = dotnetobject "Button"
delc.text = "Remove Cell"
delc.Dock = addc.Dock.Top
addr = dotnetobject "Button"
addr.text = "Add Row"
addr.Dock = addc.Dock.Top
delr = dotnetobject "Button"
delr.text = "Remove Row"
delr.Dock = addc.Dock.Top
gv = dotnetobject "DataGridView"
bc = dotNetObject "System.Windows.Forms.DataGridViewButtonColumn"
/* Flat Settings */
bc.DefaultCellStyle.BackColor = bc.DefaultCellStyle.BackColor.Beige
bc.FlatStyle = bc.FlatStyle.Flat
fn addcell s a =
(
gv = s.parent.controls.item[0]
gv.SuspendLayout()
gv.columns.add (bc.clone())
gv.ResumeLayout()
)
dotNet.addEventHandler addc "Click" addcell
fn delcell s a =
(
gv = s.parent.controls.item[0]
gv.SuspendLayout()
gv.ColumnCount = amax (gv.ColumnCount-1) 1
gv.ResumeLayout()
)
dotNet.addEventHandler delc "Click" delcell
fn addrow s a =
(
gv = s.parent.controls.item[0]
gv.SuspendLayout()
s.parent.controls.item[0].RowCount += 1
gv.ResumeLayout()
)
dotNet.addEventHandler addr "Click" addrow
fn delrow s a =
(
gv = s.parent.controls.item[0]
gv.SuspendLayout()
gv.RowCount = amax (gv.RowCount-1) 1
gv.ResumeLayout()
)
dotNet.addEventHandler delr "Click" delrow
fn CellClick s a =
(
cell = s.rows.item[a.rowindex].cells.item[a.columnindex]
format "button: %
" cell.value
)
fn updateDridView s a =
(
gv.SuspendLayout()
for r=0 to s.RowCount-1 do for i=0 to s.ColumnCount-1 do
(
cell = s.rows.item[r].cells.item[i]
v = r*s.ColumnCount + i
if cell.value != v do cell.value = v
)
gv.ResumeLayout()
)
gv.ColumnHeadersDefaultCellStyle.Alignment = gv.ColumnHeadersDefaultCellStyle.Alignment.MiddleCenter
gv.ReadOnly = on
gv.MultiSelect = off
dotNet.addEventHandler gv "ColumnAdded" updateDridView
dotNet.addEventHandler gv "ColumnRemoved" updateDridView
dotNet.addEventHandler gv "RowsAdded" updateDridView
dotNet.addEventHandler gv "RowsRemoved" updateDridView
dotNet.addEventHandler gv "CellClick" CellClick
gv.Dock = gv.Dock.Fill
gv.RowTemplate.Height = 40
gv.AutoSize = on
gv.AutoSizeColumnsMode = gv.AutoSizeColumnsMode.Fill
gv.AutoSizeRowsMode = gv.AutoSizeRowsMode.AllCells
gv.RowHeadersWidthSizeMode = gv.RowHeadersWidthSizeMode.EnableResizing
gv.columns.add (bc.clone())
gv.columns.add (bc.clone())
gv.RowCount = 2
gv.ColumnHeadersVisible = gv.ShowEditingIcon = gv.RowHeadersVisible = off
gv.AllowUserToAddRows = gv.AllowUserToDeleteRows = gv.AllowUserToResizeColumns = off
gv.AllowUserToResizeRows = on
form.controls.addrange #(gv, delr, addr, delc, addc)
form.showmodeless()
--form.show()
Nov 30, 2009 11:13 am
how did you do that 😮 , thats wery nice! and looking so simple.
I have much to learn from you Denis
Page 2 / 2
Prev