예제 #1
0
        public Cells.Cell CreateCell()
        {
            SourceGrid2.VisualModels.Header l_VisualModel = new SourceGrid2.VisualModels.Header(false);
            l_VisualModel.StringFormat.FormatFlags |= StringFormatFlags.DirectionVertical;
            //l_VisualModel.Border = new SourceGrid2.RectangleBorder(new SourceGrid2.Border(Color.Black, 1));
            l_VisualModel.HeaderLightColor        = Color.White;
            l_VisualModel.HeaderLightBorderWidth  = 6;
            l_VisualModel.HeaderShadowBorderWidth = 4;
            l_VisualModel.HeaderShadowColor       = Color.Gray;
            l_VisualModel.BackColor     = Color;
            l_VisualModel.TextAlignment = ContentAlignment.MiddleCenter;
            l_VisualModel.ForeColor     = ForeColor;

            Cells.Cell l_Cell = new SourceGrid2.Cells.Real.Cell(称, null, l_VisualModel);
            l_Cell.ToolTipText = 称 + " - " + 值.ToString();
            return(l_Cell);
        }
예제 #2
0
        private void StartForm_Load(object sender, System.EventArgs e)
        {
            grid.Redim(39, 3);
            grid.BackColor = Color.WhiteSmoke;

            #region VisualProperties
            SourceGrid2.VisualModels.Common l_PropertiesCaption = new SourceGrid2.VisualModels.Common();
            l_PropertiesCaption.Border        = SourceGrid2.RectangleBorder.NoBorder;
            l_PropertiesCaption.BackColor     = grid.BackColor;
            l_PropertiesCaption.Font          = new Font(FontFamily.GenericSansSerif, 12, FontStyle.Bold);
            l_PropertiesCaption.TextAlignment = ContentAlignment.MiddleCenter;

            SourceGrid2.VisualModels.Common l_PropertiesLink = (SourceGrid2.VisualModels.Common)SourceGrid2.VisualModels.Common.LinkStyle.Clone(false);
            l_PropertiesLink.Border        = new SourceGrid2.RectangleBorder(new SourceGrid2.Border(Color.Gray, 1));
            l_PropertiesLink.TextAlignment = ContentAlignment.MiddleCenter;

            SourceGrid2.VisualModels.Common l_PropertiesDescription = new SourceGrid2.VisualModels.Common();
            l_PropertiesDescription.Border    = SourceGrid2.RectangleBorder.NoBorder;
            l_PropertiesDescription.BackColor = grid.BackColor;

            SourceGrid2.VisualModels.Common l_PropertiesVersion = (SourceGrid2.VisualModels.Common)(SourceGrid2.VisualModels.Common.LinkStyle.Clone(false));
            l_PropertiesVersion.Border        = SourceGrid2.RectangleBorder.NoBorder;
            l_PropertiesVersion.BackColor     = grid.BackColor;
            l_PropertiesVersion.TextAlignment = ContentAlignment.TopRight;

            SourceGrid2.VisualModels.Common l_PropertiesRegion = new SourceGrid2.VisualModels.Common();
            l_PropertiesRegion.Border        = SourceGrid2.RectangleBorder.RectangleBlack1Width;
            l_PropertiesRegion.BackColor     = Color.SteelBlue;
            l_PropertiesRegion.ForeColor     = Color.White;
            l_PropertiesRegion.TextAlignment = ContentAlignment.MiddleCenter;
            #endregion

            #region Caption
            grid[1, 1]             = new Cells.Cell("SourceGrid 2");
            grid[1, 1].VisualModel = l_PropertiesCaption;
            grid[1, 1].ColumnSpan  = 2;

            Cells.Link l_CellVersion = new Cells.Link("V." + GetSourceGridFileVersion());
            grid[0, 2]                = l_CellVersion;
            grid[0, 2].VisualModel    = l_PropertiesVersion;
            l_CellVersion.ToolTipText = "www.devage.com";
            l_CellVersion.Click      += new SourceGrid2.PositionEventHandler(l_CellVersion_Click);
            #endregion

            int l_CurrentRow = 3;

            #region Basic Operations
            grid[l_CurrentRow, 1]            = new SourceGrid2.Cells.Real.Cell("Basic Operations", null, l_PropertiesRegion);
            grid[l_CurrentRow, 1].ColumnSpan = 2;
            l_CurrentRow++;

            #region Sample 14
            grid[l_CurrentRow, 1]             = new CellLinkSample("Sample 14", typeof(frmSample14));
            grid[l_CurrentRow, 1].VisualModel = l_PropertiesLink;

            grid[l_CurrentRow, 2]             = new Cells.Cell("First Example Grid");
            grid[l_CurrentRow, 2].VisualModel = l_PropertiesDescription;

            l_CurrentRow += 2;
            #endregion

            #region Sample 13
            grid[l_CurrentRow, 1]             = new CellLinkSample("Sample 13", typeof(frmSample13));
            grid[l_CurrentRow, 1].VisualModel = l_PropertiesLink;

            grid[l_CurrentRow, 2]             = new Cells.Cell("Basic Grid Operations - Grid, Cell, DataModel, VisualModel, BehaviorModel");
            grid[l_CurrentRow, 2].VisualModel = l_PropertiesDescription;

            l_CurrentRow += 2;
            #endregion

            #region Sample 3
            grid[l_CurrentRow, 1]             = new CellLinkSample("Sample 3", typeof(frmSample3));
            grid[l_CurrentRow, 1].VisualModel = l_PropertiesLink;

            grid[l_CurrentRow, 2]             = new Cells.Cell("Cell Editors, Special Cells, Formatting and Image");
            grid[l_CurrentRow, 2].VisualModel = l_PropertiesDescription;

            l_CurrentRow += 2;
            #endregion
            #endregion

            #region Real Grids
            grid[l_CurrentRow, 1]            = new SourceGrid2.Cells.Real.Cell("Real Grids", null, l_PropertiesRegion);
            grid[l_CurrentRow, 1].ColumnSpan = 2;
            l_CurrentRow++;

            #region Sample 1
            grid[l_CurrentRow, 1]             = new CellLinkSample("Sample 1", typeof(frmSample1));
            grid[l_CurrentRow, 1].VisualModel = l_PropertiesLink;

            grid[l_CurrentRow, 2]             = new Cells.Cell("Fixed Cells, Sort, Resize, Editors, MoveColumns, Add/Remove Rows (Standard Grid)");
            grid[l_CurrentRow, 2].VisualModel = l_PropertiesDescription;

            l_CurrentRow += 2;
            #endregion

            #region Sample 4
            grid[l_CurrentRow, 1]             = new CellLinkSample("Sample 4", typeof(frmSample4));
            grid[l_CurrentRow, 1].VisualModel = l_PropertiesLink;

            grid[l_CurrentRow, 2]             = new Cells.Cell("Grid Performance (static Cell + Shared VisualProperties and Editor)");
            grid[l_CurrentRow, 2].VisualModel = l_PropertiesDescription;

            l_CurrentRow += 2;
            #endregion
            #endregion

            #region Virtual Grids
            grid[l_CurrentRow, 1]            = new SourceGrid2.Cells.Real.Cell("Virtual Grids", null, l_PropertiesRegion);
            grid[l_CurrentRow, 1].ColumnSpan = 2;
            grid[l_CurrentRow, 0]            = new CellNew();
            l_CurrentRow++;

            #region Sample 15
            grid[l_CurrentRow, 1]             = new CellLinkSample("Sample 15", typeof(frmSample15));
            grid[l_CurrentRow, 1].VisualModel = l_PropertiesLink;

            grid[l_CurrentRow, 2]             = new Cells.Cell("Virtual Grid - Simple Array Binding");
            grid[l_CurrentRow, 2].VisualModel = l_PropertiesDescription;

            l_CurrentRow += 2;
            #endregion

            #region Sample 5
            grid[l_CurrentRow, 1]             = new CellLinkSample("Sample 5", typeof(frmSample5));
            grid[l_CurrentRow, 1].VisualModel = l_PropertiesLink;

            grid[l_CurrentRow, 2]             = new Cells.Cell("Virtual Grid - ReadOnly Grid with auto generated values");
            grid[l_CurrentRow, 2].VisualModel = l_PropertiesDescription;

            l_CurrentRow += 2;
            #endregion

            #region Sample 6
            grid[l_CurrentRow, 1]             = new CellLinkSample("Sample 6", typeof(frmSample6));
            grid[l_CurrentRow, 1].VisualModel = l_PropertiesLink;

            grid[l_CurrentRow, 2]             = new Cells.Cell("Virtual Grid - Array Binding");
            grid[l_CurrentRow, 2].VisualModel = l_PropertiesDescription;

            l_CurrentRow += 2;
            #endregion

            #region Sample 9
            grid[l_CurrentRow, 1]             = new CellLinkSample("Sample 9", typeof(frmSample9));
            grid[l_CurrentRow, 1].VisualModel = l_PropertiesLink;

            grid[l_CurrentRow, 2]             = new Cells.Cell("Virtual Grid - DataTable Binding");
            grid[l_CurrentRow, 2].VisualModel = l_PropertiesDescription;

            l_CurrentRow += 2;
            #endregion

            #region Sample 11
            grid[l_CurrentRow, 1]             = new CellLinkSample("Sample 11", typeof(frmSample11));
            grid[l_CurrentRow, 1].VisualModel = l_PropertiesLink;

            grid[l_CurrentRow, 2]             = new Cells.Cell("Virtual Grid - WorkSheet Style Grid");
            grid[l_CurrentRow, 2].VisualModel = l_PropertiesDescription;

            l_CurrentRow += 2;
            #endregion

            #region Sample 12
            grid[l_CurrentRow, 1]             = new CellLinkSample("Sample 12", typeof(frmSample12));
            grid[l_CurrentRow, 1].VisualModel = l_PropertiesLink;

            grid[l_CurrentRow, 2]             = new Cells.Cell("Virtual Grid - Xml Binding and Virtuals Cells");
            grid[l_CurrentRow, 2].VisualModel = l_PropertiesDescription;

            l_CurrentRow += 2;
            #endregion
            #endregion

            #region Unusual Grids
            grid[l_CurrentRow, 1]            = new SourceGrid2.Cells.Real.Cell("Unusual Grids", null, l_PropertiesRegion);
            grid[l_CurrentRow, 1].ColumnSpan = 2;
            l_CurrentRow++;

            #region Sample 7
            grid[l_CurrentRow, 1]             = new CellLinkSample("Sample 7", typeof(frmSample7));
            grid[l_CurrentRow, 1].VisualModel = l_PropertiesLink;

            grid[l_CurrentRow, 2]             = new Cells.Cell("Generic List Editor + Chart Bar Simulation 2");
            grid[l_CurrentRow, 2].VisualModel = l_PropertiesDescription;

            l_CurrentRow += 2;
            #endregion

            #region Sample 2
            grid[l_CurrentRow, 1]             = new CellLinkSample("Sample 2", typeof(frmSample2));
            grid[l_CurrentRow, 1].VisualModel = l_PropertiesLink;

            grid[l_CurrentRow, 2]             = new Cells.Cell("Image, Custom Cells, Editor (Bar Chart Simulation)");
            grid[l_CurrentRow, 2].VisualModel = l_PropertiesDescription;

            l_CurrentRow += 2;
            #endregion
            #endregion

            #region Other Features
            grid[l_CurrentRow, 1]            = new SourceGrid2.Cells.Real.Cell("Other Features", null, l_PropertiesRegion);
            grid[l_CurrentRow, 1].ColumnSpan = 2;
            l_CurrentRow++;
            #region Sample 8
            grid[l_CurrentRow, 1]             = new CellLinkSample("Sample 8", typeof(frmSample8));
            grid[l_CurrentRow, 1].VisualModel = l_PropertiesLink;

            grid[l_CurrentRow, 2]             = new Cells.Cell("Cell Events and Behaviors");
            grid[l_CurrentRow, 2].VisualModel = l_PropertiesDescription;

            l_CurrentRow += 2;
            #endregion

            #region Sample 10
            grid[l_CurrentRow, 1]             = new CellLinkSample("Sample 10", typeof(frmSample10));
            grid[l_CurrentRow, 1].VisualModel = l_PropertiesLink;

            grid[l_CurrentRow, 2]             = new Cells.Cell("ContextMenu");
            grid[l_CurrentRow, 2].VisualModel = l_PropertiesDescription;

            l_CurrentRow += 2;
            #endregion

            #region Sample 16
            grid[l_CurrentRow, 1]             = new CellLinkSample("Sample 16", typeof(frmSample16));
            grid[l_CurrentRow, 1].VisualModel = l_PropertiesLink;

            grid[l_CurrentRow, 2]             = new Cells.Cell("SpecialKeys and FocusStyle");
            grid[l_CurrentRow, 2].VisualModel = l_PropertiesDescription;

            l_CurrentRow += 2;
            #endregion
            #endregion


            grid.AutoSizeAll();
            grid.AutoStretchColumnsToFitWidth = true;
            grid.StretchColumnsToFitWidth();
        }