--在写把ACTIVE转为DOTNET代码的时候遇到一个问题 ,用.net的函数做删除列操作一直在报错,但在VS编译应用没问题~
--最后找到了解决办法~遇到的朋友可以了解下
rollout listview_rollout "ListView Selected"
(
fn initListView lv =
(
lv.gridLines = true
lv.View = (dotNetClass "System.Windows.Forms.View").Details
lv.fullRowSelect = true --same as in ActiveX
layout_def = #("Object Name", "Object Class", "Verts", "Faces", "Material")
for i in layout_def do
lv.Columns.add i 96
)
fn fillInSpreadSheet lv =
(
theRange = #()
for o in selection do
(
li = dotNetObject "System.Windows.Forms.ListViewItem" o.name
sub_li = li.SubItems.add ((classof o) as string)
sub_li = li.SubItems.add (try((o.mesh.numverts) as string)catch("--"))
sub_li = li.SubItems.add (try((o.mesh.numfaces) as string)catch("--"))
sub_li = li.SubItems.add ((o.material) as string)
append theRange li
)
lv.Items.AddRange theRange
)
function GetSelectedIndex lv =
(
local result = -1
if (lv.SelectedIndices.count == 1) then
(
result = lv.SelectedIndices.item[0]
)
result
)
function DeleteLvItem lv index =
(
if (index != undefined) and (index >= 0) and (index < lv.Items.count) then
(
lv.items.removeat index
)
)
dotNetControl lv_objects "System.Windows.Forms.ListView" 490 height:190 align:#center
button tt "tt"
on listview_rollout open do
(
initListView lv_objects
fillInSpreadSheet lv_objects
)
on tt pressed do
(
tempIndex = (GetSelectedIndex lv_objects)
DeleteLvItem lv_objects tempIndex
)
)
try(destroyDialog listview_rollout)catch()
createDialog listview_rollout 500 300