Пример #1
0
        private void SetupGrid()
        {
            var pers = Person.MakePeople(500);

            pers[0].FirstName = "Эйяфьятлайокудль";
            pers[1].FirstName = "МужикСНереальноДлиннымИменемТакимЧтоНеВлезаетВКолонку";
            grid.Columns.Add(new FastColumn("FirstName", "Name")
            {
                ColumnWidth        = 70,
                SortOrder          = FastColumnSort.Ascending,
                IsEditable         = true,
                ShowClippedContent = true
            });
            grid.Columns.Add(new FastColumn("LastName", "Surname")
            {
                ColumnMinWidth = 70,
                SortOrder      = FastColumnSort.Ascending
            });

            grid.Columns.Add(new FastColumn("IsMale", "Gender")
            {
                ColumnWidth = 60,
                // format cell value: "-" if gender is not specified, "male" for true, "female" for false
                formatter = c => c == null ? "-" : (bool)c ? "Male" : "Female"
            });

            grid.Columns.Add(new FastColumn("Occupation", "Occupation")
            {
                ColumnWidth              = 70,
                IsHyperlinkStyleColumn   = true,
                HyperlinkActiveCursor    = Cursors.Hand,
                HyperlinkFontActive      = new Font(Font, FontStyle.Bold),
                ColorHyperlinkTextActive = Color.Blue,
                // highlight unemployed
                colorColumnFormatter = (object c, out Color? back, out Color? fnt) =>
                {
                    back = null;
                    fnt  = ((Person.PersonOccupation)c) == Person.PersonOccupation.None ? Color.DarkBlue : Color.Black;
                },
                IsEditable = true
            });
            grid.Columns.Add(new FastColumn("Password", "Password")
            {
                ColumnMinWidth = 70
            });

            grid.Columns.Add(new FastColumn("Rating", "Rating")
            {
                IsEditable = true
            });
            grid.Columns.Add(new FastColumn("AccessColor"));

            grid.UserHitCell += GridUserHitCell;

            grid.CalcSetTableMinWidth();
            grid.DataBind(pers);
        }
Пример #2
0
        private void MainFormLoad(object sender, EventArgs e)
        {
            fastCombo.AddColumn(new FastColumn("FirstName", "Name"));
            fastCombo.AddColumn(new FastColumn("LastName", "Surname"));
            fastCombo.DataBind(Person.MakePeople(10));

            var crowd = Person.MakePeople(20);

            fastGrid.GroupingFunctions = new List <FastGrid.FastGrid.GroupingFunctionDel> {
                GroupByGender
            };
            fastGrid.GroupingComparisons = new List <Comparison <object> >
            {
                (a, b) => (int)a - (int)b
            };
            fastGrid.DataBind(crowd, typeof(Person), false, new[] { "male", "female", "-" }, 65, "dd.MM.yyyy");
        }
Пример #3
0
        private void MsGridFormLoad(object sender, EventArgs e)
        {
            var pers = Person.MakePeople(500);

            grid.DataSource = pers;
        }