Beispiel #1
0
 /// <summary>
 /// 显示
 /// </summary>
 public override void showDialog()
 {
     if (m_collectionName == "TabPages")
     {
         FCTabControl     tabControlA = m_target as FCTabControl;
         List <FCTabPage> tabPages    = tabControlA.getTabPages();
         int tabPagesSize             = tabPages.Count;
         for (int i = 0; i < tabPagesSize; i++)
         {
             FCTabPage  tabPage = tabPages[i];
             FCTreeNode node    = new FCTreeNode();
             node.setString(tabPage.Text);
             m_tvCollection.appendNode(node);
             node.Row.Tag = tabPage;
         }
     }
     else if (m_collectionName == "Columns")
     {
         FCGrid grid = m_target as FCGrid;
         List <FCGridColumn> columns = grid.getColumns();
         int columnsSize             = columns.Count;
         for (int i = 0; i < columnsSize; i++)
         {
             FCGridColumn column = columns[i];
             FCTreeNode   node   = new FCTreeNode();
             node.setString(column.Text);
             m_tvCollection.appendNode(node);
             node.Row.Tag = column;
         }
     }
     m_tvCollection.update();
     m_gridSelectedRowsChangedEvent = new FCEvent(gridSelectedRowsChanged);
     m_gridProperty.Xml             = m_xml;
     m_gridProperty.DesignerDiv     = m_designerDiv;
     m_tvCollection.addEvent(m_gridSelectedRowsChangedEvent, FCEventID.GRIDSELECTEDROWSCHANGED);
     if (m_tvCollection.getRows().Count > 0)
     {
         ArrayList <FCGridRow> selectedRows = new ArrayList <FCGridRow>();
         selectedRows.Add(m_tvCollection.getRow(0));
         m_tvCollection.SelectedRows = selectedRows;
     }
     base.showDialog();
 }
Beispiel #2
0
 /// <summary>
 /// 拖动中方法
 /// </summary>
 public override void onDragging()
 {
     base.onDragging();
     if (m_grid != null)
     {
         ArrayList <FCGridColumn> columns = m_grid.getColumns();
         int columnSize = columns.size();
         for (int i = 0; i < columnSize; i++)
         {
             FCGridColumn column = columns.get(i);
             if (column == this)
             {
                 FCGridColumn lastColumn = null;
                 FCGridColumn nextColumn = null;
                 int          lastIndex  = i - 1;
                 int          nextIndex  = i + 1;
                 while (lastIndex >= 0)
                 {
                     FCGridColumn thatColumn = columns.get(lastIndex);
                     if (thatColumn.Visible)
                     {
                         lastColumn = thatColumn;
                         break;
                     }
                     else
                     {
                         lastIndex--;
                     }
                 }
                 while (nextIndex < columnSize)
                 {
                     FCGridColumn thatColumn = columns.get(nextIndex);
                     if (thatColumn.Visible)
                     {
                         nextColumn = thatColumn;
                         break;
                     }
                     else
                     {
                         nextIndex++;
                     }
                 }
                 //交换列
                 FCNative native  = Native;
                 int      clientX = native.clientX(this);
                 if (lastColumn != null)
                 {
                     int lastClientX = native.clientX(lastColumn);
                     if (clientX < lastClientX + lastColumn.Width / 2)
                     {
                         columns.set(lastIndex, this);
                         columns.set(i, lastColumn);
                         m_grid.update();
                         break;
                     }
                 }
                 if (nextColumn != null)
                 {
                     int nextClientX = native.clientX(nextColumn);
                     if (clientX + column.Width > nextClientX + nextColumn.Width / 2)
                     {
                         columns.set(nextIndex, this);
                         columns.set(i, nextColumn);
                         m_grid.update();
                         break;
                     }
                 }
                 break;
             }
         }
     }
 }