diff -r 42d62953c937 -r 150c4a9d7e26 Client/MainForm.cs --- a/Client/MainForm.cs Sat Dec 27 21:50:15 2014 +0100 +++ b/Client/MainForm.cs Sat Dec 27 21:52:14 2014 +0100 @@ -134,16 +134,24 @@ //TextField top = new TextField(0, textBoxTop.Text, ContentAlignment.MiddleLeft); iTextFieldTop.Text = textBoxTop.Text; iTextFieldTop.Alignment = Alignment; - iClient.SetField(iTextFieldTop); + bool res = iClient.SetField(iTextFieldTop); + + if (!res) + { + MessageBox.Show("Create you fields first", "Field update error", MessageBoxButtons.OK, MessageBoxIcon.Error); + } + + } private void buttonSetText_Click(object sender, EventArgs e) { - //iClient.SetText(0,"Top"); - //iClient.SetText(1, "Bottom"); - //TextField top = new TextField(0, textBoxTop.Text, ContentAlignment.MiddleLeft); + //Set one column two lines layout + TableLayout layout = new TableLayout(1, 2); + iClient.SetLayout(layout); - iClient.SetFields(new DataField[] + //Set our fields + iClient.CreateFields(new DataField[] { new DataField(0, textBoxTop.Text, Alignment), new DataField(1, textBoxBottom.Text, Alignment) @@ -178,7 +186,7 @@ } DataField field = new DataField(0, bitmap); - field.ColumnSpan = 2; + //field.ColumnSpan = 2; iClient.SetField(field); } @@ -221,10 +229,9 @@ DataField field = new DataField(0, bitmap); //We want our bitmap field to span across two rows field.RowSpan = 2; - iClient.SetField(field); //Set texts - iClient.SetFields(new DataField[] + iClient.CreateFields(new DataField[] { field, new DataField(1, textBoxTop.Text, Alignment), @@ -232,5 +239,78 @@ }); } + + private void buttonIndicatorsLayout_Click(object sender, EventArgs e) + { + //Define a 2 by 4 layout + TableLayout layout = new TableLayout(2, 4); + //First column + layout.Columns[0].Width = 87.5F; + //Second column + layout.Columns[1].Width = 12.5F; + //Send layout to server + iClient.SetLayout(layout); + + //Create a bitmap for our indicators field + int x1 = 0; + int y1 = 0; + int x2 = 32; + int y2 = 16; + + Bitmap bitmap = new Bitmap(x2, y2); + Pen blackPen = new Pen(Color.Black, 3); + + // Draw line to screen. + using (var graphics = Graphics.FromImage(bitmap)) + { + graphics.DrawLine(blackPen, x1, y1, x2, y2); + graphics.DrawLine(blackPen, x1, y2, x2, y1); + } + + //Create a bitmap field from the bitmap we just created + DataField indicator1 = new DataField(2, bitmap); + //Create a bitmap field from the bitmap we just created + DataField indicator2 = new DataField(3, bitmap); + //Create a bitmap field from the bitmap we just created + DataField indicator3 = new DataField(4, bitmap); + //Create a bitmap field from the bitmap we just created + DataField indicator4 = new DataField(5, bitmap); + + // + DataField textFieldTop = new DataField(0, textBoxTop.Text, Alignment); + textFieldTop.RowSpan = 2; + + DataField textFieldBottom = new DataField(1, textBoxBottom.Text, Alignment); + textFieldBottom.RowSpan = 2; + + + //Set texts + iClient.CreateFields(new DataField[] + { + textFieldTop, + indicator1, + indicator2, + textFieldBottom, + indicator3, + indicator4 + }); + + } + + private void buttonUpdateTexts_Click(object sender, EventArgs e) + { + + bool res = iClient.SetFields(new DataField[] + { + new DataField(0, textBoxTop.Text, Alignment), + new DataField(1, textBoxBottom.Text, Alignment) + }); + + if (!res) + { + MessageBox.Show("Create you fields first", "Field update error", MessageBoxButtons.OK, MessageBoxIcon.Error); + } + + } } }