/// <summary> /// Displays/updates a horizontal bar graph. /// </summary> /// <param name="index"> /// The graph index to use. /// </param> /// <param name="style"> /// The graph style to use. /// </param> /// <param name="startCol"> /// The starting column for the graph (0 - 15). /// </param> /// <param name="endCol"> /// The ending column for the graph (0 - 15). /// </param> /// <param name="len"> /// The graph bar length (should be a value between startCol and endCol). /// </param> /// <param name="row"> /// The row to place the bar graph in (0 or 1). /// </param> public void SetBarGraph(GraphIndices index, GraphStyle style, UInt16 startCol, UInt16 endCol, UInt16 len, UInt16 row) { // Make sure start and end columns are valid. Also make sure the row is legit. if (startCol < 0) { startCol = 0; } if (endCol < 0) { endCol = 0; } if (row < 0) { row = 0; } switch (this._type) { case DisplayType.SixteenByTwo: if (startCol > 15) { startCol = 15; } if (endCol > 15) { endCol = 15; } if (row > 1) { row = 1; } break; case DisplayType.TwentyByFour: if (startCol > 19) { startCol = 19; } if (endCol > 19) { endCol = 19; } if (row > 3) { row = 3; } break; } if (endCol <= startCol) { throw new IndexOutOfRangeException("End column must be greater than start column."); } // Create the command buffer with all params. Byte[] buf = new Byte[7]; buf[0] = (Byte)CFCommand.CFHorizontalBarGraph; buf[1] = (Byte)index; buf[2] = (Byte)style; buf[3] = (Byte)startCol; buf[4] = (Byte)endCol; buf[5] = (Byte)len; buf[6] = (Byte)row; // Send the command and destroy the buffer. this.SendCommand(buf); Array.Clear(buf, 0, buf.Length); }