예제 #1
0
        /// <summary>
        /// 过滤查找
        /// </summary>
        public void filterSearch()
        {
            String sText = m_searchTextBox.Text.ToUpper();

            m_grid.beginUpdate();
            m_grid.clearRows();
            int row = 0;
            CList <Security> securities = SecurityService.FilterCode(sText);

            if (securities != null)
            {
                int rowCount = securities.size();
                for (int i = 0; i < rowCount; i++)
                {
                    Security  security = securities.get(i);
                    FCGridRow gridRow  = new FCGridRow();
                    m_grid.addRow(gridRow);
                    gridRow.addCell(0, new FCGridStringCell(security.m_code));
                    gridRow.addCell(1, new FCGridStringCell(security.m_name));
                    row++;
                }
            }
            securities.delete();
            m_grid.endUpdate();
        }
예제 #2
0
        /// <summary>
        /// 移除节点方法
        /// </summary>
        public virtual void onRemovingNode()
        {
            m_indent = 0;
            FCGridRow row = Row;

            if (row != null)
            {
                if (m_nodes != null && m_nodes.size() > 0)
                {
                    int nodeSize = m_nodes.size();
                    for (int i = 0; i < nodeSize; i++)
                    {
                        m_nodes.get(i).onRemovingNode();
                    }
                }
                m_tree.removeRow(row);
                row.clearCells();
                Row = null;
                ArrayList <FCGridRow> rows = m_tree.getRows();
                int rowSize = rows.size();
                for (int i = 0; i < rowSize; i++)
                {
                    rows.get(i).Index = i;
                }
                m_targetColumn = null;
            }
        }
예제 #3
0
        /// <summary>
        /// 单元格点击事件
        /// </summary>
        /// <param name="cell">单元格</param>
        /// <param name="mp">坐标</param>
        /// <param name="button">按钮</param>
        /// <param name="clicks">点击次数</param>
        /// <param name="delta">滚轮值</param>
        public override void onCellClick(FCGridCell cell, FCTouchInfo touchInto)
        {
            base.onCellClick(cell, touchInto);
            List <FCGridRow> rows = m_rows;
            int rowsSize          = rows.Count;

            for (int i = 0; i < rowsSize; i++)
            {
                FCGridRow         row   = rows[i];
                List <FCGridCell> cells = row.getCells();
                int cellsSize           = cells.Count;
                for (int j = 0; j < cellsSize; j++)
                {
                    FCGridControlCell cCell = cells[j] as FCGridControlCell;
                    if (cCell != null)
                    {
                        if (row == cell.Row)
                        {
                            cCell.Control.TextColor = FCDraw.FCCOLORS_TEXTCOLOR4;
                        }
                        else
                        {
                            cCell.Control.TextColor = FCColor.Text;
                        }
                    }
                }
            }
        }
예제 #4
0
        /// <summary>
        /// 表格选中行改变方法
        /// </summary>
        public void onGridSelectedRowsChanged()
        {
            ArrayList <FCTreeNode> selectedNodes = m_tvTypes.SelectedNodes;
            int selectedNodesSize = selectedNodes.Count;

            if (selectedNodesSize > 0)
            {
                FCTreeNode            node = selectedNodes[0];
                String                name = node.Name.Replace("node_", "");
                ArrayList <FCGridRow> rows = m_gridTemplate.m_rows;
                int rowsSize = rows.Count;
                ArrayList <FCGridRow> selectedRows = new ArrayList <FCGridRow>();
                if (name.IndexOf('_') != -1)
                {
                    String language = name.Substring(0, name.IndexOf('_'));
                    String platform = name.Substring(name.IndexOf('_') + 1);
                    for (int i = 0; i < rowsSize; i++)
                    {
                        FCGridRow row = rows[i];
                        if (row.getCell("COLT2").getString() == language &&
                            row.getCell("COLT3").getString() == platform)
                        {
                            if (selectedRows.Count == 0)
                            {
                                selectedRows.Add(row);
                            }
                            row.Visible = true;
                        }
                        else
                        {
                            row.Visible = false;
                        }
                    }
                }
                else
                {
                    for (int i = 0; i < rowsSize; i++)
                    {
                        FCGridRow row = rows[i];
                        if (row.getCell("COLT2").getString() == name)
                        {
                            if (selectedRows.Count == 0)
                            {
                                selectedRows.Add(row);
                            }
                            row.Visible = true;
                        }
                        else
                        {
                            row.Visible = false;
                        }
                    }
                }
                m_gridTemplate.VScrollBar.Pos = 0;
                m_gridTemplate.SelectedRows   = selectedRows;
                m_gridTemplate.update();
                m_gridTemplate.invalidate();
            }
        }
