Multifunctional table control

From , 3 Years ago, written in C#, viewed 206 times.
URL https://pastebin.vip/view/a8345c3b
  1. //定制的ListView,它必须能够在列中插入图像、下拉框、可上下调整的数字、进度条等等。
  2.  
  3. //EventsDemoForm.cs
  4.  
  5. using System;
  6. using System.Drawing;
  7. using System.Collections;
  8. using System.ComponentModel;
  9. using System.Windows.Forms;
  10.  
  11. using XPTable;
  12. using XPTable.Models;
  13.  
  14. namespace XPTableDemo.Events
  15. {
  16.         /// <summary>
  17.         /// Summary description for Form1.
  18.         /// </summary>
  19.         public class EventsDemoForm : System.Windows.Forms.Form
  20.         {
  21.                 private XPTable.Models.Table table;
  22.                 private System.Windows.Forms.CheckBox cellMouseEnterCheckBox;
  23.                 private System.Windows.Forms.CheckBox cellMouseLeaveCheckBox;
  24.                 private System.Windows.Forms.CheckBox cellMouseMoveCheckBox;
  25.                 private System.Windows.Forms.CheckBox cellMouseUpCheckBox;
  26.                 private System.Windows.Forms.CheckBox cellMouseDownCheckBox;
  27.                 private System.Windows.Forms.CheckBox cellGotFocusCheckBox;
  28.                 private System.Windows.Forms.CheckBox cellLostFocusCheckBox;
  29.                 private System.Windows.Forms.CheckBox headerMouseDownCheckBox;
  30.                 private System.Windows.Forms.CheckBox headerMouseUpCheckBox;
  31.                 private System.Windows.Forms.CheckBox headerMouseMoveCheckBox;
  32.                 private System.Windows.Forms.CheckBox headerMouseLeaveCheckBox;
  33.                 private System.Windows.Forms.CheckBox headerMouseEnterCheckBox;
  34.                 private System.Windows.Forms.CheckBox cellPropertyChangedCheckBox;
  35.                 private XPTable.Models.ColumnModel columnModel;
  36.                 private XPTable.Models.TableModel tableModel;
  37.                 private System.Windows.Forms.GroupBox eventFilterGroupBox;
  38.                 private System.Windows.Forms.TextBox eventsTextBox;
  39.                 private System.Windows.Forms.CheckBox selectionChangedCheckBox;
  40.                 private System.Windows.Forms.CheckBox cellCheckChangedCheckBox;
  41.                 private System.Windows.Forms.CheckBox cellButtonClickedCheckBox;
  42.                 /// <summary>
  43.                 /// Required designer variable.
  44.                 /// </summary>
  45.                 private System.ComponentModel.Container components = null;
  46.  
  47.                 /// <summary>
  48.                 ///
  49.                 /// </summary>
  50.                 public EventsDemoForm()
  51.                 {
  52.                         //
  53.                         // Required for Windows Form Designer support
  54.                         //
  55.                         InitializeComponent();
  56.  
  57.                         //
  58.                         // TODO: Add any constructor code after InitializeComponent call
  59.                         //
  60.                 }
  61.  
  62.                 /// <summary>
  63.                 /// Clean up any resources being used.
  64.                 /// </summary>
  65.                 protected override void Dispose( bool disposing )
  66.                 {
  67.                         if( disposing )
  68.                         {
  69.                                 if (components != null)
  70.                                 {
  71.                                         components.Dispose();
  72.                                 }
  73.                         }
  74.                         base.Dispose( disposing );
  75.                 }
  76.  
  77.                 #region Windows Form Designer generated code
  78.                 /// <summary>
  79.                 /// Required method for Designer support - do not modify
  80.                 /// the contents of this method with the code editor.
  81.                 /// </summary>
  82.                 private void InitializeComponent()
  83.                 {
  84.                         this.table = new XPTable.Models.Table();
  85.                         this.columnModel = new XPTable.Models.ColumnModel();
  86.                         this.tableModel = new XPTable.Models.TableModel();
  87.                         this.eventFilterGroupBox = new System.Windows.Forms.GroupBox();
  88.                         this.cellCheckChangedCheckBox = new System.Windows.Forms.CheckBox();
  89.                         this.cellButtonClickedCheckBox = new System.Windows.Forms.CheckBox();
  90.                         this.selectionChangedCheckBox = new System.Windows.Forms.CheckBox();
  91.                         this.cellPropertyChangedCheckBox = new System.Windows.Forms.CheckBox();
  92.                         this.headerMouseDownCheckBox = new System.Windows.Forms.CheckBox();
  93.                         this.headerMouseUpCheckBox = new System.Windows.Forms.CheckBox();
  94.                         this.headerMouseMoveCheckBox = new System.Windows.Forms.CheckBox();
  95.                         this.headerMouseLeaveCheckBox = new System.Windows.Forms.CheckBox();
  96.                         this.headerMouseEnterCheckBox = new System.Windows.Forms.CheckBox();
  97.                         this.cellLostFocusCheckBox = new System.Windows.Forms.CheckBox();
  98.                         this.cellGotFocusCheckBox = new System.Windows.Forms.CheckBox();
  99.                         this.cellMouseDownCheckBox = new System.Windows.Forms.CheckBox();
  100.                         this.cellMouseUpCheckBox = new System.Windows.Forms.CheckBox();
  101.                         this.cellMouseMoveCheckBox = new System.Windows.Forms.CheckBox();
  102.                         this.cellMouseLeaveCheckBox = new System.Windows.Forms.CheckBox();
  103.                         this.cellMouseEnterCheckBox = new System.Windows.Forms.CheckBox();
  104.                         this.eventsTextBox = new System.Windows.Forms.TextBox();
  105.                         ((System.ComponentModel.ISupportInitialize)(this.table)).BeginInit();
  106.                         this.eventFilterGroupBox.SuspendLayout();
  107.                         this.SuspendLayout();
  108.                         //
  109.                         // table
  110.                         //
  111.                         this.table.ColumnModel = this.columnModel;
  112.                         this.table.GridLines = XPTable.Models.GridLines.Both;
  113.                         this.table.HeaderFont = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
  114.                         this.table.Location = new System.Drawing.Point(16, 16);
  115.                         this.table.Name = "table";
  116.                         this.table.SelectionStyle = XPTable.Models.SelectionStyle.Grid;
  117.                         this.table.Size = new System.Drawing.Size(352, 144);
  118.                         this.table.TabIndex = 0;
  119.                         this.table.TableModel = this.tableModel;
  120.                         this.table.Text = "table1";
  121.                         this.table.CellMouseEnter += new XPTable.Events.CellMouseEventHandler(this.table_CellMouseEnter);
  122.                         this.table.SelectionChanged += new XPTable.Events.SelectionEventHandler(this.table_SelectionChanged);
  123.                         this.table.CellCheckChanged += new XPTable.Events.CellCheckBoxEventHandler(this.table_CellCheckChanged);
  124.                         this.table.CellMouseDown += new XPTable.Events.CellMouseEventHandler(this.table_CellMouseDown);
  125.                         this.table.CellMouseLeave += new XPTable.Events.CellMouseEventHandler(this.table_CellMouseLeave);
  126.                         this.table.HeaderMouseEnter += new XPTable.Events.HeaderMouseEventHandler(this.table_HeaderMouseEnter);
  127.                         this.table.CellLostFocus += new XPTable.Events.CellFocusEventHandler(this.table_CellLostFocus);
  128.                         this.table.HeaderMouseUp += new XPTable.Events.HeaderMouseEventHandler(this.table_HeaderMouseUp);
  129.                         this.table.HeaderMouseMove += new XPTable.Events.HeaderMouseEventHandler(this.table_HeaderMouseMove);
  130.                         this.table.CellGotFocus += new XPTable.Events.CellFocusEventHandler(this.table_CellGotFocus);
  131.                         this.table.CellMouseMove += new XPTable.Events.CellMouseEventHandler(this.table_CellMouseMove);
  132.                         this.table.HeaderMouseLeave += new XPTable.Events.HeaderMouseEventHandler(this.table_HeaderMouseLeave);
  133.                         this.table.CellButtonClicked += new XPTable.Events.CellButtonEventHandler(this.table_CellButtonClicked);
  134.                         this.table.CellMouseUp += new XPTable.Events.CellMouseEventHandler(this.table_CellMouseUp);
  135.                         this.table.CellPropertyChanged += new XPTable.Events.CellEventHandler(this.table_CellPropertyChanged);
  136.                         this.table.HeaderMouseDown += new XPTable.Events.HeaderMouseEventHandler(this.table_HeaderMouseDown);
  137.                         //
  138.                         // tableModel
  139.                         //
  140.                         this.tableModel.RowHeight = 20;
  141.                         //
  142.                         // eventFilterGroupBox
  143.                         //
  144.                         this.eventFilterGroupBox.Controls.Add(this.cellCheckChangedCheckBox);
  145.                         this.eventFilterGroupBox.Controls.Add(this.cellButtonClickedCheckBox);
  146.                         this.eventFilterGroupBox.Controls.Add(this.selectionChangedCheckBox);
  147.                         this.eventFilterGroupBox.Controls.Add(this.cellPropertyChangedCheckBox);
  148.                         this.eventFilterGroupBox.Controls.Add(this.headerMouseDownCheckBox);
  149.                         this.eventFilterGroupBox.Controls.Add(this.headerMouseUpCheckBox);
  150.                         this.eventFilterGroupBox.Controls.Add(this.headerMouseMoveCheckBox);
  151.                         this.eventFilterGroupBox.Controls.Add(this.headerMouseLeaveCheckBox);
  152.                         this.eventFilterGroupBox.Controls.Add(this.headerMouseEnterCheckBox);
  153.                         this.eventFilterGroupBox.Controls.Add(this.cellLostFocusCheckBox);
  154.                         this.eventFilterGroupBox.Controls.Add(this.cellGotFocusCheckBox);
  155.                         this.eventFilterGroupBox.Controls.Add(this.cellMouseDownCheckBox);
  156.                         this.eventFilterGroupBox.Controls.Add(this.cellMouseUpCheckBox);
  157.                         this.eventFilterGroupBox.Controls.Add(this.cellMouseMoveCheckBox);
  158.                         this.eventFilterGroupBox.Controls.Add(this.cellMouseLeaveCheckBox);
  159.                         this.eventFilterGroupBox.Controls.Add(this.cellMouseEnterCheckBox);
  160.                         this.eventFilterGroupBox.FlatStyle = System.Windows.Forms.FlatStyle.System;
  161.                         this.eventFilterGroupBox.Location = new System.Drawing.Point(16, 168);
  162.                         this.eventFilterGroupBox.Name = "eventFilterGroupBox";
  163.                         this.eventFilterGroupBox.Size = new System.Drawing.Size(352, 224);
  164.                         this.eventFilterGroupBox.TabIndex = 1;
  165.                         this.eventFilterGroupBox.TabStop = false;
  166.                         this.eventFilterGroupBox.Text = "Event Filters";
  167.                         //
  168.                         // cellCheckChangedCheckBox
  169.                         //
  170.                         this.cellCheckChangedCheckBox.Checked = true;
  171.                         this.cellCheckChangedCheckBox.CheckState = System.Windows.Forms.CheckState.Checked;
  172.                         this.cellCheckChangedCheckBox.FlatStyle = System.Windows.Forms.FlatStyle.System;
  173.                         this.cellCheckChangedCheckBox.Location = new System.Drawing.Point(200, 192);
  174.                         this.cellCheckChangedCheckBox.Name = "cellCheckChangedCheckBox";
  175.                         this.cellCheckChangedCheckBox.Size = new System.Drawing.Size(128, 16);
  176.                         this.cellCheckChangedCheckBox.TabIndex = 15;
  177.                         this.cellCheckChangedCheckBox.Text = "CellCheckChanged";
  178.                         //
  179.                         // cellButtonClickedCheckBox
  180.                         //
  181.                         this.cellButtonClickedCheckBox.Checked = true;
  182.                         this.cellButtonClickedCheckBox.CheckState = System.Windows.Forms.CheckState.Checked;
  183.                         this.cellButtonClickedCheckBox.FlatStyle = System.Windows.Forms.FlatStyle.System;
  184.                         this.cellButtonClickedCheckBox.Location = new System.Drawing.Point(200, 168);
  185.                         this.cellButtonClickedCheckBox.Name = "cellButtonClickedCheckBox";
  186.                         this.cellButtonClickedCheckBox.Size = new System.Drawing.Size(128, 16);
  187.                         this.cellButtonClickedCheckBox.TabIndex = 14;
  188.                         this.cellButtonClickedCheckBox.Text = "CellButtonClicked";
  189.                         //
  190.                         // selectionChangedCheckBox
  191.                         //
  192.                         this.selectionChangedCheckBox.Checked = true;
  193.                         this.selectionChangedCheckBox.CheckState = System.Windows.Forms.CheckState.Checked;
  194.                         this.selectionChangedCheckBox.FlatStyle = System.Windows.Forms.FlatStyle.System;
  195.                         this.selectionChangedCheckBox.Location = new System.Drawing.Point(200, 144);
  196.                         this.selectionChangedCheckBox.Name = "selectionChangedCheckBox";
  197.                         this.selectionChangedCheckBox.Size = new System.Drawing.Size(128, 16);
  198.                         this.selectionChangedCheckBox.TabIndex = 13;
  199.                         this.selectionChangedCheckBox.Text = "SelectionChanged";
  200.                         //
  201.                         // cellPropertyChangedCheckBox
  202.                         //
  203.                         this.cellPropertyChangedCheckBox.Checked = true;
  204.                         this.cellPropertyChangedCheckBox.CheckState = System.Windows.Forms.CheckState.Checked;
  205.                         this.cellPropertyChangedCheckBox.FlatStyle = System.Windows.Forms.FlatStyle.System;
  206.                         this.cellPropertyChangedCheckBox.Location = new System.Drawing.Point(16, 24);
  207.                         this.cellPropertyChangedCheckBox.Name = "cellPropertyChangedCheckBox";
  208.                         this.cellPropertyChangedCheckBox.Size = new System.Drawing.Size(128, 16);
  209.                         this.cellPropertyChangedCheckBox.TabIndex = 0;
  210.                         this.cellPropertyChangedCheckBox.Text = "CellPropertyChanged";
  211.                         //
  212.                         // headerMouseDownCheckBox
  213.                         //
  214.                         this.headerMouseDownCheckBox.Checked = true;
  215.                         this.headerMouseDownCheckBox.CheckState = System.Windows.Forms.CheckState.Checked;
  216.                         this.headerMouseDownCheckBox.FlatStyle = System.Windows.Forms.FlatStyle.System;
  217.                         this.headerMouseDownCheckBox.Location = new System.Drawing.Point(200, 120);
  218.                         this.headerMouseDownCheckBox.Name = "headerMouseDownCheckBox";
  219.                         this.headerMouseDownCheckBox.Size = new System.Drawing.Size(128, 16);
  220.                         this.headerMouseDownCheckBox.TabIndex = 12;
  221.                         this.headerMouseDownCheckBox.Text = "HeaderMouseDown";
  222.                         //
  223.                         // headerMouseUpCheckBox
  224.                         //
  225.                         this.headerMouseUpCheckBox.Checked = true;
  226.                         this.headerMouseUpCheckBox.CheckState = System.Windows.Forms.CheckState.Checked;
  227.                         this.headerMouseUpCheckBox.FlatStyle = System.Windows.Forms.FlatStyle.System;
  228.                         this.headerMouseUpCheckBox.Location = new System.Drawing.Point(200, 96);
  229.                         this.headerMouseUpCheckBox.Name = "headerMouseUpCheckBox";
  230.                         this.headerMouseUpCheckBox.Size = new System.Drawing.Size(128, 16);
  231.                         this.headerMouseUpCheckBox.TabIndex = 11;
  232.                         this.headerMouseUpCheckBox.Text = "HeaderMouseUp";
  233.                         //
  234.                         // headerMouseMoveCheckBox
  235.                         //
  236.                         this.headerMouseMoveCheckBox.FlatStyle = System.Windows.Forms.FlatStyle.System;
  237.                         this.headerMouseMoveCheckBox.Location = new System.Drawing.Point(200, 72);
  238.                         this.headerMouseMoveCheckBox.Name = "headerMouseMoveCheckBox";
  239.                         this.headerMouseMoveCheckBox.Size = new System.Drawing.Size(128, 16);
  240.                         this.headerMouseMoveCheckBox.TabIndex = 10;
  241.                         this.headerMouseMoveCheckBox.Text = "HeaderMouseMove";
  242.                         //
  243.                         // headerMouseLeaveCheckBox
  244.                         //
  245.                         this.headerMouseLeaveCheckBox.Checked = true;
  246.                         this.headerMouseLeaveCheckBox.CheckState = System.Windows.Forms.CheckState.Checked;
  247.                         this.headerMouseLeaveCheckBox.FlatStyle = System.Windows.Forms.FlatStyle.System;
  248.                         this.headerMouseLeaveCheckBox.Location = new System.Drawing.Point(200, 48);
  249.                         this.headerMouseLeaveCheckBox.Name = "headerMouseLeaveCheckBox";
  250.                         this.headerMouseLeaveCheckBox.Size = new System.Drawing.Size(128, 16);
  251.                         this.headerMouseLeaveCheckBox.TabIndex = 9;
  252.                         this.headerMouseLeaveCheckBox.Text = "HeaderMouseLeave";
  253.                         //
  254.                         // headerMouseEnterCheckBox
  255.                         //
  256.                         this.headerMouseEnterCheckBox.Checked = true;
  257.                         this.headerMouseEnterCheckBox.CheckState = System.Windows.Forms.CheckState.Checked;
  258.                         this.headerMouseEnterCheckBox.FlatStyle = System.Windows.Forms.FlatStyle.System;
  259.                         this.headerMouseEnterCheckBox.Location = new System.Drawing.Point(200, 24);
  260.                         this.headerMouseEnterCheckBox.Name = "headerMouseEnterCheckBox";
  261.                         this.headerMouseEnterCheckBox.Size = new System.Drawing.Size(128, 16);
  262.                         this.headerMouseEnterCheckBox.TabIndex = 8;
  263.                         this.headerMouseEnterCheckBox.Text = "HeaderMouseEnter";
  264.                         //
  265.                         // cellLostFocusCheckBox
  266.                         //
  267.                         this.cellLostFocusCheckBox.Checked = true;
  268.                         this.cellLostFocusCheckBox.CheckState = System.Windows.Forms.CheckState.Checked;
  269.                         this.cellLostFocusCheckBox.FlatStyle = System.Windows.Forms.FlatStyle.System;
  270.                         this.cellLostFocusCheckBox.Location = new System.Drawing.Point(16, 192);
  271.                         this.cellLostFocusCheckBox.Name = "cellLostFocusCheckBox";
  272.                         this.cellLostFocusCheckBox.Size = new System.Drawing.Size(128, 16);
  273.                         this.cellLostFocusCheckBox.TabIndex = 7;
  274.                         this.cellLostFocusCheckBox.Text = "CellLostFocus";
  275.                         //
  276.                         // cellGotFocusCheckBox
  277.                         //
  278.                         this.cellGotFocusCheckBox.Checked = true;
  279.                         this.cellGotFocusCheckBox.CheckState = System.Windows.Forms.CheckState.Checked;
  280.                         this.cellGotFocusCheckBox.FlatStyle = System.Windows.Forms.FlatStyle.System;
  281.                         this.cellGotFocusCheckBox.Location = new System.Drawing.Point(16, 168);
  282.                         this.cellGotFocusCheckBox.Name = "cellGotFocusCheckBox";
  283.                         this.cellGotFocusCheckBox.Size = new System.Drawing.Size(128, 16);
  284.                         this.cellGotFocusCheckBox.TabIndex = 6;
  285.                         this.cellGotFocusCheckBox.Text = "CellGotFocus";
  286.                         //
  287.                         // cellMouseDownCheckBox
  288.                         //
  289.                         this.cellMouseDownCheckBox.Checked = true;
  290.                         this.cellMouseDownCheckBox.CheckState = System.Windows.Forms.CheckState.Checked;
  291.                         this.cellMouseDownCheckBox.FlatStyle = System.Windows.Forms.FlatStyle.System;
  292.                         this.cellMouseDownCheckBox.Location = new System.Drawing.Point(16, 144);
  293.                         this.cellMouseDownCheckBox.Name = "cellMouseDownCheckBox";
  294.                         this.cellMouseDownCheckBox.Size = new System.Drawing.Size(128, 16);
  295.                         this.cellMouseDownCheckBox.TabIndex = 5;
  296.                         this.cellMouseDownCheckBox.Text = "CellMouseDown";
  297.                         //
  298.                         // cellMouseUpCheckBox
  299.                         //
  300.                         this.cellMouseUpCheckBox.Checked = true;
  301.                         this.cellMouseUpCheckBox.CheckState = System.Windows.Forms.CheckState.Checked;
  302.                         this.cellMouseUpCheckBox.FlatStyle = System.Windows.Forms.FlatStyle.System;
  303.                         this.cellMouseUpCheckBox.Location = new System.Drawing.Point(16, 120);
  304.                         this.cellMouseUpCheckBox.Name = "cellMouseUpCheckBox";
  305.                         this.cellMouseUpCheckBox.Size = new System.Drawing.Size(128, 16);
  306.                         this.cellMouseUpCheckBox.TabIndex = 4;
  307.                         this.cellMouseUpCheckBox.Text = "CellMouseUp";
  308.                         //
  309.                         // cellMouseMoveCheckBox
  310.                         //
  311.                         this.cellMouseMoveCheckBox.FlatStyle = System.Windows.Forms.FlatStyle.System;
  312.                         this.cellMouseMoveCheckBox.Location = new System.Drawing.Point(16, 96);
  313.                         this.cellMouseMoveCheckBox.Name = "cellMouseMoveCheckBox";
  314.                         this.cellMouseMoveCheckBox.Size = new System.Drawing.Size(128, 16);
  315.                         this.cellMouseMoveCheckBox.TabIndex = 3;
  316.                         this.cellMouseMoveCheckBox.Text = "CellMouseMove";
  317.                         //
  318.                         // cellMouseLeaveCheckBox
  319.                         //
  320.                         this.cellMouseLeaveCheckBox.Checked = true;
  321.                         this.cellMouseLeaveCheckBox.CheckState = System.Windows.Forms.CheckState.Checked;
  322.                         this.cellMouseLeaveCheckBox.FlatStyle = System.Windows.Forms.FlatStyle.System;
  323.                         this.cellMouseLeaveCheckBox.Location = new System.Drawing.Point(16, 72);
  324.                         this.cellMouseLeaveCheckBox.Name = "cellMouseLeaveCheckBox";
  325.                         this.cellMouseLeaveCheckBox.Size = new System.Drawing.Size(128, 16);
  326.                         this.cellMouseLeaveCheckBox.TabIndex = 2;
  327.                         this.cellMouseLeaveCheckBox.Text = "CellMouseLeave";
  328.                         //
  329.                         // cellMouseEnterCheckBox
  330.                         //
  331.                         this.cellMouseEnterCheckBox.Checked = true;
  332.                         this.cellMouseEnterCheckBox.CheckState = System.Windows.Forms.CheckState.Checked;
  333.                         this.cellMouseEnterCheckBox.FlatStyle = System.Windows.Forms.FlatStyle.System;
  334.                         this.cellMouseEnterCheckBox.Location = new System.Drawing.Point(16, 48);
  335.                         this.cellMouseEnterCheckBox.Name = "cellMouseEnterCheckBox";
  336.                         this.cellMouseEnterCheckBox.Size = new System.Drawing.Size(128, 16);
  337.                         this.cellMouseEnterCheckBox.TabIndex = 1;
  338.                         this.cellMouseEnterCheckBox.Text = "CellMouseEnter";
  339.                         //
  340.                         // eventsTextBox
  341.                         //
  342.                         this.eventsTextBox.Location = new System.Drawing.Point(16, 400);
  343.                         this.eventsTextBox.Multiline = true;
  344.                         this.eventsTextBox.Name = "eventsTextBox";
  345.                         this.eventsTextBox.ScrollBars = System.Windows.Forms.ScrollBars.Vertical;
  346.                         this.eventsTextBox.Size = new System.Drawing.Size(352, 128);
  347.                         this.eventsTextBox.TabIndex = 2;
  348.                         this.eventsTextBox.Text = "";
  349.                         //
  350.                         // EventsDemoForm
  351.                         //
  352.                         this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
  353.                         this.ClientSize = new System.Drawing.Size(384, 542);
  354.                         this.Controls.Add(this.eventsTextBox);
  355.                         this.Controls.Add(this.table);
  356.                         this.Controls.Add(this.eventFilterGroupBox);
  357.                         this.Name = "EventsDemoForm";
  358.                         this.Text = "XPTable - Events Demo";
  359.                         ((System.ComponentModel.ISupportInitialize)(this.table)).EndInit();
  360.                         this.eventFilterGroupBox.ResumeLayout(false);
  361.                         this.ResumeLayout(false);
  362.  
  363.                 }
  364.                 #endregion
  365.  
  366.                 /// <summary>
  367.                 /// The main entry point for the application.
  368.                 /// </summary>
  369.                 [STAThread]
  370.                 static void Main()
  371.                 {
  372.                         Application.Run(new EventsDemoForm());
  373.                 }
  374.  
  375.  
  376.                 /// <summary>
  377.                 ///
  378.                 /// </summary>
  379.                 /// <param name="e"></param>
  380.                 protected override void OnLoad(EventArgs e)
  381.                 {
  382.                         base.OnLoad(e);
  383.  
  384.                         this.table.BeginUpdate();
  385.  
  386.                         TextColumn textColumn1 = new TextColumn();
  387.                         textColumn1.Editable = false;
  388.                         textColumn1.Sortable = false;
  389.                         textColumn1.Text = "Text";
  390.  
  391.                         CheckBoxColumn checkBoxColumn1 = new CheckBoxColumn();
  392.                         checkBoxColumn1.Sortable = false;
  393.                         checkBoxColumn1.Text = "CheckBox";
  394.                         checkBoxColumn1.Width = 94;
  395.  
  396.                         TextColumn textColumn2 = new TextColumn();
  397.                         textColumn2.Editable = false;
  398.                         textColumn2.Sortable = false;
  399.                         textColumn2.Text = "Text";
  400.  
  401.                         ButtonColumn buttonColumn1 = new ButtonColumn();
  402.                         buttonColumn1.Sortable = false;
  403.                         buttonColumn1.Text = "Button";
  404.  
  405.                         this.columnModel.Columns.AddRange(new Column[] {textColumn1, checkBoxColumn1, textColumn2, buttonColumn1});
  406.  
  407.                         this.table.TableModel.Rows.AddRange(new Row[] { new Row(new Cell[] {new Cell("Item 1"),
  408.                                                                                                                                                                    new Cell("CheckBox 1"),
  409.                                                                                                                                                                    new Cell("Item 2"),
  410.                                                                                                                                                                    new Cell("Button 1")}),
  411.                                                                                                                           new Row(new Cell[] {new Cell("Item 3"),
  412.                                                                                                                                                                          new Cell("CheckBox 2"),
  413.                                                                                                                                                                          new Cell("Item 4"),
  414.                                                                                                                                                                          new Cell("Button 2")}),
  415.                                                                                                                           new Row(new Cell[] {new Cell("Item 5"),
  416.                                                                                                                                                                          new Cell("CheckBox 3"),
  417.                                                                                                                                                                          new Cell("Item 6"),
  418.                                                                                                                                                                          new Cell("Button 3")}),
  419.                                                                                                                           new Row(new Cell[] {new Cell("Item 7"),
  420.                                                                                                                                                                          new Cell("CheckBox 4"),
  421.                                                                                                                                                                          new Cell("Item 8"),
  422.                                                                                                                                                                          new Cell("Button 4")}),
  423.                                                                                                                           new Row(new Cell[] {new Cell("Item 9"),
  424.                                                                                                                                                                          new Cell("CheckBox 5"),
  425.                                                                                                                                                                          new Cell("Item 10"),
  426.                                                                                                                                                                          new Cell("Button 5")})});
  427.  
  428.                         this.table.EndUpdate();
  429.                 }
  430.  
  431.  
  432.                 private void table_CellGotFocus(object sender, XPTable.Events.CellFocusEventArgs e)
  433.                 {
  434.                         if (this.cellGotFocusCheckBox.Checked)
  435.                         {
  436.                                 this.eventsTextBox.AppendText(String.Format("({0}, {1}) CellGotFocus\r\n", e.Row, e.Column));
  437.                         }
  438.                 }
  439.  
  440.                 private void table_CellLostFocus(object sender, XPTable.Events.CellFocusEventArgs e)
  441.                 {
  442.                         if (this.cellLostFocusCheckBox.Checked)
  443.                         {
  444.                                 this.eventsTextBox.AppendText(String.Format("({0}, {1}) CellLostFocus\r\n", e.Row, e.Column));
  445.                         }
  446.                 }
  447.  
  448.                 private void table_CellMouseDown(object sender, XPTable.Events.CellMouseEventArgs e)
  449.                 {
  450.                         if (this.cellMouseDownCheckBox.Checked)
  451.                         {
  452.                                 this.eventsTextBox.AppendText(String.Format("({0}, {1}) CellMouseDown\r\n", e.Row, e.Column));
  453.                         }
  454.                 }
  455.  
  456.                 private void table_CellMouseEnter(object sender, XPTable.Events.CellMouseEventArgs e)
  457.                 {
  458.                         if (this.cellMouseEnterCheckBox.Checked)
  459.                         {
  460.                                 this.eventsTextBox.AppendText(String.Format("({0}, {1}) CellMouseEnter\r\n", e.Row, e.Column));
  461.                         }
  462.                 }
  463.  
  464.                 private void table_CellMouseLeave(object sender, XPTable.Events.CellMouseEventArgs e)
  465.                 {
  466.                         if (this.cellMouseLeaveCheckBox.Checked)
  467.                         {
  468.                                 this.eventsTextBox.AppendText(String.Format("({0}, {1}) CellMouseLeave\r\n", e.Row, e.Column));
  469.                         }
  470.                 }
  471.  
  472.                 private void table_CellMouseMove(object sender, XPTable.Events.CellMouseEventArgs e)
  473.                 {
  474.                         if (this.cellMouseMoveCheckBox.Checked)
  475.                         {
  476.                                 this.eventsTextBox.AppendText(String.Format("({0}, {1}) CellMouseMove\r\n", e.Row, e.Column));
  477.                         }
  478.                 }
  479.  
  480.                 private void table_CellMouseUp(object sender, XPTable.Events.CellMouseEventArgs e)
  481.                 {
  482.                         if (this.cellMouseUpCheckBox.Checked)
  483.                         {
  484.                                 this.eventsTextBox.AppendText(String.Format("({0}, {1}) CellMouseUp\r\n", e.Row, e.Column));
  485.                         }
  486.                 }
  487.  
  488.                 private void table_CellPropertyChanged(object sender, XPTable.Events.CellEventArgs e)
  489.                 {
  490.                         if (this.cellPropertyChangedCheckBox.Checked)
  491.                         {
  492.                                 this.eventsTextBox.AppendText(String.Format("({0}, {1}) CellPropertyChanged\r\n", e.Row, e.Column));
  493.                         }
  494.                 }
  495.  
  496.                 private void table_HeaderMouseDown(object sender, XPTable.Events.HeaderMouseEventArgs e)
  497.                 {
  498.                         if (this.headerMouseDownCheckBox.Checked)
  499.                         {
  500.                                 this.eventsTextBox.AppendText(String.Format("({0}) HeaderMouseDown\r\n", e.Column));
  501.                         }
  502.                 }
  503.  
  504.                 private void table_HeaderMouseEnter(object sender, XPTable.Events.HeaderMouseEventArgs e)
  505.                 {
  506.                         if (this.headerMouseEnterCheckBox.Checked)
  507.                         {
  508.                                 this.eventsTextBox.AppendText(String.Format("({0}) HeaderMouseEnter\r\n", e.Column));
  509.                         }
  510.                 }
  511.  
  512.                 private void table_HeaderMouseLeave(object sender, XPTable.Events.HeaderMouseEventArgs e)
  513.                 {
  514.                         if (this.headerMouseLeaveCheckBox.Checked)
  515.                         {
  516.                                 this.eventsTextBox.AppendText(String.Format("({0}) HeaderMouseLeave\r\n", e.Column));
  517.                         }
  518.                 }
  519.  
  520.                 private void table_HeaderMouseMove(object sender, XPTable.Events.HeaderMouseEventArgs e)
  521.                 {
  522.                         if (this.headerMouseMoveCheckBox.Checked)
  523.                         {
  524.                                 this.eventsTextBox.AppendText(String.Format("({0}) HeaderMouseMove\r\n", e.Column));
  525.                         }
  526.                 }
  527.  
  528.                 private void table_HeaderMouseUp(object sender, XPTable.Events.HeaderMouseEventArgs e)
  529.                 {
  530.                         if (this.headerMouseUpCheckBox.Checked)
  531.                         {
  532.                                 this.eventsTextBox.AppendText(String.Format("({0}) HeaderMouseUp\r\n", e.Column));
  533.                         }
  534.                 }
  535.  
  536.                 private void table_SelectionChanged(object sender, XPTable.Events.SelectionEventArgs e)
  537.                 {
  538.                         if (this.selectionChangedCheckBox.Checked)
  539.                         {
  540.                                 this.eventsTextBox.AppendText("SelectionChanged\r\n");
  541.                         }
  542.                 }
  543.  
  544.                 private void table_CellButtonClicked(object sender, XPTable.Events.CellButtonEventArgs e)
  545.                 {
  546.                         if (this.cellButtonClickedCheckBox.Checked)
  547.                         {
  548.                                 this.eventsTextBox.AppendText(String.Format("({0}, {1}) CellButtonClicked\r\n", e.Row, e.Column));
  549.                         }
  550.                 }
  551.  
  552.                 private void table_CellCheckChanged(object sender, XPTable.Events.CellCheckBoxEventArgs e)
  553.                 {
  554.                         if (this.cellCheckChangedCheckBox.Checked)
  555.                         {
  556.                                 this.eventsTextBox.AppendText(String.Format("({0}, {1}) CellCheckChanged\r\n", e.Row, e.Column));
  557.                         }
  558.                 }
  559.         }
  560. }
  561.  

Reply to "Multifunctional table control"

Here you can reply to the paste above

captcha

https://burned.cc - Burn After Reading Website