示例#1
0
        public static void SetBitmapField()
        {
            DataField field = new BitmapField();

            if (!iClient.SetField(field))
            {
                Console.WriteLine("ERROR: field not found! Check layout and field creation.");
            }
        }
示例#2
0
        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 BitmapField(bitmap, 1, 0);
            //Create a bitmap field from the bitmap we just created
            DataField indicator2 = new BitmapField(bitmap, 1, 1);
            //Create a bitmap field from the bitmap we just created
            DataField indicator3 = new BitmapField(bitmap, 1, 2);
            //Create a bitmap field from the bitmap we just created
            DataField indicator4 = new BitmapField(bitmap, 1, 3);

            //
            TextField textFieldTop    = new TextField(textBoxTop.Text, Alignment, 0, 0, 1, 2);
            TextField textFieldBottom = new TextField(textBoxBottom.Text, Alignment, 0, 2, 1, 2);

            //Set texts
            iClient.CreateFields(new DataField[]
            {
                textFieldTop,
                textFieldBottom,
                indicator1,
                indicator2,
                indicator3,
                indicator4
            });
        }
示例#3
0
        /// <summary>
        ///
        /// </summary>
        private void CreateFields()
        {
            iRecordingField       = new RecordingField();
            iAudioVisualizerField = new AudioVisualizerField();

            if (iShowingEq)
            {
                iFields = new DataField[] { iAudioVisualizerField };
            }
            else
            {
                if (SupportsGraphics)
                {
                    //Create fields for testing our graphics support.
                    //Currently not used in production environment
                    iBitmapField         = new BitmapField(null, 0, 0, 1, 2);
                    iBitmapField.RowSpan = 2;
                    iTextFieldTop        = new TextField("", ContentAlignment.MiddleCenter, 1, 0);
                    iTextFieldBottom     = new TextField("", ContentAlignment.MiddleCenter, 1, 1);
                    iTextFieldSingleLine = new TextField("", ContentAlignment.MiddleCenter, 0, 0);

                    iFields = new DataField[] { iRecordingField, iBitmapField, iTextFieldTop, iTextFieldBottom };
                }
                else
                {
                    //Just make sure both fields are instantiated
                    iTextFieldTop        = new TextField("", ContentAlignment.MiddleCenter, 0, 0);
                    iTextFieldBottom     = new TextField("", ContentAlignment.MiddleCenter, 0, 1);
                    iTextFieldSingleLine = new TextField("", ContentAlignment.MiddleCenter, 0, 0);

                    if (SharpLibDisplay.Settings.Instance.SingleLine)
                    {
                        //Single line mode
                        iFields = new DataField[] { iRecordingField, iTextFieldSingleLine };
                    }
                    else
                    {
                        //Two lines mode use both fields
                        iFields = new DataField[] { iRecordingField, iTextFieldTop, iTextFieldBottom };
                    }
                }
            }

            iClient.CreateFields(iFields);
        }
示例#4
0
        /// <summary>
        /// Define a layout with a bitmap field on the left and two lines of text on the right.
        /// </summary>
        private void SetLayoutWithBitmap()
        {
            //Define a 2 by 2 layout
            TableLayout layout = new TableLayout(2, 2);

            //First column only takes 25%
            layout.Columns[0].Width = 25F;
            //Second column takes up 75%
            layout.Columns[1].Width = 75F;
            //Send layout to server
            iClient.SetLayout(layout);

            //Set a bitmap for our first field
            int x1 = 0;
            int y1 = 0;
            int x2 = 64;
            int y2 = 64;

            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
            //We want our bitmap field to span across two rows
            BitmapField bitmapField = new BitmapField(bitmap, 0, 0, 1, 2);

            //Set texts
            iClient.CreateFields(new DataField[]
            {
                bitmapField,
                new TextField(textBoxTop.Text, Alignment, 1, 0),
                new TextField(textBoxBottom.Text, Alignment, 1, 1)
            });
        }
示例#5
0
        private void buttonSetBitmap_Click(object sender, EventArgs e)
        {
            int x1 = 0;
            int y1 = 0;
            int x2 = 256;
            int y2 = 32;

            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);
            }

            DataField field = new BitmapField(bitmap);

            //field.ColumnSpan = 2;
            iClient.SetField(field);
        }
示例#6
0
    //
    void CreateFields()
    {
      iRecordingField = new RecordingField();

      if (SupportsGraphics)
      {
        //Create fields for testing our graphics support.
        //Currently not used in production environment
        iBitmapField = new BitmapField(null,0,0,1,2);
        iBitmapField.RowSpan = 2;
        iTextFieldTop = new TextField("",ContentAlignment.MiddleCenter,1,0);
        iTextFieldBottom = new TextField("", ContentAlignment.MiddleCenter, 1, 1);
        iTextFieldSingleLine = new TextField("", ContentAlignment.MiddleCenter, 0, 0);

        iFields = new DataField[] { iRecordingField, iBitmapField, iTextFieldTop, iTextFieldBottom };
      }
      else
      {
        //Just make sure both fields are instantiated
        iTextFieldTop = new TextField("", ContentAlignment.MiddleCenter, 0, 0);
        iTextFieldBottom = new TextField("", ContentAlignment.MiddleCenter, 0, 1);
        iTextFieldSingleLine = new TextField("", ContentAlignment.MiddleCenter, 0, 0);

        if (SharpLibDisplay.Settings.Instance.SingleLine)
        {
          //Single line mode
          iFields = new DataField[] { iRecordingField, iTextFieldSingleLine };
        }
        else
        {
          //Two lines mode use both fields
          iFields = new DataField[] { iRecordingField, iTextFieldTop, iTextFieldBottom };
        }
      }

      iClient.CreateFields(iFields);
    }