예제 #5
0
        /// <summary>
        /// 单元格触摸抬起方法
        /// </summary>
        /// <param name="cell">单元格</param>
        /// <param name="touchInfo">触摸信息</param>
        public override void onCellTouchUp(FCGridCell cell, FCTouchInfo touchInfo)
        {
            base.onCellTouchUp(cell, touchInfo);
            FCPoint mp = touchInfo.m_firstPoint;

            if (m_movingNode != null)
            {
                FCGridRow curRow = getRow(mp);
                //移动
                if (curRow != null)
                {
                    FCTreeNode curNode = curRow.getCell(0) as FCTreeNode;
                    if (curNode.AllowDragIn && m_movingNode != curNode)
                    {
                        FCTreeNode curNodeParent    = curNode.Parent;
                        FCTreeNode movingNodeParent = m_movingNode.Parent;
                        if (movingNodeParent != null)
                        {
                            movingNodeParent.removeNode(m_movingNode);
                        }
                        else
                        {
                            removeNode(m_movingNode);
                        }
                        //有父节点
                        if (curNodeParent != null)
                        {
                            if (movingNodeParent == curNodeParent)
                            {
                                curNodeParent.insertNode(curNodeParent.getNodeIndex(curNode), m_movingNode);
                            }
                            else
                            {
                                curNode.appendNode(m_movingNode);
                            }
                        }
                        //无父节点
                        else
                        {
                            if (movingNodeParent == curNodeParent)
                            {
                                insertNode(getNodeIndex(curNode), m_movingNode);
                            }
                            else
                            {
                                curNode.appendNode(m_movingNode);
                            }
                        }
                        curNode.expend();
                    }
                }
                m_movingNode = null;
                update();
            }
        }
예제 #6
0
        /// <summary>
        /// 选中行方法
        /// </summary>
        private void onSelectRow()
        {
            List <FCGridRow> rows = m_grid.SelectedRows;

            if (rows != null && rows.Count > 0)
            {
                FCGridRow selectedRow = rows[0];
                Security  security    = new Security();
                SecurityService.getSecurityByCode(selectedRow.getCell(0).Text, ref security);
                m_mainFrame.findControl("txtCode").Text = security.m_code;
                Visible = false;
                invalidate();
            }
        }
예제 #7
0
        /// <summary>
        /// 加载表格的模板
        /// </summary>
        /// <param name="node">节点</param>
        public static void GridTemplate(FCGrid grid, UIXmlEx xml, XmlNode node)
        {
            XmlDocument xmlDoc = node.OwnerDocument;

            grid.Size = new FCSize(200, 200);
            FCGridColumn column = new FCGridColumn("Column1");

            grid.addColumn(column);
            FCGridColumn column2 = new FCGridColumn("Column2");

            grid.addColumn(column2);
            grid.update();
            FCGridRow row = new FCGridRow();

            grid.addRow(row);
            FCGridStringCell cell = new FCGridStringCell();

            cell.setString("Cell1");
            row.addCell(0, cell);
            FCGridStringCell cell2 = new FCGridStringCell();

            cell2.setString("Cell2");
            row.addCell(1, cell2);
            grid.update();
            XmlNode columnsNode = xmlDoc.CreateNode(XmlNodeType.Element, "tr", "");

            node.AppendChild(columnsNode);
            XmlNode column1Node = xmlDoc.CreateNode(XmlNodeType.Element, "th", "");

            column1Node.InnerText = "Column1";
            columnsNode.AppendChild(column1Node);
            XmlNode column2Node = xmlDoc.CreateNode(XmlNodeType.Element, "th", "");

            column2Node.InnerText = "Column2";
            columnsNode.AppendChild(column2Node);
            XmlNode rowNode = xmlDoc.CreateNode(XmlNodeType.Element, "tr", "");

            node.AppendChild(rowNode);
            XmlNode cellNode1 = xmlDoc.CreateNode(XmlNodeType.Element, "td", "");

            rowNode.AppendChild(cellNode1);
            cellNode1.InnerText = "Cell1";
            XmlNode cellNode2 = xmlDoc.CreateNode(XmlNodeType.Element, "td", "");

            rowNode.AppendChild(cellNode2);
            cellNode2.InnerText = "Cell2";
        }
