예제 #1
0
 /// <summary>
 /// Required method for Designer support - do not modify
 /// the contents of this method with the code editor.
 /// </summary>
 private void InitializeComponent()
 {
     XPTable.Models.DataSourceColumnBinder dataSourceColumnBinder1 = new XPTable.Models.DataSourceColumnBinder();
     XPTable.Renderers.DragDropRenderer    dragDropRenderer1       = new XPTable.Renderers.DragDropRenderer();
     this.table = new XPTable.Models.Table();
     this.Debug = new System.Windows.Forms.Button();
     ((System.ComponentModel.ISupportInitialize)(this.table)).BeginInit();
     this.SuspendLayout();
     //
     // table
     //
     this.table.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
                                                                | System.Windows.Forms.AnchorStyles.Left)
                                                               | System.Windows.Forms.AnchorStyles.Right)));
     this.table.BorderColor               = System.Drawing.Color.Black;
     this.table.DataMember                = null;
     this.table.DataSourceColumnBinder    = dataSourceColumnBinder1;
     dragDropRenderer1.ForeColor          = System.Drawing.Color.Red;
     this.table.DragDropRenderer          = dragDropRenderer1;
     this.table.GridLinesContrainedToData = false;
     this.table.Location             = new System.Drawing.Point(12, 12);
     this.table.Name                 = "table";
     this.table.Size                 = new System.Drawing.Size(351, 287);
     this.table.TabIndex             = 0;
     this.table.Text                 = "table";
     this.table.UnfocusedBorderColor = System.Drawing.Color.Black;
     //
     // Debug
     //
     this.Debug.Location = new System.Drawing.Point(12, 305);
     this.Debug.Name     = "Debug";
     this.Debug.Size     = new System.Drawing.Size(75, 23);
     this.Debug.TabIndex = 1;
     this.Debug.Text     = "Debug";
     this.Debug.UseVisualStyleBackColor = true;
     //
     // Demo
     //
     this.ClientSize = new System.Drawing.Size(375, 340);
     this.Controls.Add(this.Debug);
     this.Controls.Add(this.table);
     this.Name  = "Demo";
     this.Text  = "WordWrap";
     this.Load += new System.EventHandler(this.Demo_Load);
     ((System.ComponentModel.ISupportInitialize)(this.table)).EndInit();
     this.ResumeLayout(false);
 }
예제 #2
0
파일: Table.cs 프로젝트: antiduh/XPTable
        /// <summary>
        /// Initializes a new instance of the Table class with default settings
        /// </summary>
        public Table()
        {
            // starting setup
            this.init = true;

            // This call is required by the Windows.Forms Form Designer.
            components = new System.ComponentModel.Container();

            //
            this.SetStyle(ControlStyles.UserPaint, true);
            this.SetStyle(ControlStyles.AllPaintingInWmPaint, true);
            this.SetStyle(ControlStyles.DoubleBuffer, true);
            this.SetStyle(ControlStyles.ResizeRedraw, true);
            this.SetStyle(ControlStyles.Selectable, true);
            this.TabStop = true;

            this.Size = new Size(150, 150);

            this.BackColor = Color.White;

            //
            this.columnModel = null;
            this.tableModel = null;

            // header
            this.headerStyle = ColumnHeaderStyle.Clickable;
            this.headerAlignWithColumn = false;
            this.headerFont = this.Font;
            this.headerRenderer = new XPHeaderRenderer();
            //this.headerRenderer = new GradientHeaderRenderer();
            //this.headerRenderer = new FlatHeaderRenderer();
            this.headerRenderer.Font = this.headerFont;
            this.headerContextMenu = new HeaderContextMenu();
            this.includeHeaderInAutoWidth = true;

            this.columnResizing = true;
            this.resizingColumnIndex = -1;
            this.resizingColumnWidth = -1;
            this.hotColumn = -1;
            this.pressedColumn = -1;
            this.lastSortedColumn = -1;
            this.sortedColumnBackColor = Color.WhiteSmoke;

            // borders
            this.borderStyle = BorderStyle.Fixed3D;
            this.borderColor = Color.Black;
            this.unfocusedBorderColor = Color.Black;

            // scrolling
            this.scrollable = true;

            this.hScrollBar = new HScrollBar();
            this.hScrollBar.Visible = false;
            this.hScrollBar.Location = new Point(this.BorderWidth, this.Height - this.BorderWidth - SystemInformation.HorizontalScrollBarHeight);
            this.hScrollBar.Width = this.Width - (this.BorderWidth * 2) - SystemInformation.VerticalScrollBarWidth;
            this.hScrollBar.Scroll += new ScrollEventHandler(this.OnHorizontalScroll);
            this.Controls.Add(this.hScrollBar);

            this.vScrollBar = new VScrollBar();
            this.vScrollBar.Visible = false;
            this.vScrollBar.Location = new Point(this.Width - this.BorderWidth - SystemInformation.VerticalScrollBarWidth, this.BorderWidth);
            this.vScrollBar.Height = this.Height - (this.BorderWidth * 2) - SystemInformation.HorizontalScrollBarHeight;
            this.vScrollBar.Scroll += new ScrollEventHandler(this.OnVerticalScroll);
            this.vScrollBar.ValueChanged += new EventHandler(vScrollBar_ValueChanged);
            this.Controls.Add(this.vScrollBar);

            //
            this.gridLines = GridLines.None; ;
            this.gridColor = SystemColors.Control;
            this.gridLineStyle = GridLineStyle.Solid;

            this.allowSelection = true;
            this.allowRMBSelection = false;
            this.multiSelect = false;
            this.fullRowSelect = false;
            this.hideSelection = false;
            this.selectionBackColor = SystemColors.Highlight;
            this.selectionForeColor = SystemColors.HighlightText;
            this.unfocusedSelectionBackColor = SystemColors.Control;
            this.unfocusedSelectionForeColor = SystemColors.ControlText;
            this.selectionStyle = SelectionStyle.ListView;
            this.alternatingRowColor = Color.Transparent;
            this.alternatingRowSpan = 1;

            // current table state
            this.tableState = TableState.Normal;

            this.lastMouseCell = new CellPos(-1, -1);
            this.lastMouseDownCell = new CellPos(-1, -1);
            this.focusedCell = new CellPos(-1, -1);
            this.hoverTime = 1000;
            this.trackMouseEvent = null;
            this.ResetMouseEventArgs();

            this.toolTip = new ToolTip(this.components);
            this.toolTip.Active = false;
            this.toolTip.InitialDelay = 1000;

            this.noItemsText = "There are no items in this view";

            this.editingCell = new CellPos(-1, -1);
            this.curentCellEditor = null;
            this.editStartAction = EditStartAction.DoubleClick;
            this.customEditKey = Keys.F5;
            //this.tabMovesEditor = true;

            // showSelectionRectangle defaults to true
            this.showSelectionRectangle = true;

            // drang and drop
            _dragDropHelper = new DragDropHelper(this);
            _dragDropHelper.DragDropRenderer = new DragDropRenderer();

            // for data binding
            listChangedHandler = new ListChangedEventHandler(dataManager_ListChanged);
            positionChangedHandler = new EventHandler(dataManager_PositionChanged);
            dataSourceColumnBinder = new DataSourceColumnBinder();

            // finished setting up
            this.beginUpdateCount = 0;
            this.init = false;
            this.preview = false;
        }