Beispiel #1
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;
                        }
                    }
                }
            }
        }
Beispiel #2
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();
                            }
                        }
                    }
                }
            }
        }