예제 #8
0
        /// <summary>
        /// 重绘方法
        /// </summary>
        /// <param name="paint">绘图对象</param>
        /// <param name="rect">矩形</param>
        /// <param name="clipRect">裁剪矩形</param>
        /// <param name="isAlternate">是否交替行</param>
        public override void onPaint(FCPaint paint, FCRect rect, FCRect clipRect, bool isAlternate)
        {
            int       clipW = clipRect.right - clipRect.left;
            int       clipH = clipRect.bottom - clipRect.top;
            FCGrid    grid  = Grid;
            FCGridRow row   = Row;

            if (clipW > 0 && clipH > 0 && grid != null && Column != null && row != null && TargetColumn != null)
            {
                int          width      = rect.right - rect.left;
                int          height     = rect.bottom - rect.top;
                int          scrollH    = 0;
                FCHScrollBar hscrollBar = grid.HScrollBar;
                if (hscrollBar != null && hscrollBar.Visible)
                {
                    scrollH = hscrollBar.Pos;
                }
                FCFont          font         = null;
                long            backColor    = FCColor.None;
                long            textColor    = FCColor.None;
                bool            autoEllipsis = m_tree.AutoEllipsis;
                FCGridCellStyle style        = Style;
                if (style != null)
                {
                    if (style.AutoEllipsis)
                    {
                        autoEllipsis = style.AutoEllipsis;
                    }
                    backColor = style.BackColor;
                    if (style.Font != null)
                    {
                        font = style.Font;
                    }
                    textColor = style.TextColor;
                }
                FCGridRowStyle rowStyle = grid.RowStyle;
                if (isAlternate)
                {
                    FCGridRowStyle alternateRowStyle = grid.AlternateRowStyle;
                    if (alternateRowStyle != null)
                    {
                        rowStyle = alternateRowStyle;
                    }
                }
                if (rowStyle != null)
                {
                    bool selected = false;
                    ArrayList <FCGridRow> selectedRows = grid.SelectedRows;
                    int selectedRowsSize = selectedRows.size();
                    for (int i = 0; i < selectedRowsSize; i++)
                    {
                        if (selectedRows[i] == row)
                        {
                            selected = true;
                            break;
                        }
                    }
                    if (backColor == FCColor.None)
                    {
                        //选中
                        if (selected)
                        {
                            backColor = rowStyle.SelectedBackColor;
                        }
                        //悬停
                        else if (Row == Grid.HoveredRow)
                        {
                            backColor = rowStyle.HoveredBackColor;
                        }
                        //普通
                        else
                        {
                            backColor = rowStyle.BackColor;
                        }
                    }
                    if (font == null)
                    {
                        font = rowStyle.Font;
                    }
                    if (textColor == FCColor.None)
                    {
                        //选中
                        if (selected)
                        {
                            textColor = rowStyle.SelectedTextColor;
                        }
                        //悬停
                        else if (Row == Grid.HoveredRow)
                        {
                            textColor = rowStyle.HoveredTextColor;
                        }
                        //普通
                        else
                        {
                            textColor = rowStyle.TextColor;
                        }
                    }
                }
                //绘制背景
                paint.fillRect(backColor, rect);
                FCRect headerRect = TargetColumn.Bounds;
                headerRect.left += Grid.HorizontalOffset - scrollH;
                headerRect.top  += Grid.VerticalOffset - scrollH;
                int left = headerRect.left;
                //绘制复选框
                if (m_tree.CheckBoxes)
                {
                    int    cw           = m_tree.CheckBoxSize.cx;
                    int    ch           = m_tree.CheckBoxSize.cy;
                    FCRect checkBoxRect = new FCRect();
                    checkBoxRect.left   = left;
                    checkBoxRect.top    = rect.top + (height - ch) / 2;
                    checkBoxRect.right  = checkBoxRect.left + cw;
                    checkBoxRect.bottom = checkBoxRect.top + ch;
                    onPaintCheckBox(paint, checkBoxRect);
                    left += cw + 10;
                }
                //绘制折叠展开的标志
                int nw = m_tree.NodeSize.cx;
                int nh = m_tree.NodeSize.cy;
                if (m_nodes.size() > 0)
                {
                    FCRect nodeRect = new FCRect();
                    nodeRect.left   = left;
                    nodeRect.top    = rect.top + (height - nh) / 2;
                    nodeRect.right  = nodeRect.left + nw;
                    nodeRect.bottom = nodeRect.top + nh;
                    onPaintNode(paint, nodeRect);
                }
                left    += nw + 10;
                m_indent = left;
                String text = getPaintText();
                //绘制文字
                if (text != null)
                {
                    FCSize tSize = paint.textSize(text, font);
                    FCRect tRect = new FCRect();
                    tRect.left   = left;
                    tRect.top    = rect.top + (row.Height - tSize.cy) / 2;
                    tRect.right  = tRect.left + tSize.cx;
                    tRect.bottom = tRect.top + tSize.cy;
                    if (autoEllipsis && (tRect.right < clipRect.right || tRect.bottom < clipRect.bottom))
                    {
                        if (tRect.right < clipRect.right)
                        {
                            tRect.right = clipRect.right;
                        }
                        if (tRect.bottom < clipRect.bottom)
                        {
                            tRect.bottom = clipRect.bottom;
                        }
                        paint.drawTextAutoEllipsis(text, textColor, font, tRect);
                    }
                    else
                    {
                        paint.drawText(text, textColor, font, tRect);
                    }
                }
            }
            onPaintControl(paint, rect, clipRect);
        }
