Client/MainForm.cs
changeset 79 76564df23849
parent 78 f0dda362f77e
child 80 408ef0501cb7
     1.1 --- a/Client/MainForm.cs	Tue Dec 16 13:24:12 2014 +0100
     1.2 +++ b/Client/MainForm.cs	Tue Dec 16 16:35:55 2014 +0100
     1.3 @@ -226,7 +226,6 @@
     1.4              DataField field = new DataField(0, bitmap);
     1.5              //We want our bitmap field to span across two rows
     1.6              field.RowSpan = 2;
     1.7 -            iClient.SetField(field);
     1.8  
     1.9              //Set texts
    1.10              iClient.SetFields(new DataField[]
    1.11 @@ -237,5 +236,62 @@
    1.12              });
    1.13  
    1.14          }
    1.15 +
    1.16 +        private void buttonIndicatorsLayout_Click(object sender, EventArgs e)
    1.17 +        {
    1.18 +            //Define a 2 by 4 layout
    1.19 +            TableLayout layout = new TableLayout(2, 4);
    1.20 +            //First column
    1.21 +            layout.Columns[0].Width = 87.5F;
    1.22 +            //Second column
    1.23 +            layout.Columns[1].Width = 12.5F;
    1.24 +            //Send layout to server
    1.25 +            iClient.SetLayout(layout);
    1.26 +
    1.27 +            //Create a bitmap for our indicators field
    1.28 +            int x1 = 0;
    1.29 +            int y1 = 0;
    1.30 +            int x2 = 32;
    1.31 +            int y2 = 16;
    1.32 +
    1.33 +            Bitmap bitmap = new Bitmap(x2, y2);
    1.34 +            Pen blackPen = new Pen(Color.Black, 3);
    1.35 +
    1.36 +            // Draw line to screen.
    1.37 +            using (var graphics = Graphics.FromImage(bitmap))
    1.38 +            {
    1.39 +                graphics.DrawLine(blackPen, x1, y1, x2, y2);
    1.40 +                graphics.DrawLine(blackPen, x1, y2, x2, y1);
    1.41 +            }
    1.42 +
    1.43 +            //Create a bitmap field from the bitmap we just created
    1.44 +            DataField indicator1 = new DataField(2, bitmap);
    1.45 +            //Create a bitmap field from the bitmap we just created
    1.46 +            DataField indicator2 = new DataField(3, bitmap);
    1.47 +            //Create a bitmap field from the bitmap we just created
    1.48 +            DataField indicator3 = new DataField(4, bitmap);
    1.49 +            //Create a bitmap field from the bitmap we just created
    1.50 +            DataField indicator4 = new DataField(5, bitmap);
    1.51 +
    1.52 +            //
    1.53 +            DataField textFieldTop = new DataField(0, textBoxTop.Text, Alignment);
    1.54 +            textFieldTop.RowSpan = 2;
    1.55 +
    1.56 +            DataField textFieldBottom = new DataField(1, textBoxBottom.Text, Alignment);
    1.57 +            textFieldBottom.RowSpan = 2;
    1.58 +
    1.59 +
    1.60 +            //Set texts
    1.61 +            iClient.SetFields(new DataField[]
    1.62 +            {
    1.63 +                textFieldTop,
    1.64 +                indicator1,
    1.65 +                indicator2,
    1.66 +                textFieldBottom,
    1.67 +                indicator3,
    1.68 +                indicator4
    1.69 +            });
    1.70 +
    1.71 +        }
    1.72      }
    1.73  }