Notifications
Clear all

[Closed] Buttons in dotnet listview

Hi all,
I took a whole day to find an example of making a dotnet listview button via maxscript,but unlucky,I still don’t know how to do that,what I want is like below,any one has an example code to share?

2 Replies

use DataGridView instead of ListView


try(form.close()) catch()
form = dotnetobject "MaxCustomControls.Maxform"
form.Text = "Different Cells in the same Column"   
form.StartPosition = form.StartPosition.Manual
form.Location = dotnetobject "System.Drawing.Point" 200 100
form.Size = dotnetobject "System.Drawing.Size" 300 180
gv = dotnetobject "DataGridView"
   
gv.Dock = gv.Dock.Fill
gv.ColumnHeadersVisible = gv.ShowEditingIcon = gv.RowHeadersVisible = off   
gv.AllowUserToaddRows = gv.AllowUserToDeleteRows = off
gv.ColumnCount = 2
r0 = dotnetobject "DataGridViewRow"
c0 = dotnetobject "DataGridViewTextBoxCell"
c0.value = "Text"
c1 = dotnetobject "DataGridViewButtonCell"
c1.value = "Button"
r0.cells.AddRange #(c0,c1)
r1 = dotnetobject "DataGridViewRow"
c0 = dotnetobject "DataGridViewButtonCell"
c0.value = "Button" 
r1.cells.Add c0
r2 = dotnetobject "DataGridViewRow"
c0 = dotnetobject "DataGridViewComboBoxCell"
c0.value = 0
c0.Items.Add "Combo"
r2.cells.Add c0
r3 = dotnetobject "DataGridViewRow"
c0 = dotnetobject "DataGridViewCheckBoxCell"
r3.cells.Add c0
gv.rows.Clear()
gv.rows.AddRange #(r0,r1,r2)
form.KeyPreview = on
form.controls.addrange #(gv)
form.showmodeless()

1 Reply
(@momo2012)
Joined: 11 months ago

Posts: 0

Thanks too much,works!