예제 #9
0
        /// <summary>
        /// 添加节点
        /// </summary>
        /// <param name="index">行索引</param>
        public virtual void onAddingNode(int index)
        {
            FCGridRow row = Row;

            if (Row == null)
            {
                //创建行
                row = new FCGridRow();
                FCTreeNode parentNode = m_parent;
                if (parentNode == null)
                {
                    if (index != -1)
                    {
                        //插入行
                        m_tree.insertRow(index, row);
                        //重置行的索引
                        ArrayList <FCGridRow> rows = m_tree.getRows();
                        int rowSize = rows.size();
                        for (int i = 0; i < rowSize; i++)
                        {
                            rows.get(i).Index = i;
                        }
                    }
                    else
                    {
                        //添加行
                        m_tree.addRow(row);
                        //设置索引
                        ArrayList <FCGridRow> rows = m_tree.getRows();
                        row.Index = rows.size() - 1;
                    }
                    row.addCell(0, this);
                    m_targetColumn = m_tree.getColumn(0);
                }
                else
                {
                    //获取行索引
                    int rowIndex = parentNode.Row.Index + 1;
                    if (index != -1)
                    {
                        rowIndex = index;
                    }
                    else
                    {
                        //查找上个节点
                        FCTreeNode lastNode = getLastNode(parentNode.getChildNodes());
                        if (lastNode != null)
                        {
                            if (lastNode.Row == null)
                            {
                                return;
                            }
                            rowIndex = lastNode.Row.Index + 1;
                        }
                    }
                    //插入行
                    m_tree.insertRow(rowIndex, row);
                    ArrayList <FCGridRow> rows = m_tree.getRows();
                    int rowSize = rows.size();
                    //重置索引
                    if (rowIndex == rowSize - 1)
                    {
                        row.Index = rowIndex;
                    }
                    else
                    {
                        for (int i = 0; i < rowSize; i++)
                        {
                            rows.get(i).Index = i;
                        }
                    }
                    row.addCell(0, this);
                    m_targetColumn = m_tree.getColumn(parentNode.m_targetColumn.Index + 1);
                }
                ColSpan = m_tree.getColumns().size();
                //添加子节点
                if (m_nodes != null && m_nodes.size() > 0)
                {
                    int nodeSize = m_nodes.size();
                    for (int i = 0; i < nodeSize; i++)
                    {
                        m_nodes.get(i).onAddingNode(-1);
                    }
                }
                row.Visible = isNodeVisible(this);
            }
        }
