zoukankan      html  css  js  c++  java
  • dotnet listview 删除操作的小范例

    --在写把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

  • 相关阅读:
    QR码与DM码的对比
    JBPM在Eclipse中运行时页面错误ProcessEngine cannot be resolved to a type
    C. A Mist of Florescence
    B. A Tide of Riverscape
    A. A Blend of Springtime
    A. Gennady the Dentist
    D. Lizard Era: Beginning
    E. Jzzhu and Apples
    D. Jzzhu and Cities
    C. Jzzhu and Chocolate
  • 原文地址:https://www.cnblogs.com/softimagewht/p/2359536.html
Copyright © 2011-2022 走看看