Beispiel #1
0
        private void DoGroup()
        {
            Table table = this.table;       // The Table control on a form - already initialised
            //table.Font = new Font(table.Font.FontFamily, 12f);
            table.SelectionStyle = SelectionStyle.Grid;
            table.BeginUpdate();
            table.EnableWordWrap = true;    // If false, then Cell.WordWrap is ignored
            table.FamilyRowSelect = true;
            table.FullRowSelect = true;
            table.ShowSelectionRectangle = false;
            table.MultiSelect = true;

            table.GridLines = GridLines.Both;

            GroupColumn col0 = new GroupColumn("", 20);   // this is the NEW +/- column
            col0.Editable = false;                      // Double clicking on this is to toggle the collapsed state
            col0.Selectable = false;
            col0.ToggleOnSingleClick = true;
            ImageColumn col1 = new ImageColumn("", 20);
            TextColumn col2 = new TextColumn("From", 200);
            DateTimeColumn col3 = new DateTimeColumn("Sent", 180); /// 493
            col3.ShowDropDownButton = false;
            col3.DateTimeFormat = DateTimePickerFormat.Custom;
            col3.CustomDateTimeFormat = "d/M/yyyy hh:mm";
            col3.Alignment = ColumnAlignment.Right;
            col3.AutoResizeMode = ColumnAutoResizeMode.Any;
            //NumberColumn col4 = new NumberColumn("num", 60);
            //col4.ShowUpDownButtons = true;
            ButtonColumn col4 = new ButtonColumn("butt");
            col4.FlatStyle = true;

            table.ColumnModel = new ColumnModel(new Column[] { col0, col1, col2, col3, col4 });

            TableModel model = new TableModel();
            //model.RowHeight = 24;

            AddEmailRows(model, true, "Dave ", "4/9/2007 12:34", "Here is the email subject", "Here is a preview of the text that is in the email. It wraps over too so you can see more of it");

            AddEmailRows(model, false, "Richard Richard Richard Richard Richard Richard Richard Richard Richard Richard Richard Richard Richard Richard", "5/4/2007 9:13", "An email abut something", "Another preview of another ficticious email. Not much to say really");

            AddEmailRows(model, true, "Andy", "13/2/2007 9:45", "Work stuff", "Can you get this finished by this afternoon please? Thanks");

            // Make and add the context menu:
            ContextMenu menu = new ContextMenu();
            MenuItem delete = new MenuItem("Delete");
            delete.Click += new EventHandler(delete_Click);
            menu.MenuItems.Add(delete);
            table.ContextMenu = menu;

            // Add an event handler for the key event
            table.CellKeyUp += new CellKeyEventHandler(table_CellKeyUp);
            table.CellButtonClicked += new CellButtonEventHandler(table_CellButtonClicked);

            table.CellMouseDown += new CellMouseEventHandler(table_CellMouseDown);
            table.CellMouseUp += new CellMouseEventHandler(table_CellMouseUp);

            this.table.TableModel = model;

            this.table.EndUpdate();

            return;
            #region Tracer stuff
            //_tracer = new Tracer(table, OnEventTrace);
            //_tracer.HookEvent("BeginEditing");
            //_tracer.HookEvent("CellClick");
            //_tracer.HookEvent("CellDoubleClick");
            //_tracer.HookEvent("CellMouseDown");
            //_tracer.HookEvent("CellMouseEnter");
            //_tracer.HookEvent("CellMouseHover");
            //_tracer.HookEvent("CellMouseLeave");
            //_tracer.HookEvent("CellMouseMove");
            //_tracer.HookEvent("CellMouseUp");
            //_tracer.HookEvent("CellPropertyChanged");
            //_tracer.HookEvent("Click");
            //_tracer.HookEvent("DoubleClick");
            //_tracer.HookEvent("EditingStopped");
            //_tracer.HookEvent("Enter");
            //_tracer.HookEvent("GotFocus");
            //_tracer.HookEvent("LostFocus");
            //_tracer.HookEvent("MouseCaptureChanged");
            //_tracer.HookEvent("MouseClick");
            //_tracer.HookEvent("MouseDoubleClick");
            //_tracer.HookEvent("MouseDown");
            //_tracer.HookEvent("MouseEnter");
            //_tracer.HookEvent("MouseHover");
            //_tracer.HookEvent("MouseLeave");
            //_tracer.HookEvent("MouseUp");
            //            _tracer.HookAllEvents();
            #endregion
        }
Beispiel #2
0
        private void DoGroup()
        {
            Table table = this.table;       // The Table control on a form - already initialised
            table.SelectionStyle = SelectionStyle.Grid;
            table.BeginUpdate();
            table.EnableWordWrap = true;    // If false, then Cell.WordWrap is ignored

            table.GridLines = GridLines.None;

            GroupColumn col0 = new GroupColumn("", 20);   // this is the NEW +/- column
            col0.Editable = false;                      // Double clicking on this is to toggle the collapsed state
            col0.Selectable = false;
            col0.ToggleOnSingleClick = true;
            ImageColumn col1 = new ImageColumn("", 20);
            TextColumn col2 = new TextColumn("From", 200);
            DateTimeColumn col3 = new DateTimeColumn("Sent", 120);
            col3.ShowDropDownButton = false;
            col3.DateTimeFormat = DateTimePickerFormat.Custom;
            col3.CustomDateTimeFormat = "d/m/yyyy hh:mm";
            ButtonColumn col4 = new ButtonColumn("butt");

            table.ColumnModel = new ColumnModel(new Column[] { col0, col1, col2, col3, col4 });

            TableModel model = new TableModel();

            AddEmailRows(model, true, "Dave", "4/9/2007 12:34", "Here is the email subject", "Here is a preview of the text that is in the email. It wraps over too so you can see more of it");

            AddEmailRows(model, false, "Richard", "5/4/2007 9:13", "An email abut something", "Another preview of another ficticious email. Not much to say really");

            AddEmailRows(model, true, "Andy", "13/2/2007 9:45", "Work stuff", "Can you get this finished by this afternoon please? Thanks");

            // Make and add the context menu:
            ContextMenu menu = new ContextMenu();
            MenuItem delete = new MenuItem("Delete");
            delete.Click += new EventHandler(delete_Click);
            menu.MenuItems.Add(delete);
            table.ContextMenu = menu;

            // Add an event handler for the key event
            table.CellKeyUp += new CellKeyEventHandler(table_CellKeyUp);
            table.CellButtonClicked += new CellButtonEventHandler(table_CellButtonClicked);

            this.table.TableModel = model;

            this.table.EndUpdate();
        }