예제 #10
0
        /// <summary>
        /// 创建表格行
        /// </summary>
        /// <param name="node">节点</param>
        /// <param name="control">控件</param>
        protected virtual void createGridRow(XmlNode node, FCView control)
        {
            FCGrid    grid = control as FCGrid;
            FCGridRow row  = new FCGridRow();

            grid.addRow(row);
            setAttributesBefore(node, row);
            //单元格
            int col = 0;

            foreach (XmlNode node3 in node.ChildNodes)
            {
                String subNodeName  = node3.Name.ToLower();
                String subNodeValue = node3.InnerText;
                if (subNodeName == "cell" || subNodeName == "td")
                {
                    String cellType = "string";
                    HashMap <String, String> attributes = getAttributes(node3);
                    if (attributes.containsKey("type"))
                    {
                        cellType = attributes.get("type");
                    }
                    attributes.clear();
                    FCGridCell cell = null;
                    if (cellType == "bool")
                    {
                        cell = new FCGridBoolCell();
                    }
                    else if (cellType == "button")
                    {
                        cell = new FCGridButtonCell();
                    }
                    else if (cellType == "checkbox")
                    {
                        cell = new FCGridCheckBoxCell();
                    }
                    else if (cellType == "combobox")
                    {
                        cell = new FCGridComboBoxCell();
                    }
                    else if (cellType == "double")
                    {
                        cell = new FCGridDoubleCell();
                    }
                    else if (cellType == "float")
                    {
                        cell = new FCGridFloatCell();
                    }
                    else if (cellType == "string")
                    {
                        cell = new FCGridStringCell();
                    }
                    else if (cellType == "int")
                    {
                        cell = new FCGridIntCell();
                    }
                    else if (cellType == "long")
                    {
                        cell = new FCGridLongCell();
                    }
                    else if (cellType == "textbox")
                    {
                        cell = new FCGridTextBoxCell();
                    }
                    row.addCell(col, cell);
                    setAttributesBefore(node3, cell);
                    cell.setString(subNodeValue);
                    setAttributesAfter(node3, cell);
                    col++;
                }
            }
            setAttributesAfter(node, row);
        }
