Adding listview.
authorsl
Mon, 22 Dec 2014 12:46:22 +0100
changeset 3953886b25c49d
parent 38 98cd08fa1d6d
child 40 b3e177062849
Adding listview.
MainForm.cs
     1.1 --- a/MainForm.cs	Mon Dec 22 11:54:44 2014 +0100
     1.2 +++ b/MainForm.cs	Mon Dec 22 12:46:22 2014 +0100
     1.3 @@ -20,6 +20,8 @@
     1.4          private RemoteControlDevice _remote;
     1.5          private Label labelButtonName;
     1.6          private Label labelDeviceName;
     1.7 +        private ListView listViewEvents;
     1.8 +        private ColumnHeader columnHeaderEventName;
     1.9  		private Timer _timer;
    1.10  
    1.11  		public MainForm()
    1.12 @@ -59,13 +61,15 @@
    1.13  		{
    1.14              this.labelButtonName = new System.Windows.Forms.Label();
    1.15              this.labelDeviceName = new System.Windows.Forms.Label();
    1.16 +            this.listViewEvents = new System.Windows.Forms.ListView();
    1.17 +            this.columnHeaderEventName = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
    1.18              this.SuspendLayout();
    1.19              // 
    1.20              // labelButtonName
    1.21              // 
    1.22              this.labelButtonName.AutoSize = true;
    1.23              this.labelButtonName.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
    1.24 -            this.labelButtonName.Location = new System.Drawing.Point(257, 97);
    1.25 +            this.labelButtonName.Location = new System.Drawing.Point(600, 32);
    1.26              this.labelButtonName.Name = "labelButtonName";
    1.27              this.labelButtonName.Size = new System.Drawing.Size(103, 20);
    1.28              this.labelButtonName.TabIndex = 0;
    1.29 @@ -75,17 +79,39 @@
    1.30              // 
    1.31              this.labelDeviceName.AutoSize = true;
    1.32              this.labelDeviceName.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
    1.33 -            this.labelDeviceName.Location = new System.Drawing.Point(257, 67);
    1.34 +            this.labelDeviceName.Location = new System.Drawing.Point(600, 12);
    1.35              this.labelDeviceName.Name = "labelDeviceName";
    1.36              this.labelDeviceName.Size = new System.Drawing.Size(103, 20);
    1.37              this.labelDeviceName.TabIndex = 1;
    1.38              this.labelDeviceName.Text = "Device Name";
    1.39              // 
    1.40 +            // listViewEvents
    1.41 +            // 
    1.42 +            this.listViewEvents.Alignment = System.Windows.Forms.ListViewAlignment.Left;
    1.43 +            this.listViewEvents.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 
    1.44 +            | System.Windows.Forms.AnchorStyles.Left)));
    1.45 +            this.listViewEvents.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
    1.46 +            this.listViewEvents.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] {
    1.47 +            this.columnHeaderEventName});
    1.48 +            this.listViewEvents.GridLines = true;
    1.49 +            this.listViewEvents.Location = new System.Drawing.Point(12, 12);
    1.50 +            this.listViewEvents.Name = "listViewEvents";
    1.51 +            this.listViewEvents.Size = new System.Drawing.Size(582, 369);
    1.52 +            this.listViewEvents.TabIndex = 2;
    1.53 +            this.listViewEvents.UseCompatibleStateImageBehavior = false;
    1.54 +            this.listViewEvents.View = System.Windows.Forms.View.Details;
    1.55 +            // 
    1.56 +            // columnHeaderEventName
    1.57 +            // 
    1.58 +            this.columnHeaderEventName.Text = "Event Name";
    1.59 +            this.columnHeaderEventName.Width = 180;
    1.60 +            // 
    1.61              // MainForm
    1.62              // 
    1.63              this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
    1.64              this.BackColor = System.Drawing.SystemColors.Control;
    1.65 -            this.ClientSize = new System.Drawing.Size(784, 393);
    1.66 +            this.ClientSize = new System.Drawing.Size(926, 393);
    1.67 +            this.Controls.Add(this.listViewEvents);
    1.68              this.Controls.Add(this.labelDeviceName);
    1.69              this.Controls.Add(this.labelButtonName);
    1.70              this.Name = "MainForm";
    1.71 @@ -143,11 +169,13 @@
    1.72                  }
    1.73  
    1.74                  processed = true;
    1.75 +                listViewEvents.Items.Insert(0,labelButtonName.Text);
    1.76              }
    1.77              else if (e.ConsumerControl != Hid.UsageTables.ConsumerControl.Null)
    1.78              {
    1.79                  //Display consumer control name
    1.80                  labelButtonName.Text = e.ConsumerControl.ToString();
    1.81 +                listViewEvents.Items.Insert(0, labelButtonName.Text);
    1.82                  processed = true;
    1.83              }
    1.84              else