예제 #11
0
        /// <summary>
        /// 单元格点击事件
        /// </summary>
        /// <param name="cell">单元格</param>
        /// <param name="mp">坐标</param>
        /// <param name="button">按钮</param>
        /// <param name="clicks">点击次数</param>
        /// <param name="delta">滚轮值</param>
        public override void onCellClick(FCGridCell cell, FCTouchInfo touchInto)
        {
            base.onCellClick(cell, touchInto);
            List <FCGridRow> rows = m_rows;
            int rowsSize          = rows.Count;

            for (int i = 0; i < rowsSize; i++)
            {
                FCGridRow         row   = rows[i];
                List <FCGridCell> cells = row.getCells();
                int cellsSize           = cells.Count;
                for (int j = 0; j < cellsSize; j++)
                {
                    FCGridControlCell cCell = cells[j] as FCGridControlCell;
                    if (cCell != null)
                    {
                        if (row == cell.Row)
                        {
                            cCell.Control.TextColor = FCDraw.FCCOLORS_TEXTCOLOR4;
                        }
                        else
                        {
                            cCell.Control.TextColor = FCColor.Text;
                        }
                    }
                }
            }
            if (touchInto.m_firstTouch)
            {
                if (touchInto.m_clicks == 1)
                {
                    if (!cell.AllowEdit && cell is GridColorCell)
                    {
                        GridColorCell colorCell   = cell as GridColorCell;
                        ColorDialog   colorDialog = new ColorDialog();
                        colorDialog.AllowFullOpen  = true;
                        colorDialog.AnyColor       = true;
                        colorDialog.SolidColorOnly = false;
                        int a = 0, r = 0, g = 0, b = 0;
                        FCColor.toArgb(Native.Paint, FCStr.convertStrToColor(colorCell.getString()), ref a, ref r, ref g, ref b);
                        colorDialog.Color = Color.FromArgb(a, r, g, b);
                        if (colorDialog.ShowDialog() == DialogResult.OK)
                        {
                            Color newColor = colorDialog.Color;
                            a = newColor.A;
                            r = newColor.R;
                            g = newColor.G;
                            b = newColor.B;
                            colorCell.setString(FCStr.convertColorToStr(FCColor.argb(a, r, g, b)));
                            FCGridCell nameCell = cell.Row.getCell("PROPERTYNAME");
                            if (nameCell != null)
                            {
                                m_designerDiv.saveUndo();
                                String name        = nameCell.Name;
                                String value       = cell.Text;
                                int    targetsSize = m_targets.Count;
                                for (int i = 0; i < targetsSize; i++)
                                {
                                    FCView target = m_targets[i];
                                    m_xml.setProperty(target, name, value);
                                    if (m_collectionWindow != null)
                                    {
                                        m_collectionWindow.onPropertyChanged(name, value);
                                    }
                                    target.update();
                                }
                                //恢复正确的值
                                String rightValue = "", type = "";
                                for (int i = 0; i < targetsSize; i++)
                                {
                                    m_targets[i].getProperty(name.ToLower(), ref rightValue, ref type);
                                }
                                cell.Text = rightValue;
                                Native.update();
                                Native.invalidate();
                            }
                        }
                        colorDialog.Dispose();
                    }
                    //字体单元格
                    else if (!cell.AllowEdit && cell is GridFontCell)
                    {
                        GridFontCell fontCell   = cell as GridFontCell;
                        FontDialog   fontDialog = new FontDialog();
                        fontDialog.Font = getFont(FCStr.convertStrToFont(fontCell.getString()));
                        if (fontDialog.ShowDialog() == DialogResult.OK)
                        {
                            Font newFont = fontDialog.Font;
                            fontCell.setString(FCStr.convertFontToStr(new FCFont(newFont.Name, newFont.Size, newFont.Bold, newFont.Underline, newFont.Italic, newFont.Strikeout)));
                            FCGridCell nameCell = cell.Row.getCell("PROPERTYNAME");
                            if (nameCell != null)
                            {
                                m_designerDiv.saveUndo();
                                String name        = nameCell.Name;
                                String value       = cell.Text;
                                int    targetsSize = m_targets.Count;
                                for (int i = 0; i < targetsSize; i++)
                                {
                                    FCView target = m_targets[i];
                                    m_xml.setProperty(target, name, value);
                                    if (m_collectionWindow != null)
                                    {
                                        m_collectionWindow.onPropertyChanged(name, value);
                                    }
                                    target.update();
                                }
                                //恢复正确的值
                                String rightValue = "", type = "";
                                for (int i = 0; i < targetsSize; i++)
                                {
                                    m_targets[i].getProperty(name.ToLower(), ref rightValue, ref type);
                                }
                                cell.Text = rightValue;
                                Native.update();
                                Native.invalidate();
                            }
                        }
                    }
                    //单击编辑框
                    else if (cell is FCGridButtonCell)
                    {
                        FCButton cButton = (cell as FCGridButtonCell).Button;
                        if (cButton.Tag != null)
                        {
                            String collectionName = cButton.Tag.ToString();
                            int    targetsSize    = m_targets.Count;
                            if (targetsSize > 0)
                            {
                                FCView           target           = m_targets[0];
                                CollectionWindow collectionWindow = new CollectionWindow(m_native);
                                collectionWindow.CollectionName = collectionName;
                                collectionWindow.DesignerDiv    = m_designerDiv;
                                collectionWindow.Target         = target;
                                collectionWindow.Xml            = m_xml;
                                collectionWindow.IsWinForm      = false;
                                collectionWindow.showDialog();
                            }
                        }
                    }
                }
            }
        }
예제 #12
0
        /// <summary>
        /// 创建属性
        /// </summary>
        public void createProperties()
        {
            WinHostEx host = Native.Host as WinHostEx;

            host.LoadingDesigner = true;
            int rowSize = m_rows.Count;

            if (rowSize > 0)
            {
                //清除所有行
                for (int i = 0; i < rowSize; i++)
                {
                    m_rows[i].clearCells();
                    m_rows[i].delete();
                }
                m_rows.Clear();
            }
            int targetsSize = m_targets.Count;

            if (targetsSize > 0)
            {
                FCView target = m_targets[0];
                //获取属性名称
                List <String> propertiesName = UIXmlEx.getUnionProperties(m_targets);
                Dictionary <String, String> addProperties = new Dictionary <String, String>();
                if (targetsSize == 1)
                {
                    if (target is FCTabControl)
                    {
                        addProperties["TabPages"] = "collection";
                    }
                    else if (target is FCGrid)
                    {
                        addProperties["Columns"] = "collection";
                    }
                    foreach (String addName in addProperties.Keys)
                    {
                        propertiesName.Add(addName);
                    }
                }
                propertiesName.Sort();
                int psize = propertiesName.Count;
                for (int i = 0; i < psize; i++)
                {
                    String name  = propertiesName[i];
                    String value = "";
                    String type  = "";
                    if (addProperties.ContainsKey(name))
                    {
                        value = "单击以编辑...";
                        type  = addProperties[name];
                    }
                    else
                    {
                        target.getProperty(name.ToLower(), ref value, ref type);
                    }
                    String text = name;
                    if (m_chNames.ContainsKey(name.ToLower()))
                    {
                        text = m_chNames[name.ToLower()];
                    }
                    if (value == null)
                    {
                        value = "";
                    }
                    FCGridRow row = new FCGridRow();
                    addRow(row);
                    //序号
                    GridNoCell orderCell = new GridNoCell();
                    row.addCell("NO", orderCell);
                    //属性名称
                    FCGridStringCell nameCell = new FCGridStringCell(text);
                    nameCell.Name = name;
                    row.addCell("PROPERTYNAME", nameCell);
                    //英文名称
                    FCGridStringCell enNameCell = new FCGridStringCell(name);
                    row.addCell("ENNAME", enNameCell);
                    //属性值
                    //布尔
                    if (type == "bool")
                    {
                        FCGridCheckBoxCell checkBoxCell = new FCGridCheckBoxCell();
                        checkBoxCell.Control = new CheckBoxM();
                        row.addCell("PROPERTYVALUE", checkBoxCell);
                        checkBoxCell.setBool(value.ToLower() == "true" ? true : false);
                        checkBoxCell.CheckBox.Tag         = name;
                        checkBoxCell.CheckBox.ButtonAlign = FCHorizontalAlign.Left;
                        checkBoxCell.CheckBox.addEvent(new FCEvent(checkBoxCheckedChanged), FCEventID.CHECKEDCHANGED);
                    }
                    //枚举
                    else if (type.StartsWith("enum:"))
                    {
                        String             strEnum      = "FaceCat." + type.Replace("enum:", "");
                        String[]           names        = Enum.GetNames(m_assembly.GetType(strEnum));
                        FCGridComboBoxCell comboBoxCell = new FCGridComboBoxCell();
                        row.addCell("PROPERTYVALUE", comboBoxCell);
                        comboBoxCell.ComboBox.BackColor = FCColor.None;
                        int nameSize = names.Length;
                        for (int j = 0; j < nameSize; j++)
                        {
                            comboBoxCell.ComboBox.DropDownMenu.addItem(new FCMenuItem(names[j]));
                        }
                        comboBoxCell.ComboBox.SelectedText = value;
                        comboBoxCell.ComboBox.ReadOnly     = true;
                        comboBoxCell.ComboBox.Tag          = name;
                        comboBoxCell.ComboBox.addEvent(new FCEvent(comboBoxSelectedIndexChanged), FCEventID.SELECTEDINDEXCHANGED);
                    }
                    //集合
                    else if (type == "collection")
                    {
                        FCGridButtonCell buttonCell = new FCGridButtonCell();
                        row.addCell("PROPERTYVALUE", buttonCell);
                        buttonCell.setString(value);
                        buttonCell.Button.Tag       = name;
                        buttonCell.Button.BackColor = FCColor.None;
                        buttonCell.Button.TextAlign = FCContentAlignment.MiddleLeft;
                        buttonCell.Button.Font      = new FCFont("微软雅黑", 12, false, false, false);
                    }
                    //颜色
                    else if (type == "color")
                    {
                        GridColorCell colorCell = new GridColorCell();
                        colorCell.AllowEdit = true;
                        row.addCell("PROPERTYVALUE", colorCell);
                        colorCell.setString(value);
                        colorCell.Button.Font = new FCFont("微软雅黑", 12, true, false, false);
                    }
                    //字体
                    else if (type == "font")
                    {
                        GridFontCell fontCell = new GridFontCell();
                        fontCell.AllowEdit = true;
                        row.addCell("PROPERTYVALUE", fontCell);
                        fontCell.setString(value);
                        fontCell.Button.Font = new FCFont("微软雅黑", 12, true, false, false);
                    }
                    //输入框
                    else
                    {
                        FCGridStringCell textCell = new FCGridStringCell();
                        textCell.AllowEdit = true;
                        row.addCell("PROPERTYVALUE", textCell);
                        textCell.Text = value;
                    }
                }
                propertiesName.Clear();
                update();
                invalidate();
            }
            host.LoadingDesigner = false;
        }
예제 #13
0
        /// <summary>
        /// 创建属性
        /// </summary>
        public void createProperties()
        {
            WinHostEx host = Native.Host as WinHostEx;

            host.LoadingDesigner = true;
            int rowSize = m_rows.Count;

            if (rowSize > 0)
            {
                //清除所有行
                for (int i = 0; i < rowSize; i++)
                {
                    m_rows[i].clearCells();
                    m_rows[i].delete();
                }
                m_rows.Clear();
            }
            int targetsSize = m_targets.Count;

            if (targetsSize > 0)
            {
                FCView target = m_targets[0];
                //获取属性名称
                List <String> eventNames = target.getEventNames();
                Dictionary <String, String> attributes = m_xml.getAttributes(m_xml.Nodes[target]);
                eventNames.Sort();
                int psize = eventNames.Count;
                for (int i = 0; i < psize; i++)
                {
                    String name      = eventNames[i];
                    String eventName = "on" + name.ToLower();
                    String value     = "";
                    if (attributes.ContainsKey(eventName))
                    {
                        value = attributes[eventName];
                    }
                    String text = name;
                    if (m_chNames.ContainsKey(name.ToLower()))
                    {
                        text = m_chNames[name.ToLower()];
                    }
                    if (value == null)
                    {
                        value = "";
                    }
                    FCGridRow row = new FCGridRow();
                    addRow(row);
                    //序号
                    GridNoCell orderCell = new GridNoCell();
                    row.addCell("NO", orderCell);
                    //属性名称
                    FCGridStringCell nameCell = new FCGridStringCell(text);
                    nameCell.Name = name;
                    row.addCell("PROPERTYNAME", nameCell);
                    FCGridStringCell enNameCell = new FCGridStringCell(name);
                    row.addCell("ENNAME", enNameCell);
                    FCGridStringCell textCell = new FCGridStringCell();
                    textCell.AllowEdit = true;
                    row.addCell("PROPERTYVALUE", textCell);
                    textCell.Text = value;
                }
                eventNames.Clear();
                update();
                invalidate();
            }
            host.LoadingDesigner = false;
        }