Пример #1
0
        DrawColumnHeader
        (
            DrawingObjects oDrawingObjects,
            String sHeaderText,
            Int32 iLeft,
            Int32 iRight,
            ref Int32 iTop
        )
        {
            Debug.Assert(oDrawingObjects != null);
            Debug.Assert(!String.IsNullOrEmpty(sHeaderText));
            AssertValid();

            iTop += oDrawingObjects.GetFontHeightMultiple(0.2F);

            Int32 iColumnHeaderHeight =
                oDrawingObjects.GetFontHeightMultiple(1.3F);

            oDrawingObjects.Graphics.FillRectangle(SystemBrushes.ControlLight,
                                                   iLeft, iTop, iRight - iLeft - 1, iColumnHeaderHeight);

            oDrawingObjects.Graphics.DrawString(sHeaderText, oDrawingObjects.Font,
                                                SystemBrushes.ControlText,
                                                iLeft + oDrawingObjects.GetFontHeightMultiple(0.1F),
                                                iTop + oDrawingObjects.GetFontHeightMultiple(0.15F)
                                                );

            iTop += oDrawingObjects.GetFontHeightMultiple(1.5F);
        }
Пример #2
0
        ControlRectangleToTwoColumns
        (
            DrawingObjects oDrawingObjects,
            out Rectangle oColumn1Rectangle,
            out Rectangle oColumn2Rectangle
        )
        {
            Debug.Assert(oDrawingObjects != null);
            AssertValid();

            // Compute the rectangles so that the margin to the left of the first
            // column's rectangle, the margin to the right of the second column's
            // rectangle, and the margin between the rectangles is the constant
            // value of ColumnHorizontalMargin.

            Rectangle oControlRectangle = oDrawingObjects.ControlRectangle;
            Int32     iTwoColumnWidth   = GetTwoColumnWidth(oDrawingObjects);

            oColumn1Rectangle = new Rectangle(
                oControlRectangle.Left + ColumnHorizontalMargin,
                oControlRectangle.Top,
                iTwoColumnWidth - ((3 * ColumnHorizontalMargin) / 2),
                oControlRectangle.Height
                );

            oColumn2Rectangle = oColumn1Rectangle;

            oColumn2Rectangle.Offset(
                oColumn1Rectangle.Width + ColumnHorizontalMargin, 0);
        }
        DrawAutoFilledVertexResults
        (
            DrawingObjects oDrawingObjects,
            Rectangle oColumnRectangle
        )
        {
            Debug.Assert(oDrawingObjects != null);
            AssertValid();

            Int32 iTop = oColumnRectangle.Top;

            if (m_oAutoFillWorkbookResults.AutoFilledVertexNonXYColumnCount > 0)
            {
                DrawColumnHeader(oDrawingObjects, VertexPropertyHeader,
                                 oColumnRectangle.Left, oColumnRectangle.Right, ref iTop);

                Int32 iResultsLeft  = oColumnRectangle.Left;
                Int32 iResultsRight = oColumnRectangle.Right;

                AutoFillColorColumnResults oVertexColorResults =
                    m_oAutoFillWorkbookResults.VertexColorResults;

                if (oVertexColorResults.ColumnAutoFilled)
                {
                    DrawColorColumnResults(oDrawingObjects, ColorCaption,
                                           oVertexColorResults, VertexShape.Disk,
                                           oColumnRectangle, iResultsLeft, iResultsRight, ref iTop);
                }

                AutoFillNumericRangeColumnResults oVertexRadiusResults =
                    m_oAutoFillWorkbookResults.VertexRadiusResults;

                if (oVertexRadiusResults.ColumnAutoFilled)
                {
                    DrawRampResults(oDrawingObjects,
                                    oVertexRadiusResults.SourceColumnName, "Size",
                                    oVertexRadiusResults.SourceCalculationNumber1,
                                    oVertexRadiusResults.SourceCalculationNumber2,
                                    oVertexRadiusResults.DecimalPlaces, oColumnRectangle,
                                    iResultsLeft, iResultsRight, ref iTop);
                }

                AutoFillNumericRangeColumnResults oVertexAlphaResults =
                    m_oAutoFillWorkbookResults.VertexAlphaResults;

                if (oVertexAlphaResults.ColumnAutoFilled)
                {
                    DrawAutoFilledAlphaResults(oDrawingObjects,
                                               oVertexAlphaResults.SourceColumnName,
                                               oVertexAlphaResults.SourceCalculationNumber1,
                                               oVertexAlphaResults.SourceCalculationNumber2,
                                               oVertexAlphaResults.DecimalPlaces,
                                               oVertexAlphaResults.DestinationNumber1,
                                               oVertexAlphaResults.DestinationNumber2,
                                               oColumnRectangle, iResultsLeft, iResultsRight, ref iTop);
                }
            }

            return(iTop);
        }
        DrawAutoFilledEdgeResults
        (
            DrawingObjects oDrawingObjects,
            Rectangle oColumnRectangle
        )
        {
            Debug.Assert(oDrawingObjects != null);
            AssertValid();

            Int32 iTop = oColumnRectangle.Top;

            if (m_oAutoFillWorkbookResults.AutoFilledEdgeColumnCount > 0)
            {
                DrawColumnHeader(oDrawingObjects, EdgePropertyHeader,
                                 oColumnRectangle.Left, oColumnRectangle.Right, ref iTop);

                Int32 iResultsLeft  = oColumnRectangle.Left;
                Int32 iResultsRight = oColumnRectangle.Right;

                AutoFillColorColumnResults oEdgeColorResults =
                    m_oAutoFillWorkbookResults.EdgeColorResults;

                if (oEdgeColorResults.ColumnAutoFilled)
                {
                    DrawColorColumnResults(oDrawingObjects, ColorCaption,
                                           oEdgeColorResults, VertexShape.SolidSquare,
                                           oColumnRectangle, iResultsLeft, iResultsRight, ref iTop);
                }

                AutoFillNumericRangeColumnResults oEdgeWidthResults =
                    m_oAutoFillWorkbookResults.EdgeWidthResults;

                if (oEdgeWidthResults.ColumnAutoFilled)
                {
                    DrawRampResults(oDrawingObjects,
                                    oEdgeWidthResults.SourceColumnName, EdgeWidthCaption,
                                    oEdgeWidthResults.SourceCalculationNumber1,
                                    oEdgeWidthResults.SourceCalculationNumber2,
                                    oEdgeWidthResults.DecimalPlaces, oColumnRectangle,
                                    iResultsLeft, iResultsRight, ref iTop);
                }

                AutoFillNumericRangeColumnResults oEdgeAlphaResults =
                    m_oAutoFillWorkbookResults.EdgeAlphaResults;

                if (oEdgeAlphaResults.ColumnAutoFilled)
                {
                    DrawAutoFilledAlphaResults(oDrawingObjects,
                                               oEdgeAlphaResults.SourceColumnName,
                                               oEdgeAlphaResults.SourceCalculationNumber1,
                                               oEdgeAlphaResults.SourceCalculationNumber2,
                                               oEdgeAlphaResults.DecimalPlaces,
                                               oEdgeAlphaResults.DestinationNumber1,
                                               oEdgeAlphaResults.DestinationNumber2,
                                               oColumnRectangle, iResultsLeft, iResultsRight, ref iTop);
                }
            }

            return(iTop);
        }
Пример #5
0
        private void ClockTickTak()
        {
            if (speRPM.Value > 0)
            {
                if (chMonitor.Checked)
                {
                    InitMonitor();

                    DrawingObjects.DrawSensor(graphics);
                    DrawingObjects.DrawRotation(graphics, (int)(((decimal)tack / ticksByRottation) * 360M));
                }
                if (tack >= ticksByRottation)
                {
                    OnSensor();
                    tack = 0;
                }
                decimal kvant = (1000000M / (speRPM.Value / 60M)) / ticksByRottation;
                ticks += (ulong)kvant;

                if (tableRPMPoints.Length > 0 && tableIgnDelays.Length > 0)
                {
                    loop();
                }

                lbTicks.Text = ticks.ToString("0,0");
                tack++;
            }
        }
        DrawColorBarResults
        (
            DrawingObjects oDrawingObjects,
            String sSourceColumnName,
            String sCaption,
            Double dSourceCalculationNumber1,
            Double dSourceCalculationNumber2,
            Int32 iDecimalPlaces,
            Color oColor1,
            Color oColor2,
            Rectangle oColumnRectangle,
            Int32 iResultsLeft,
            Int32 iResultsRight,
            ref Int32 iTop
        )
        {
            Debug.Assert(oDrawingObjects != null);
            Debug.Assert(!String.IsNullOrEmpty(sSourceColumnName));
            Debug.Assert(!String.IsNullOrEmpty(sCaption));
            Debug.Assert(iDecimalPlaces >= 0);
            AssertValid();

            if (dSourceCalculationNumber2 == dSourceCalculationNumber1)
            {
                // All the source numbers were the same.  Draw one color only.

                oColor2 = oColor1;
            }

            DrawColorBarResults(oDrawingObjects, sSourceColumnName, sCaption,
                                DoubleToString(dSourceCalculationNumber1, iDecimalPlaces),
                                DoubleToString(dSourceCalculationNumber2, iDecimalPlaces),
                                oColor1, oColor2, oColumnRectangle, iResultsLeft, iResultsRight,
                                ref iTop);
        }
Пример #7
0
        CreateDrawingObjects
        (
            Graphics oGraphics,
            Rectangle oControlRectangle
        )
        {
            Debug.Assert(oGraphics != null);
            AssertValid();

            DrawingObjects oDrawingObjects = new DrawingObjects();

            oDrawingObjects.Graphics         = oGraphics;
            oDrawingObjects.ControlRectangle = oControlRectangle;
            oDrawingObjects.Font             = this.Font;

            oDrawingObjects.FontHeight =
                oDrawingObjects.Font.GetHeight(oDrawingObjects.Graphics);

            oDrawingObjects.TrimmingStringFormat = new StringFormat();

            oDrawingObjects.TrimmingStringFormat.Trimming =
                StringTrimming.EllipsisCharacter;

            oDrawingObjects.RightAlignStringFormat           = new StringFormat();
            oDrawingObjects.RightAlignStringFormat.Alignment = StringAlignment.Far;

            oDrawingObjects.CenterAlignStringFormat = new StringFormat();

            oDrawingObjects.CenterAlignStringFormat.Alignment =
                StringAlignment.Center;

            return(oDrawingObjects);
        }
Пример #8
0
        DrawRangeText
        (
            DrawingObjects oDrawingObjects,
            String sLeftText,
            String sRightText,
            Brush oBrush,
            ref Int32 iLeft,
            ref Int32 iRight,
            ref Int32 iTop
        )
        {
            Debug.Assert(oDrawingObjects != null);
            Debug.Assert(!String.IsNullOrEmpty(sLeftText));
            Debug.Assert(!String.IsNullOrEmpty(sRightText));
            Debug.Assert(oBrush != null);
            AssertValid();

            oDrawingObjects.Graphics.DrawString(sLeftText, oDrawingObjects.Font,
                                                oBrush, iLeft, iTop);

            oDrawingObjects.Graphics.DrawString(sRightText, oDrawingObjects.Font,
                                                oBrush, iRight, iTop, oDrawingObjects.RightAlignStringFormat);

            iLeft  += MeasureTextWidth(oDrawingObjects, sLeftText);
            iRight -= MeasureTextWidth(oDrawingObjects, sRightText);
            iTop   += oDrawingObjects.GetFontHeightMultiple(1.0F);
        }
Пример #9
0
        DrawAvailableRangeText
        (
            DrawingObjects oDrawingObjects,
            IDynamicFilterRangeTrackBar oDynamicFilterRangeTrackBar,
            ref Int32 iAvailableRangeTextLeft,
            ref Int32 iAvailableRangeTextRight,
            ref Int32 iTop
        )
        {
            Debug.Assert(oDrawingObjects != null);
            Debug.Assert(oDynamicFilterRangeTrackBar != null);
            AssertValid();

            DrawRangeText(oDrawingObjects,

                          oDynamicFilterRangeTrackBar.ValueToString(
                              oDynamicFilterRangeTrackBar.AvailableMinimum),

                          oDynamicFilterRangeTrackBar.ValueToString(
                              oDynamicFilterRangeTrackBar.AvailableMaximum),

                          SystemBrushes.GrayText, ref iAvailableRangeTextLeft,
                          ref iAvailableRangeTextRight, ref iTop
                          );

            iTop += oDrawingObjects.GetFontHeightMultiple(0.4F);
        }
Пример #10
0
        private void Redraw()
        {
            DrawingObjects.BackgroundColor = pnMonitor.BackColor;
            DrawingObjects.figureX         = pnMonitor.Width / 2 - DrawingObjects.circleRadius;
            DrawingObjects.figureY         = pnMonitor.Height / 2 - DrawingObjects.circleRadius;

            graphics = pnMonitor.CreateGraphics();
            graphics.Clear(DrawingObjects.BackgroundColor);
            DrawingObjects.DrawBase(graphics);
            DrawingObjects.DrawSensor(graphics);
        }
        DrawRampResults
        (
            DrawingObjects oDrawingObjects,
            String sSourceColumnName,
            String sCaption,
            Double dSourceCalculationNumber1,
            Double dSourceCalculationNumber2,
            Int32 iDecimalPlaces,
            Rectangle oColumnRectangle,
            Int32 iResultsLeft,
            Int32 iResultsRight,
            ref Int32 iTop
        )
        {
            Debug.Assert(oDrawingObjects != null);
            Debug.Assert(!String.IsNullOrEmpty(sSourceColumnName));
            Debug.Assert(!String.IsNullOrEmpty(sCaption));
            Debug.Assert(iDecimalPlaces >= 0);
            AssertValid();

            iTop += oDrawingObjects.GetFontHeightMultiple(0.2F);

            DrawRangeText(oDrawingObjects,
                          DoubleToString(dSourceCalculationNumber1, iDecimalPlaces),
                          DoubleToString(dSourceCalculationNumber2, iDecimalPlaces),
                          SystemBrushes.WindowText, iResultsLeft, iResultsRight, ref iTop);

            iTop += oDrawingObjects.GetFontHeightMultiple(0.35F);

            Int32 iRampMargin = oDrawingObjects.GetFontHeightMultiple(0.1F);

            Graphics      oGraphics         = oDrawingObjects.Graphics;
            SmoothingMode eOldSmoothingMode = oGraphics.SmoothingMode;

            oGraphics.SmoothingMode = SmoothingMode.HighQuality;

            oGraphics.FillPolygon(SystemBrushes.ControlDarkDark, new Point[] {
                new Point(iResultsLeft, iTop + RampHeight - 2),
                new Point(iResultsLeft, iTop + RampHeight - 1),
                new Point(iResultsRight - iRampMargin, iTop + RampHeight - 1),
                new Point(iResultsRight - iRampMargin, iTop - 1)
            });

            oGraphics.SmoothingMode = eOldSmoothingMode;

            iTop += RampHeight + oDrawingObjects.GetFontHeightMultiple(0.05F);

            DrawExcelColumnNameAndCaption(oDrawingObjects, sSourceColumnName,
                                          sCaption, iResultsLeft, iResultsRight, ref iTop);

            // Draw a line separating these results from the next.

            DrawHorizontalSeparator(oDrawingObjects, oColumnRectangle, ref iTop);
        }
Пример #12
0
        } // end of RemoveObject

        #endregion

        #region ClearSystem

        /// <summary>
        /// Removes all drawing objects from the system
        /// </summary>
        public void ClearSystem()
        {
            while (DrawingObjects.Count > 0)
            {
                DrawingObject objectToRemove = DrawingObjects.First();

                objectToRemove.ParentCoordinateSystem = null;
                _drawingObjects.Remove(objectToRemove);
                Children.Remove(objectToRemove.DrawingShape);
            } // end while

            UpdateObjectsRendering();
        } // end of ClearSystem
Пример #13
0
        MeasureTextWidth
        (
            DrawingObjects oDrawingObjects,
            String sText
        )
        {
            Debug.Assert(oDrawingObjects != null);
            Debug.Assert(!String.IsNullOrEmpty(sText));
            AssertValid();

            return((Int32)Math.Ceiling(oDrawingObjects.Graphics.MeasureString(
                                           sText, oDrawingObjects.Font).Width));
        }
Пример #14
0
        DrawColumnSeparator
        (
            DrawingObjects oDrawingObjects,
            Rectangle oColumn2Rectangle
        )
        {
            Debug.Assert(oDrawingObjects != null);
            AssertValid();

            oDrawingObjects.Graphics.DrawLine(SystemPens.ControlLight,
                                              oColumn2Rectangle.Left, oColumn2Rectangle.Top,
                                              oColumn2Rectangle.Left, oColumn2Rectangle.Bottom);
        }
Пример #15
0
        DrawDynamicFilterRangeTrackBars
        (
            DrawingObjects oDrawingObjects,
            String sGroupName,
            ICollection <IDynamicFilterRangeTrackBar> oDynamicFilterRangeTrackBars,
            Rectangle oColumnRectangle
        )
        {
            Debug.Assert(oDrawingObjects != null);
            Debug.Assert(!String.IsNullOrEmpty(sGroupName));
            Debug.Assert(oDynamicFilterRangeTrackBars != null);
            AssertValid();

            Int32 iTop = oColumnRectangle.Top;

            if (oDynamicFilterRangeTrackBars.Count > 0)
            {
                // Draw the group name at the top of the group.

                DrawColumnHeader(oDrawingObjects, sGroupName, oColumnRectangle.Left,
                                 oColumnRectangle.Right, ref iTop);

                // Provide a margin.

                Rectangle oColumnRectangleWithMargin = AddMarginToRectangle(
                    oDrawingObjects, oColumnRectangle);

                Int32 iTrackBarLeft  = oColumnRectangleWithMargin.Left;
                Int32 iTrackBarRight = oColumnRectangleWithMargin.Right;

                Pen oAvailableRangeLinePen = new Pen(SystemBrushes.ControlDark,
                                                     AvailableLineHeight);

                Pen oSelectedRangeLinePen = new Pen(SystemBrushes.Highlight,
                                                    SelectedLineHeight);

                foreach (IDynamicFilterRangeTrackBar oDynamicFilterRangeTrackBar in
                         oDynamicFilterRangeTrackBars)
                {
                    DrawDynamicFilterRangeTrackBar(oDrawingObjects,
                                                   oDynamicFilterRangeTrackBar, oAvailableRangeLinePen,
                                                   oSelectedRangeLinePen, oColumnRectangle, iTrackBarLeft,
                                                   iTrackBarRight, ref iTop);
                }

                oAvailableRangeLinePen.Dispose();
                oSelectedRangeLinePen.Dispose();
            }

            return(iTop);
        }
Пример #16
0
        DrawSelectedRangeLine
        (
            DrawingObjects oDrawingObjects,
            IDynamicFilterRangeTrackBar oDynamicFilterRangeTrackBar,
            Pen oSelectedRangeLinePen,
            Int32 iAvailableRangeLineLeft,
            Int32 iAvailableRangeLineRight,
            out Int32 iSelectedRangeLineLeft,
            out Int32 iSelectedRangeLineRight,
            ref Int32 iTop
        )
        {
            Debug.Assert(oDrawingObjects != null);
            Debug.Assert(oDynamicFilterRangeTrackBar != null);
            Debug.Assert(oSelectedRangeLinePen != null);
            AssertValid();

            iSelectedRangeLineLeft = GetXWithinAvailableLine(
                oDynamicFilterRangeTrackBar.SelectedMinimum,
                oDynamicFilterRangeTrackBar, iAvailableRangeLineLeft,
                iAvailableRangeLineRight);

            iSelectedRangeLineRight = GetXWithinAvailableLine(
                oDynamicFilterRangeTrackBar.SelectedMaximum,
                oDynamicFilterRangeTrackBar, iAvailableRangeLineLeft,
                iAvailableRangeLineRight);

            // Don't let the line have zero width.

            if (iSelectedRangeLineRight == iSelectedRangeLineLeft)
            {
                if (iSelectedRangeLineLeft == iAvailableRangeLineLeft)
                {
                    iSelectedRangeLineRight += MinimumSelectedLineWidth;
                }
                else if (iSelectedRangeLineRight == iAvailableRangeLineRight)
                {
                    iSelectedRangeLineLeft -= MinimumSelectedLineWidth;
                }
                else
                {
                    iSelectedRangeLineLeft  -= (MinimumSelectedLineWidth / 2);
                    iSelectedRangeLineRight += (MinimumSelectedLineWidth / 2);
                }
            }

            oDrawingObjects.Graphics.DrawLine(oSelectedRangeLinePen,
                                              iSelectedRangeLineLeft, iTop, iSelectedRangeLineRight, iTop);

            iTop += AvailableLineHeight;
        }
        Draw
        (
            DrawingObjects oDrawingObjects
        )
        {
            Debug.Assert(oDrawingObjects != null);
            AssertValid();

            if (m_oAutoFillWorkbookResults.AutoFilledNonXYColumnCount > 0)
            {
                return(DrawAutoFillWorkbookResults(oDrawingObjects));
            }

            return(oDrawingObjects.ControlRectangle.Top);
        }
Пример #18
0
        DrawHorizontalSeparator
        (
            DrawingObjects oDrawingObjects,
            Rectangle oColumnRectangle,
            ref Int32 iTop
        )
        {
            Debug.Assert(oDrawingObjects != null);
            AssertValid();

            oDrawingObjects.Graphics.DrawLine(SystemPens.ControlLight,
                                              oColumnRectangle.Left, iTop, oColumnRectangle.Right, iTop);

            iTop += 1;
        }
Пример #19
0
 private void MainImageContainer_KeyDown(object sender, System.Windows.Input.KeyEventArgs e)
 {
     if (e.Key == System.Windows.Input.Key.Delete)
     {
         switch (currentState)
         {
         case UIState.SelectingPoints:
         case UIState.MovingExistingPoints:
             DrawingObjects.RemoveAll(shape => shape.GetTranslationPoints().Intersect(selectedPoints.Keys).Any());
             selectedPoints.Clear();
             UpdateMainImage();
             break;
         }
     }
 }
Пример #20
0
        Draw
        (
            DrawingObjects oDrawingObjects
        )
        {
            Debug.Assert(oDrawingObjects != null);
            AssertValid();

            // If there are edge track bars and vertex track bars, two columns are
            // drawn, with the edge track bars in the first column and the vertex
            // track bars in the second.  If there are only edge or vertex track
            // bars, one column is drawn.

            Rectangle oColumn1Rectangle, oColumn2Rectangle;
            Boolean   bHasTwoColumns = false;

            if (m_oEdgeDynamicFilterRangeTrackBars.Count > 0 &&
                m_oVertexDynamicFilterRangeTrackBars.Count > 0)
            {
                ControlRectangleToTwoColumns(oDrawingObjects,
                                             out oColumn1Rectangle, out oColumn2Rectangle);

                bHasTwoColumns = true;
            }
            else
            {
                oColumn1Rectangle = oDrawingObjects.ControlRectangle;
                AddMarginsToColumnRectangle(ref oColumn1Rectangle);
                oColumn2Rectangle = oColumn1Rectangle;
            }

            Int32 iBottom = Math.Max(

                DrawDynamicFilterRangeTrackBars(oDrawingObjects, "Edge Filters",
                                                m_oEdgeDynamicFilterRangeTrackBars, oColumn1Rectangle),

                DrawDynamicFilterRangeTrackBars(oDrawingObjects, "Vertex Filters",
                                                m_oVertexDynamicFilterRangeTrackBars, oColumn2Rectangle)
                );

            if (bHasTwoColumns)
            {
                DrawColumnSeparator(oDrawingObjects, oColumn2Rectangle);
            }

            return(iBottom);
        }
Пример #21
0
        AddMarginToRectangle
        (
            DrawingObjects oDrawingObjects,
            Rectangle oRectangle
        )
        {
            Debug.Assert(oDrawingObjects != null);
            AssertValid();

            Rectangle   oRectangleWithMargin = oRectangle;
            const Int32 HorizontalMargin     = 1;
            const Int32 VerticalMargin       = 0;

            oRectangleWithMargin.Inflate(-HorizontalMargin, -VerticalMargin);

            return(oRectangleWithMargin);
        }
Пример #22
0
        protected override void Execute(CodeActivityContext context)
        {
            base.Execute(context);
            var sheetPassword = SheetPassword.Get(context);

            if (string.IsNullOrEmpty(sheetPassword))
            {
                sheetPassword = null;
            }
            if (!string.IsNullOrEmpty(sheetPassword) && worksheet != null)
            {
                worksheet.Protect(sheetPassword, DrawingObjects.Get(context), Contents.Get(context), Scenarios.Get(context),
                                  UserInterfaceOnly.Get(context), AllowFormattingCells.Get(context), AllowFormattingColumns.Get(context), AllowFormattingRows.Get(context),
                                  AllowInsertingColumns.Get(context), AllowInsertingRows.Get(context), AllowInsertingHyperlinks.Get(context), AllowDeletingColumns.Get(context),
                                  AllowDeletingRows.Get(context), AllowSorting.Get(context), AllowFiltering.Get(context), AllowUsingPivotTables.Get(context));
            }
        }
        DrawColorColumnResults
        (
            DrawingObjects oDrawingObjects,
            String sCaption,
            AutoFillColorColumnResults oColorResults,
            VertexShape eCategoryShape,
            Rectangle oColumnRectangle,
            Int32 iResultsLeft,
            Int32 iResultsRight,
            ref Int32 iTop
        )
        {
            Debug.Assert(oDrawingObjects != null);
            Debug.Assert(!String.IsNullOrEmpty(sCaption));
            Debug.Assert(oColorResults != null);

            if (oColorResults.SourceColumnContainsNumbers)
            {
                DrawColorBarResults(oDrawingObjects,
                                    oColorResults.SourceColumnName, ColorCaption,
                                    oColorResults.SourceCalculationNumber1,
                                    oColorResults.SourceCalculationNumber2,
                                    oColorResults.DecimalPlaces,
                                    oColorResults.DestinationColor1,
                                    oColorResults.DestinationColor2,
                                    oColumnRectangle, iResultsLeft, iResultsRight,
                                    ref iTop);
            }
            else
            {
                DrawColorCategoryResults(oDrawingObjects,
                                         oColorResults.CategoryNames,

                                         (Int32 categoryIndex, out VertexShape categoryShape,
                                          out Color categoryColor) =>
                {
                    categoryShape = eCategoryShape;

                    categoryColor = ColorUtil.GetUniqueColor(categoryIndex,
                                                             oColorResults.CategoryNames.Count);
                },

                                         oColumnRectangle, ref iTop
                                         );
            }
        }
Пример #24
0
        private void OnSensor()
        {
            if (chMonitor.Checked)
            {
                DrawingObjects.DrawOnSensor(graphics);
            }
            pnLed.BackColor = Color.BlueViolet;

            deltaTime = micros() - lastTime;
            lastTime  = micros();
            sensor    = 1;

            if (deltaTime > 0)
            {
                monRPM.Text = Convert.ToString(Convert.ToInt32(60000000M / deltaTime)) + " rpm";
            }
        }
Пример #25
0
        private void InitMonitor()
        {
            speTicksByRotation.Value = ticksByRottation;

            initParametrs(chRoundNotation360.Checked);

            if (!monitorInit)
            {
                monitorInit = true;
                DrawingObjects.BackgroundColor = pnMonitor.BackColor;
                DrawingObjects.figureX         = pnMonitor.Width / 2 - DrawingObjects.circleRadius;
                DrawingObjects.figureY         = pnMonitor.Height / 2 - DrawingObjects.circleRadius;

                graphics = pnMonitor.CreateGraphics();
                DrawingObjects.DrawBase(graphics);
                DrawingObjects.DrawSensor(graphics);
            }
        }
Пример #26
0
        DrawColumnSeparator
        (
            DrawingObjects oDrawingObjects,
            Rectangle oColumn2Rectangle
        )
        {
            Debug.Assert(oDrawingObjects != null);
            AssertValid();

            // This code was removed in April 2011.  It is kept as a placeholder in
            // case the separator is requested again.

        #if false
            oDrawingObjects.Graphics.DrawLine(SystemPens.ControlLight,
                                              oColumn2Rectangle.Left, oColumn2Rectangle.Top,
                                              oColumn2Rectangle.Left, oColumn2Rectangle.Bottom);
        #endif
        }
        DrawAutoFillWorkbookResults
        (
            DrawingObjects oDrawingObjects
        )
        {
            Debug.Assert(oDrawingObjects != null);
            AssertValid();

            // If there are autofilled edge and vertex results, two columns are
            // drawn, with the edge results in the first column and the vertex
            // results in the second.  If there are only edge or vertex results,
            // one column is drawn.

            Rectangle oColumn1Rectangle, oColumn2Rectangle;
            Boolean   bHasTwoColumns = false;

            if (m_oAutoFillWorkbookResults.AutoFilledEdgeColumnCount > 0 &&
                m_oAutoFillWorkbookResults.AutoFilledVertexNonXYColumnCount > 0)
            {
                ControlRectangleToTwoColumns(oDrawingObjects,
                                             out oColumn1Rectangle, out oColumn2Rectangle);

                bHasTwoColumns = true;
            }
            else
            {
                oColumn1Rectangle = oDrawingObjects.ControlRectangle;
                AddMarginsToColumnRectangle(ref oColumn1Rectangle);
                oColumn2Rectangle = oColumn1Rectangle;
            }

            Int32 iBottom = Math.Max(
                DrawAutoFilledEdgeResults(oDrawingObjects, oColumn1Rectangle),
                DrawAutoFilledVertexResults(oDrawingObjects, oColumn2Rectangle)
                );

            if (bHasTwoColumns)
            {
                DrawColumnSeparator(oDrawingObjects, oColumn2Rectangle);
            }

            return(iBottom);
        }
        DrawAutoFilledAlphaResults
        (
            DrawingObjects oDrawingObjects,
            String sSourceColumnName,
            Double dSourceCalculationNumber1,
            Double dSourceCalculationNumber2,
            Int32 iDecimalPlaces,
            Double dDestinationNumber1,
            Double dDestinationNumber2,
            Rectangle oColumnRectangle,
            Int32 iResultsLeft,
            Int32 iResultsRight,
            ref Int32 iTop
        )
        {
            Debug.Assert(oDrawingObjects != null);
            Debug.Assert(!String.IsNullOrEmpty(sSourceColumnName));
            Debug.Assert(iDecimalPlaces >= 0);
            AssertValid();

            // The alpha results look like the color results, with the colors set
            // to black with different alphas.  Calculate the colors.

            AlphaConverter oAlphaConverter = new AlphaConverter();

            Int32 iDestinationAlpha1 = (Int32)oAlphaConverter.WorkbookToGraph(
                (Single)dDestinationNumber1);

            Int32 iDestinationAlpha2 = (Int32)oAlphaConverter.WorkbookToGraph(
                (Single)dDestinationNumber2);

            Color oDestinationColor1 =
                Color.FromArgb(iDestinationAlpha1, SystemColors.WindowText);

            Color oDestinationColor2 =
                Color.FromArgb(iDestinationAlpha2, SystemColors.WindowText);

            DrawColorBarResults(oDrawingObjects, sSourceColumnName, "Opacity",
                                dSourceCalculationNumber1, dSourceCalculationNumber2,
                                iDecimalPlaces, oDestinationColor1, oDestinationColor2,
                                oColumnRectangle, iResultsLeft, iResultsRight, ref iTop);
        }
Пример #29
0
        ControlRectangleToTwoColumns
        (
            DrawingObjects oDrawingObjects,
            out Rectangle oColumn1Rectangle,
            out Rectangle oColumn2Rectangle
        )
        {
            Debug.Assert(oDrawingObjects != null);
            AssertValid();

            Rectangle oControlRectangle = oDrawingObjects.ControlRectangle;
            Int32     iTwoColumnWidth   = GetTwoColumnWidth(oDrawingObjects);

            oColumn1Rectangle = new Rectangle(oControlRectangle.Left,
                                              oControlRectangle.Top, iTwoColumnWidth,
                                              oControlRectangle.Height);

            oColumn2Rectangle = oColumn1Rectangle;
            oColumn2Rectangle.Offset(iTwoColumnWidth, 0);
        }
Пример #30
0
        DrawRangeText
        (
            DrawingObjects oDrawingObjects,
            String sLeftText,
            String sRightText,
            Brush oBrush,
            Int32 iLeft,
            Int32 iRight,
            ref Int32 iTop
        )
        {
            Debug.Assert(oDrawingObjects != null);
            Debug.Assert(!String.IsNullOrEmpty(sLeftText));
            Debug.Assert(!String.IsNullOrEmpty(sRightText));
            Debug.Assert(oBrush != null);
            AssertValid();

            DrawRangeText(oDrawingObjects, sLeftText, sRightText, oBrush,
                          ref iLeft, ref iRight, ref iTop);
        }
    DrawAutoFilledVertexResults
    (
        DrawingObjects oDrawingObjects,
        Rectangle oColumnRectangle
    )
    {
        Debug.Assert(oDrawingObjects != null);
        AssertValid();

        Int32 iTop = oColumnRectangle.Top;

        if (m_oAutoFillWorkbookResults.AutoFilledVertexNonXYColumnCount > 0)
        {
            DrawColumnHeader(oDrawingObjects, VertexPropertyHeader,
                oColumnRectangle.Left, oColumnRectangle.Right, ref iTop);

            Int32 iResultsLeft = oColumnRectangle.Left;
            Int32 iResultsRight = oColumnRectangle.Right;

            AutoFillColorColumnResults oVertexColorResults =
                m_oAutoFillWorkbookResults.VertexColorResults;

            if (oVertexColorResults.ColumnAutoFilled)
            {
                DrawColorColumnResults(oDrawingObjects, ColorCaption,
                    oVertexColorResults, VertexShape.Disk,
                    oColumnRectangle, iResultsLeft, iResultsRight, ref iTop);
            }

            AutoFillNumericRangeColumnResults oVertexRadiusResults =
                m_oAutoFillWorkbookResults.VertexRadiusResults;

            if (oVertexRadiusResults.ColumnAutoFilled)
            {
                DrawRampResults(oDrawingObjects,
                    oVertexRadiusResults.SourceColumnName, "Size",
                    oVertexRadiusResults.SourceCalculationNumber1,
                    oVertexRadiusResults.SourceCalculationNumber2,
                    oVertexRadiusResults.DecimalPlaces, oColumnRectangle,
                    iResultsLeft, iResultsRight, ref iTop);
            }

            AutoFillNumericRangeColumnResults oVertexAlphaResults =
                m_oAutoFillWorkbookResults.VertexAlphaResults;

            if (oVertexAlphaResults.ColumnAutoFilled)
            {
                DrawAutoFilledAlphaResults(oDrawingObjects,
                    oVertexAlphaResults.SourceColumnName,
                    oVertexAlphaResults.SourceCalculationNumber1,
                    oVertexAlphaResults.SourceCalculationNumber2,
                    oVertexAlphaResults.DecimalPlaces,
                    oVertexAlphaResults.DestinationNumber1,
                    oVertexAlphaResults.DestinationNumber2,
                    oColumnRectangle, iResultsLeft, iResultsRight, ref iTop);
            }
        }

        return (iTop);
    }
    GetTwoColumnWidth
    (
        DrawingObjects oDrawingObjects
    )
    {
        Debug.Assert(oDrawingObjects != null);
        AssertValid();

        // Note for the DynamicFiltersLegendControl derived class:
        //
        // The widest filter will be one that filters on a date and time, so
        // the reliable way to compute a minimum width would be to base it on
        // the width of a date and time string.  This yields too great a width
        // for most other filters, however, so just use an arbitrary multiple
        // of the font size instead.

        return ( (Int32)Math.Max(
            oDrawingObjects.ControlRectangle.Width / 2F,
            8.5F * oDrawingObjects.FontHeight
            ) );
    }
    DrawDynamicFilterRangeTrackBar
    (
        DrawingObjects oDrawingObjects,
        IDynamicFilterRangeTrackBar oDynamicFilterRangeTrackBar,
        Pen oAvailableRangeLinePen,
        Pen oSelectedRangeLinePen,
        Rectangle oColumnRectangle,
        Int32 iTrackBarLeft,
        Int32 iTrackBarRight,
        ref Int32 iTop
    )
    {
        Debug.Assert(oDrawingObjects != null);
        Debug.Assert(oDynamicFilterRangeTrackBar != null);
        Debug.Assert(oAvailableRangeLinePen != null);
        Debug.Assert(oSelectedRangeLinePen != null);

        iTop += oDrawingObjects.GetFontHeightMultiple(0.2F);

        // Draw the text for the available range.

        Int32 iAvailableRangeTextLeft = iTrackBarLeft;
        Int32 iAvailableRangeTextRight = iTrackBarRight;
        Int32 iAvailableRangeTextTop = iTop;

        DrawAvailableRangeText(oDrawingObjects, oDynamicFilterRangeTrackBar,
            ref iAvailableRangeTextLeft, ref iAvailableRangeTextRight,
            ref iTop);

        // Draw the line representing the available range.

        Int32 iLineMargin = oDrawingObjects.GetFontHeightMultiple(0.1F);
        Int32 iAvailableRangeLineLeft = iTrackBarLeft + iLineMargin;
        Int32 iAvailableRangeLineRight = iTrackBarRight - iLineMargin;

        oDrawingObjects.Graphics.DrawLine(oAvailableRangeLinePen,
            iAvailableRangeLineLeft, iTop, iAvailableRangeLineRight, iTop);

        // Draw the line representing the selected range.

        Int32 iSelectedRangeLineLeft, iSelectedRangeLineRight;

        DrawSelectedRangeLine(oDrawingObjects, oDynamicFilterRangeTrackBar,
            oSelectedRangeLinePen, iAvailableRangeLineLeft,
            iAvailableRangeLineRight, out iSelectedRangeLineLeft,
            out iSelectedRangeLineRight, ref iTop);

        // Draw the text for the selected range.

        DrawSelectedRangeText(oDrawingObjects, oDynamicFilterRangeTrackBar,
            iAvailableRangeTextLeft, iAvailableRangeTextRight,
            iSelectedRangeLineLeft, iSelectedRangeLineRight,
            iAvailableRangeTextTop);

        DrawExcelColumnName(oDrawingObjects,
            oDynamicFilterRangeTrackBar.ColumnName, iTrackBarLeft,
            iTrackBarRight, ref iTop);

        // Draw a line separating this track bar from the next.

        DrawHorizontalSeparator(oDrawingObjects, oColumnRectangle, ref iTop);
    }
    DrawExcelColumnNameAndCaption
    (
        DrawingObjects oDrawingObjects,
        String sColumnName,
        String sCaption,
        Int32 iLeft,
        Int32 iRight,
        ref Int32 iTop
    )
    {
        Debug.Assert(oDrawingObjects != null);
        Debug.Assert( !String.IsNullOrEmpty(sColumnName) );
        Debug.Assert( !String.IsNullOrEmpty(sCaption) );

        oDrawingObjects.Graphics.DrawString(sCaption, oDrawingObjects.Font,
            SystemBrushes.GrayText, iRight,
            iTop + oDrawingObjects.GetFontHeightMultiple(0.2F),
            oDrawingObjects.RightAlignStringFormat);

        DrawExcelColumnName(oDrawingObjects, sColumnName, iLeft,
            iRight - MeasureTextWidth(oDrawingObjects, sCaption), ref iTop);
    }
    Draw
    (
        DrawingObjects oDrawingObjects
    )
    {
        Debug.Assert(oDrawingObjects != null);
        AssertValid();

        if (m_oAutoFillWorkbookResults.AutoFilledNonXYColumnCount > 0)
        {
            return ( DrawAutoFillWorkbookResults(oDrawingObjects) );
        }

        return (oDrawingObjects.ControlRectangle.Top);
    }
 Draw
 (
     DrawingObjects oDrawingObjects
 );
    DrawColorBarResults
    (
        DrawingObjects oDrawingObjects,
        String sSourceColumnName,
        String sCaption,
        String sSourceCalculationMinimum,
        String sSourceCalculationMaximum,
        Color oColor1,
        Color oColor2,
        Rectangle oColumnRectangle,
        Int32 iResultsLeft,
        Int32 iResultsRight,
        ref Int32 iTop
    )
    {
        Debug.Assert(oDrawingObjects != null);
        Debug.Assert( !String.IsNullOrEmpty(sSourceColumnName) );
        Debug.Assert( !String.IsNullOrEmpty(sCaption) );
        Debug.Assert( !String.IsNullOrEmpty(sSourceCalculationMinimum) );
        Debug.Assert( !String.IsNullOrEmpty(sSourceCalculationMaximum) );
        AssertValid();

        iTop += oDrawingObjects.GetFontHeightMultiple(0.2F);

        DrawRangeText(oDrawingObjects, sSourceCalculationMinimum,
            sSourceCalculationMaximum, SystemBrushes.WindowText, iResultsLeft,
            iResultsRight, ref iTop);

        iTop += oDrawingObjects.GetFontHeightMultiple(0.35F);

        Int32 iColorBarMargin = oDrawingObjects.GetFontHeightMultiple(0.1F);

        Rectangle oColorBarRectangle = Rectangle.FromLTRB(
            iResultsLeft + iColorBarMargin,
            iTop,
            iResultsRight - iColorBarMargin,
            iTop + ColorBarHeight
            );

        // There is a known bug in the LinearGradientBrush that sometimes
        // causes a single line of the wrong color to be drawn at the start of
        // the gradient.  The workaround is to use a brush rectangle that is
        // one pixel larger than the fill rectangle on all sides.

        Rectangle oBrushRectangle = oColorBarRectangle;
        oBrushRectangle.Inflate(1, 1);

        LinearGradientBrush oBrush = new LinearGradientBrush(
            oBrushRectangle, oColor1, oColor2, 0F);

        oDrawingObjects.Graphics.FillRectangle(oBrush, oColorBarRectangle);
        oBrush.Dispose();

        iTop += ColorBarHeight + oDrawingObjects.GetFontHeightMultiple(0.05F);

        DrawExcelColumnNameAndCaption(oDrawingObjects, sSourceColumnName,
            sCaption, iResultsLeft, iResultsRight, ref iTop);

        // Draw a line separating these results from the next.

        DrawHorizontalSeparator(oDrawingObjects, oColumnRectangle, ref iTop);
    }
    MeasureTextWidth
    (
        DrawingObjects oDrawingObjects,
        String sText
    )
    {
        Debug.Assert(oDrawingObjects != null);
        Debug.Assert( !String.IsNullOrEmpty(sText) );
        AssertValid();

        return ( (Int32)Math.Ceiling(oDrawingObjects.Graphics.MeasureString(
            sText, oDrawingObjects.Font).Width) );
    }
    DrawColumnSeparator
    (
        DrawingObjects oDrawingObjects,
        Rectangle oColumn2Rectangle
    )
    {
        Debug.Assert(oDrawingObjects != null);
        AssertValid();

        // This code was removed in April 2011.  It is kept as a placeholder in
        // case the separator is requested again.

        #if false

        oDrawingObjects.Graphics.DrawLine(SystemPens.ControlLight,
            oColumn2Rectangle.Left, oColumn2Rectangle.Top,
            oColumn2Rectangle.Left, oColumn2Rectangle.Bottom);

        #endif
    }
    DrawHorizontalSeparator
    (
        DrawingObjects oDrawingObjects,
        Rectangle oColumnRectangle,
        ref Int32 iTop
    )
    {
        Debug.Assert(oDrawingObjects != null);
        AssertValid();

        iTop += oDrawingObjects.GetFontHeightMultiple(0.6F);

        oDrawingObjects.Graphics.DrawLine(SystemPens.ControlLight,
            oColumnRectangle.Left, iTop, oColumnRectangle.Right, iTop);

        iTop += oDrawingObjects.GetFontHeightMultiple(0.3F);
    }
    DrawSelectedRangeLine
    (
        DrawingObjects oDrawingObjects,
        IDynamicFilterRangeTrackBar oDynamicFilterRangeTrackBar,
        Pen oSelectedRangeLinePen,
        Int32 iAvailableRangeLineLeft,
        Int32 iAvailableRangeLineRight,
        out Int32 iSelectedRangeLineLeft,
        out Int32 iSelectedRangeLineRight,
        ref Int32 iTop
    )
    {
        Debug.Assert(oDrawingObjects != null);
        Debug.Assert(oDynamicFilterRangeTrackBar != null);
        Debug.Assert(oSelectedRangeLinePen != null);
        AssertValid();

        iSelectedRangeLineLeft = GetXWithinAvailableLine(
            oDynamicFilterRangeTrackBar.SelectedMinimum,
            oDynamicFilterRangeTrackBar, iAvailableRangeLineLeft,
            iAvailableRangeLineRight);

        iSelectedRangeLineRight = GetXWithinAvailableLine(
            oDynamicFilterRangeTrackBar.SelectedMaximum,
            oDynamicFilterRangeTrackBar, iAvailableRangeLineLeft,
            iAvailableRangeLineRight);

        // Don't let the line have zero width.

        if (iSelectedRangeLineRight == iSelectedRangeLineLeft)
        {
            if (iSelectedRangeLineLeft == iAvailableRangeLineLeft)
            {
                iSelectedRangeLineRight += MinimumSelectedLineWidth;
            }
            else if (iSelectedRangeLineRight == iAvailableRangeLineRight)
            {
                iSelectedRangeLineLeft -= MinimumSelectedLineWidth;
            }
            else
            {
                iSelectedRangeLineLeft -= (MinimumSelectedLineWidth / 2);
                iSelectedRangeLineRight += (MinimumSelectedLineWidth / 2);
            }
        }

        oDrawingObjects.Graphics.DrawLine(oSelectedRangeLinePen,
            iSelectedRangeLineLeft, iTop, iSelectedRangeLineRight, iTop);

        iTop += AvailableLineHeight;
    }
    ControlRectangleToTwoColumns
    (
        DrawingObjects oDrawingObjects,
        out Rectangle oColumn1Rectangle,
        out Rectangle oColumn2Rectangle
    )
    {
        Debug.Assert(oDrawingObjects != null);
        AssertValid();

        // Compute the rectangles so that the margin to the left of the first
        // column's rectangle, the margin to the right of the second column's
        // rectangle, and the margin between the rectangles is the constant
        // value of ColumnHorizontalMargin.

        Rectangle oControlRectangle = oDrawingObjects.ControlRectangle;
        Int32 iTwoColumnWidth = GetTwoColumnWidth(oDrawingObjects);

        oColumn1Rectangle = new Rectangle(
            oControlRectangle.Left + ColumnHorizontalMargin,
            oControlRectangle.Top,
            iTwoColumnWidth - ( (3 * ColumnHorizontalMargin) / 2 ),
            oControlRectangle.Height
            );

        oColumn2Rectangle = oColumn1Rectangle;

        oColumn2Rectangle.Offset(
            oColumn1Rectangle.Width + ColumnHorizontalMargin, 0);
    }
    DrawAutoFilledEdgeResults
    (
        DrawingObjects oDrawingObjects,
        Rectangle oColumnRectangle
    )
    {
        Debug.Assert(oDrawingObjects != null);
        AssertValid();

        Int32 iTop = oColumnRectangle.Top;

        if (m_oAutoFillWorkbookResults.AutoFilledEdgeColumnCount > 0)
        {
            DrawColumnHeader(oDrawingObjects, EdgePropertyHeader,
                oColumnRectangle.Left, oColumnRectangle.Right, ref iTop);

            Int32 iResultsLeft = oColumnRectangle.Left;
            Int32 iResultsRight = oColumnRectangle.Right;

            AutoFillColorColumnResults oEdgeColorResults =
                m_oAutoFillWorkbookResults.EdgeColorResults;

            if (oEdgeColorResults.ColumnAutoFilled)
            {
                DrawColorColumnResults(oDrawingObjects, ColorCaption,
                    oEdgeColorResults, VertexShape.SolidSquare,
                    oColumnRectangle, iResultsLeft, iResultsRight, ref iTop);
            }

            AutoFillNumericRangeColumnResults oEdgeWidthResults =
                m_oAutoFillWorkbookResults.EdgeWidthResults;

            if (oEdgeWidthResults.ColumnAutoFilled)
            {
                DrawRampResults(oDrawingObjects,
                    oEdgeWidthResults.SourceColumnName, EdgeWidthCaption,
                    oEdgeWidthResults.SourceCalculationNumber1,
                    oEdgeWidthResults.SourceCalculationNumber2,
                    oEdgeWidthResults.DecimalPlaces, oColumnRectangle,
                    iResultsLeft, iResultsRight, ref iTop);
            }

            AutoFillNumericRangeColumnResults oEdgeAlphaResults =
                m_oAutoFillWorkbookResults.EdgeAlphaResults;

            if (oEdgeAlphaResults.ColumnAutoFilled)
            {
                DrawAutoFilledAlphaResults(oDrawingObjects,
                    oEdgeAlphaResults.SourceColumnName,
                    oEdgeAlphaResults.SourceCalculationNumber1,
                    oEdgeAlphaResults.SourceCalculationNumber2,
                    oEdgeAlphaResults.DecimalPlaces,
                    oEdgeAlphaResults.DestinationNumber1,
                    oEdgeAlphaResults.DestinationNumber2,
                    oColumnRectangle, iResultsLeft, iResultsRight, ref iTop);
            }
        }

        return (iTop);
    }
    DrawColorBarResults
    (
        DrawingObjects oDrawingObjects,
        String sSourceColumnName,
        String sCaption,
        Double dSourceCalculationNumber1,
        Double dSourceCalculationNumber2,
        Int32 iDecimalPlaces,
        Color oColor1,
        Color oColor2,
        Rectangle oColumnRectangle,
        Int32 iResultsLeft,
        Int32 iResultsRight,
        ref Int32 iTop
    )
    {
        Debug.Assert(oDrawingObjects != null);
        Debug.Assert( !String.IsNullOrEmpty(sSourceColumnName) );
        Debug.Assert( !String.IsNullOrEmpty(sCaption) );
        Debug.Assert(iDecimalPlaces >= 0);
        AssertValid();

        if (dSourceCalculationNumber2 == dSourceCalculationNumber1)
        {
            // All the source numbers were the same.  Draw one color only.

            oColor2 = oColor1;
        }

        DrawColorBarResults(oDrawingObjects, sSourceColumnName, sCaption,
            DoubleToString(dSourceCalculationNumber1, iDecimalPlaces),
            DoubleToString(dSourceCalculationNumber2, iDecimalPlaces),
            oColor1, oColor2, oColumnRectangle, iResultsLeft, iResultsRight,
            ref iTop);
    }
    DrawAutoFillWorkbookResults
    (
        DrawingObjects oDrawingObjects
    )
    {
        Debug.Assert(oDrawingObjects != null);
        AssertValid();

        // If there are autofilled edge and vertex results, two columns are
        // drawn, with the edge results in the first column and the vertex
        // results in the second.  If there are only edge or vertex results,
        // one column is drawn.

        Rectangle oColumn1Rectangle, oColumn2Rectangle;
        Boolean bHasTwoColumns = false;

        if (m_oAutoFillWorkbookResults.AutoFilledEdgeColumnCount > 0 &&
            m_oAutoFillWorkbookResults.AutoFilledVertexNonXYColumnCount > 0)
        {
            ControlRectangleToTwoColumns(oDrawingObjects,
                out oColumn1Rectangle, out oColumn2Rectangle);

            bHasTwoColumns = true;
        }
        else
        {
            oColumn1Rectangle = oDrawingObjects.ControlRectangle;
            AddMarginsToColumnRectangle(ref oColumn1Rectangle);
            oColumn2Rectangle = oColumn1Rectangle;
        }

        Int32 iBottom = Math.Max(
            DrawAutoFilledEdgeResults(oDrawingObjects, oColumn1Rectangle),
            DrawAutoFilledVertexResults(oDrawingObjects, oColumn2Rectangle)
            );

        if (bHasTwoColumns)
        {
            DrawColumnSeparator(oDrawingObjects, oColumn2Rectangle);
        }

        return (iBottom);
    }
    DrawRampResults
    (
        DrawingObjects oDrawingObjects,
        String sSourceColumnName,
        String sCaption,
        Double dSourceCalculationNumber1,
        Double dSourceCalculationNumber2,
        Int32 iDecimalPlaces,
        Rectangle oColumnRectangle,
        Int32 iResultsLeft,
        Int32 iResultsRight,
        ref Int32 iTop
    )
    {
        Debug.Assert(oDrawingObjects != null);
        Debug.Assert( !String.IsNullOrEmpty(sSourceColumnName) );
        Debug.Assert( !String.IsNullOrEmpty(sCaption) );
        Debug.Assert(iDecimalPlaces >= 0);
        AssertValid();

        iTop += oDrawingObjects.GetFontHeightMultiple(0.2F);

        DrawRangeText(oDrawingObjects,
            DoubleToString(dSourceCalculationNumber1, iDecimalPlaces),
            DoubleToString(dSourceCalculationNumber2, iDecimalPlaces),
            SystemBrushes.WindowText, iResultsLeft, iResultsRight, ref iTop);

        iTop += oDrawingObjects.GetFontHeightMultiple(0.35F);

        Int32 iRampMargin = oDrawingObjects.GetFontHeightMultiple(0.1F);

        Graphics oGraphics = oDrawingObjects.Graphics;
        SmoothingMode eOldSmoothingMode = oGraphics.SmoothingMode;
        oGraphics.SmoothingMode = SmoothingMode.HighQuality;

        oGraphics.FillPolygon(SystemBrushes.ControlDarkDark, new Point[] {
            new Point(iResultsLeft, iTop + RampHeight - 2),
            new Point(iResultsLeft, iTop + RampHeight - 1),
            new Point(iResultsRight - iRampMargin, iTop + RampHeight - 1),
            new Point(iResultsRight - iRampMargin, iTop - 1)
            } );

        oGraphics.SmoothingMode = eOldSmoothingMode;

        iTop += RampHeight + oDrawingObjects.GetFontHeightMultiple(0.05F);

        DrawExcelColumnNameAndCaption(oDrawingObjects, sSourceColumnName,
            sCaption, iResultsLeft, iResultsRight, ref iTop);

        // Draw a line separating these results from the next.

        DrawHorizontalSeparator(oDrawingObjects, oColumnRectangle, ref iTop);
    }
    DrawVertexCategoryShape
    (
        DrawingObjects oDrawingObjects,
        VertexShape eVertexShape,
        Pen oPen,
        SolidBrush oBrush,
        Color oColor,
        Single fXShapeCenter,
        Single fYShapeCenter,
        Single fShapeHalfWidth
    )
    {
        Debug.Assert(oDrawingObjects != null);
        Debug.Assert(oPen != null);
        Debug.Assert(oBrush != null);
        Debug.Assert(fShapeHalfWidth >= 0);
        AssertValid();

        Graphics oGraphics = oDrawingObjects.Graphics;
        oPen.Color = oColor;
        oBrush.Color = oColor;

        switch (eVertexShape)
        {
            case VertexShape.Circle:

                GraphicsUtil.DrawCircle(oGraphics, oPen, fXShapeCenter,
                    fYShapeCenter, fShapeHalfWidth);

                break;

            case VertexShape.Disk:

                GraphicsUtil.FillCircle(oGraphics, oBrush, fXShapeCenter,
                    fYShapeCenter, fShapeHalfWidth);

                break;

            case VertexShape.Sphere:

                GraphicsUtil.FillCircle3D(oGraphics, oColor,
                    fXShapeCenter, fYShapeCenter, fShapeHalfWidth);

                break;

            case VertexShape.Square:

                GraphicsUtil.DrawSquare(oGraphics, oPen, fXShapeCenter,
                    fYShapeCenter, fShapeHalfWidth);

                break;

            case VertexShape.SolidSquare:

                GraphicsUtil.FillSquare(oGraphics, oBrush, fXShapeCenter,
                    fYShapeCenter, fShapeHalfWidth);

                break;

            case VertexShape.Diamond:

                GraphicsUtil.DrawDiamond(oGraphics, oPen, fXShapeCenter,
                    fYShapeCenter, fShapeHalfWidth);

                break;

            case VertexShape.SolidDiamond:

                GraphicsUtil.FillDiamond(oGraphics, oBrush, fXShapeCenter,
                    fYShapeCenter, fShapeHalfWidth);

                break;

            case VertexShape.Triangle:

                GraphicsUtil.DrawTriangle(oGraphics, oPen, fXShapeCenter,
                    fYShapeCenter, fShapeHalfWidth);

                break;

            case VertexShape.SolidTriangle:

                GraphicsUtil.FillTriangle(oGraphics, oBrush, fXShapeCenter,
                    fYShapeCenter, fShapeHalfWidth);

                break;

            default:

                Debug.Assert(false);
                break;
        }
    }
        //*************************************************************************
        //  Method: DrawEdgeWeightSchemeResults()
        //
        /// <summary>
        /// Draws the results of the autofill with edge weight scheme.
        /// </summary>
        ///
        /// <param name="oDrawingObjects">
        /// Objects to draw with.
        /// </param>
        ///
        /// <returns>
        /// The bottom of the area that was drawn.
        /// </returns>
        //*************************************************************************
        protected Int32 DrawEdgeWeightSchemeResults(
            DrawingObjects oDrawingObjects
            )
        {
            Debug.Assert(oDrawingObjects != null);
            AssertValid();

            Rectangle oControlRectangle = oDrawingObjects.ControlRectangle;

            Rectangle oControlRectangleWithMargin = AddMarginToRectangle(
            oDrawingObjects, oControlRectangle);

            Int32 iTop = oControlRectangle.Top;

            DrawColumnHeader(oDrawingObjects, EdgePropertyHeader,
            oControlRectangle.Left, oControlRectangle.Right, ref iTop);

            String sEdgeWeightColumnName;
            Double dSourceCalculationNumber1, dSourceCalculationNumber2;
            Int32 iDecimalPlaces;

            m_oAutoFillWorkbookWithSchemeResults.GetEdgeWeightResults(
            out sEdgeWeightColumnName, out dSourceCalculationNumber1,
            out dSourceCalculationNumber2, out iDecimalPlaces);

            DrawRampResults(oDrawingObjects, sEdgeWeightColumnName,
            EdgeWidthCaption, dSourceCalculationNumber1,
            dSourceCalculationNumber2, iDecimalPlaces, oControlRectangle,
            oControlRectangleWithMargin.Left,
            oControlRectangleWithMargin.Right, ref iTop);

            return (iTop);
        }
    CreateDrawingObjects
    (
        Graphics oGraphics,
        Rectangle oControlRectangle
    )
    {
        Debug.Assert(oGraphics != null);
        AssertValid();

        DrawingObjects oDrawingObjects = new DrawingObjects();

        oDrawingObjects.Graphics = oGraphics;
        oDrawingObjects.ControlRectangle = oControlRectangle;
        oDrawingObjects.Font = this.Font;

        oDrawingObjects.FontHeight =
            oDrawingObjects.Font.GetHeight(oDrawingObjects.Graphics);

        oDrawingObjects.TrimmingStringFormat = new StringFormat();

        oDrawingObjects.TrimmingStringFormat.Trimming =
            StringTrimming.EllipsisCharacter;

        oDrawingObjects.RightAlignStringFormat = new StringFormat();
        oDrawingObjects.RightAlignStringFormat.Alignment = StringAlignment.Far;

        oDrawingObjects.CenterAlignStringFormat = new StringFormat();

        oDrawingObjects.CenterAlignStringFormat.Alignment =
            StringAlignment.Center;

        return (oDrawingObjects);
    }
    Draw
    (
        DrawingObjects oDrawingObjects
    )
    {
        Debug.Assert(oDrawingObjects != null);
        AssertValid();

        // If there are edge track bars and vertex track bars, two columns are
        // drawn, with the edge track bars in the first column and the vertex
        // track bars in the second.  If there are only edge or vertex track
        // bars, one column is drawn.

        Rectangle oColumn1Rectangle, oColumn2Rectangle;
        Boolean bHasTwoColumns = false;

        if (m_oEdgeDynamicFilterRangeTrackBars.Count > 0 &&
            m_oVertexDynamicFilterRangeTrackBars.Count > 0)
        {
            ControlRectangleToTwoColumns(oDrawingObjects,
                out oColumn1Rectangle, out oColumn2Rectangle);

            bHasTwoColumns = true;
        }
        else
        {
            oColumn1Rectangle = oDrawingObjects.ControlRectangle;
            AddMarginsToColumnRectangle(ref oColumn1Rectangle);
            oColumn2Rectangle = oColumn1Rectangle;
        }

        Int32 iBottom = Math.Max(

            DrawDynamicFilterRangeTrackBars(oDrawingObjects, "Edge Filters",
                m_oEdgeDynamicFilterRangeTrackBars, oColumn1Rectangle),

            DrawDynamicFilterRangeTrackBars(oDrawingObjects, "Vertex Filters",
                m_oVertexDynamicFilterRangeTrackBars, oColumn2Rectangle)
            );

        if (bHasTwoColumns)
        {
            DrawColumnSeparator(oDrawingObjects, oColumn2Rectangle);
        }

        return (iBottom);
    }
    DrawColorColumnResults
    (
        DrawingObjects oDrawingObjects,
        String sCaption,
        AutoFillColorColumnResults oColorResults,
        VertexShape eCategoryShape,
        Rectangle oColumnRectangle,
        Int32 iResultsLeft,
        Int32 iResultsRight,
        ref Int32 iTop
    )
    {
        Debug.Assert(oDrawingObjects != null);
        Debug.Assert( !String.IsNullOrEmpty(sCaption) );
        Debug.Assert(oColorResults != null);

        if (oColorResults.SourceColumnContainsNumbers)
        {
            DrawColorBarResults(oDrawingObjects,
                oColorResults.SourceColumnName, ColorCaption,
                oColorResults.SourceCalculationNumber1,
                oColorResults.SourceCalculationNumber2,
                oColorResults.DecimalPlaces,
                oColorResults.DestinationColor1,
                oColorResults.DestinationColor2,
                oColumnRectangle, iResultsLeft, iResultsRight,
                ref iTop);
        }
        else
        {
            DrawColorCategoryResults(oDrawingObjects,
                oColorResults.CategoryNames,

                (Int32 categoryIndex, out VertexShape categoryShape,
                    out Color categoryColor) =>
                {
                    categoryShape = eCategoryShape;

                    categoryColor = ColorUtil.GetUniqueColor(categoryIndex,
                        oColorResults.CategoryNames.Count);
                },

                oColumnRectangle, ref iTop
                );
        }
    }
    DrawAutoFilledAlphaResults
    (
        DrawingObjects oDrawingObjects,
        String sSourceColumnName,
        Double dSourceCalculationNumber1,
        Double dSourceCalculationNumber2,
        Int32 iDecimalPlaces,
        Double dDestinationNumber1,
        Double dDestinationNumber2,
        Rectangle oColumnRectangle,
        Int32 iResultsLeft,
        Int32 iResultsRight,
        ref Int32 iTop
    )
    {
        Debug.Assert(oDrawingObjects != null);
        Debug.Assert( !String.IsNullOrEmpty(sSourceColumnName) );
        Debug.Assert(iDecimalPlaces >= 0);
        AssertValid();

        // The alpha results look like the color results, with the colors set
        // to black with different alphas.  Calculate the colors.

        AlphaConverter oAlphaConverter = new AlphaConverter();

        Int32 iDestinationAlpha1 = (Int32)oAlphaConverter.WorkbookToGraph(
            (Single)dDestinationNumber1 );

        Int32 iDestinationAlpha2 = (Int32)oAlphaConverter.WorkbookToGraph(
            (Single)dDestinationNumber2 );

        Color oDestinationColor1 =
            Color.FromArgb(iDestinationAlpha1, SystemColors.WindowText);

        Color oDestinationColor2 =
            Color.FromArgb(iDestinationAlpha2, SystemColors.WindowText);

        DrawColorBarResults(oDrawingObjects, sSourceColumnName, "Opacity",
            dSourceCalculationNumber1, dSourceCalculationNumber2,
            iDecimalPlaces, oDestinationColor1, oDestinationColor2,
            oColumnRectangle, iResultsLeft, iResultsRight, ref iTop);
    }
    DrawColumnHeader
    (
        DrawingObjects oDrawingObjects,
        String sHeaderText,
        Int32 iLeft,
        Int32 iRight,
        ref Int32 iTop
    )
    {
        Debug.Assert(oDrawingObjects != null);
        Debug.Assert( !String.IsNullOrEmpty(sHeaderText) );
        AssertValid();

        iTop += oDrawingObjects.GetFontHeightMultiple(0.2F);

        Int32 iColumnHeaderHeight =
            oDrawingObjects.GetFontHeightMultiple(1.3F);

        oDrawingObjects.Graphics.FillRectangle(SystemBrushes.ControlLight,
            iLeft, iTop, iRight - iLeft - 1, iColumnHeaderHeight);

        oDrawingObjects.Graphics.DrawString(sHeaderText, oDrawingObjects.Font,
            SystemBrushes.ControlText,
            iLeft + oDrawingObjects.GetFontHeightMultiple(0.1F),
            iTop + oDrawingObjects.GetFontHeightMultiple(0.15F)
            );

        iTop += oDrawingObjects.GetFontHeightMultiple(1.5F);
    }
    DrawColorCategoryResults
    (
        DrawingObjects oDrawingObjects,
        ICollection<String> oCategoryNames,
        GetShapeAndColorForCategory oShapeAndColorGetter,
        Rectangle oColumnRectangle,
        ref Int32 iTop
    )
    {
        Debug.Assert(oDrawingObjects != null);
        Debug.Assert(oCategoryNames != null);
        AssertValid();

        Graphics oGraphics = oDrawingObjects.Graphics;
        iTop += oDrawingObjects.GetFontHeightMultiple(0.2F);

        // The categories are drawn from left to right.  Each category is drawn
        // as a shape followed by the category name.

        // Calculate the width of one category column.

        Single fShapeWidth = CategoryShapeFactor * oDrawingObjects.FontHeight;
        Single fShapeHalfWidth = fShapeWidth / 2F;

        Single fColumnWidth = (Single)Math.Ceiling( fShapeWidth +
            (MaximumCategoryNameLength * oDrawingObjects.FontHeight) );

        // How many columns will fit?  There must be at least one, even if
        // there isn't enough room for one column.

        Debug.Assert(fColumnWidth > 0);

        Int32 iColumns = Math.Max( 1,
            (Int32)(oColumnRectangle.Width / fColumnWidth) );

        fColumnWidth = (Single)oColumnRectangle.Width / (Single)iColumns;

        Int32 iCategories = oCategoryNames.Count;
        Int32 iColumn = 0;
        Single fLeft = oColumnRectangle.Left;

        Pen oPen = new Pen(Color.Black, 1.0F);
        oPen.Alignment = PenAlignment.Inset;

        SolidBrush oBrush = new SolidBrush(Color.Black);

        SmoothingMode eOldSmoothingMode = oGraphics.SmoothingMode;
        oGraphics.SmoothingMode = SmoothingMode.HighQuality;
        Int32 i = 0;

        foreach (String sCategoryName in oCategoryNames)
        {
            // Get the shape and color for this category.

            VertexShape eVertexShape;
            Color oVertexColor;

            oShapeAndColorGetter(i, out eVertexShape, out oVertexColor);

            DrawVertexCategoryShape(oDrawingObjects, eVertexShape, oPen,
                oBrush, oVertexColor,
                fLeft + fShapeHalfWidth + 2,
                iTop + fShapeHalfWidth + 1,
                fShapeHalfWidth);

            // Don't let the category name spill over into the next column.

            Single fTopOffset = fShapeWidth * 0.15F;

            Rectangle oNameRectangle = Rectangle.FromLTRB(
                (Int32)(fLeft + fShapeWidth * 1.4F),
                (Int32)(iTop + fTopOffset),
                (Int32)(fLeft + fColumnWidth),
                (Int32)(iTop + oDrawingObjects.FontHeight + fTopOffset)
                );

            oGraphics.DrawString(sCategoryName, oDrawingObjects.Font,
                SystemBrushes.WindowText, oNameRectangle,
                oDrawingObjects.TrimmingStringFormat);

            if (iCategories > MaximumCategoriesToDraw &&
                i == MaximumCategoriesToDraw - 1)
            {
                oGraphics.DrawString(
                    "There are additional categories that are not shown here.",
                    oDrawingObjects.Font, SystemBrushes.WindowText,
                    oColumnRectangle.Left,
                    iTop + 1.5F * oDrawingObjects.FontHeight);

                iTop += oDrawingObjects.GetFontHeightMultiple(3F);
                break;
            }

            oGraphics.DrawLine( SystemPens.ControlLight,
                oNameRectangle.Right - 1,
                iTop,
                oNameRectangle.Right - 1,
                iTop + oDrawingObjects.GetFontHeightMultiple(1.4F)
                );

            iColumn++;
            fLeft += fColumnWidth;
            Boolean bIncrementTop = false;

            if (iColumn == iColumns)
            {
                iColumn = 0;
                fLeft = oColumnRectangle.Left;
                bIncrementTop = true;
            }
            else if (i == iCategories - 1)
            {
                bIncrementTop = true;
            }

            if (bIncrementTop)
            {
                iTop += oDrawingObjects.GetFontHeightMultiple(1.4F);

                // Draw a line separating these results from the next.

                DrawHorizontalSeparator(oDrawingObjects, oColumnRectangle,
                    ref iTop);

                iTop += oDrawingObjects.GetFontHeightMultiple(0.2F);
            }

            i++;
        }

        oPen.Dispose();
        oBrush.Dispose();
        oGraphics.SmoothingMode = eOldSmoothingMode;
    }
    DrawDynamicFilterRangeTrackBars
    (
        DrawingObjects oDrawingObjects,
        String sGroupName,
        ICollection<IDynamicFilterRangeTrackBar> oDynamicFilterRangeTrackBars,
        Rectangle oColumnRectangle
    )
    {
        Debug.Assert(oDrawingObjects != null);
        Debug.Assert( !String.IsNullOrEmpty(sGroupName) );
        Debug.Assert(oDynamicFilterRangeTrackBars != null);
        AssertValid();

        Int32 iTop = oColumnRectangle.Top;

        if (oDynamicFilterRangeTrackBars.Count > 0)
        {
            // Draw the group name at the top of the group.

            DrawColumnHeader(oDrawingObjects, sGroupName, oColumnRectangle.Left,
                oColumnRectangle.Right, ref iTop);

            Int32 iTrackBarLeft = oColumnRectangle.Left;
            Int32 iTrackBarRight = oColumnRectangle.Right;

            Pen oAvailableRangeLinePen = new Pen(SystemBrushes.ControlDark,
                AvailableLineHeight);

            Pen oSelectedRangeLinePen = new Pen(SystemBrushes.Highlight,
                SelectedLineHeight);

            foreach (IDynamicFilterRangeTrackBar oDynamicFilterRangeTrackBar in
                oDynamicFilterRangeTrackBars)
            {
                DrawDynamicFilterRangeTrackBar(oDrawingObjects,
                    oDynamicFilterRangeTrackBar, oAvailableRangeLinePen,
                    oSelectedRangeLinePen, oColumnRectangle, iTrackBarLeft,
                    iTrackBarRight, ref iTop);
            }

            oAvailableRangeLinePen.Dispose();
            oSelectedRangeLinePen.Dispose();
        }

        return (iTop);
    }
    DrawExcelColumnName
    (
        DrawingObjects oDrawingObjects,
        String sColumnName,
        Int32 iLeft,
        Int32 iRight,
        ref Int32 iTop
    )
    {
        Debug.Assert(oDrawingObjects != null);
        Debug.Assert( !String.IsNullOrEmpty(sColumnName) );

        iTop += oDrawingObjects.GetFontHeightMultiple(0.2F);

        oDrawingObjects.Graphics.DrawString(sColumnName, oDrawingObjects.Font,
            SystemBrushes.ControlText,

            Rectangle.FromLTRB( iLeft, iTop, iRight,
                (Int32)(iTop + oDrawingObjects.FontHeight) ),

            oDrawingObjects.TrimmingStringFormat);

        iTop += oDrawingObjects.GetFontHeightMultiple(1.05F);
    }
    DrawAvailableRangeText
    (
        DrawingObjects oDrawingObjects,
        IDynamicFilterRangeTrackBar oDynamicFilterRangeTrackBar,
        ref Int32 iAvailableRangeTextLeft,
        ref Int32 iAvailableRangeTextRight,
        ref Int32 iTop
    )
    {
        Debug.Assert(oDrawingObjects != null);
        Debug.Assert(oDynamicFilterRangeTrackBar != null);
        AssertValid();

        DrawRangeText(oDrawingObjects,

            oDynamicFilterRangeTrackBar.ValueToString(
                oDynamicFilterRangeTrackBar.AvailableMinimum),

            oDynamicFilterRangeTrackBar.ValueToString(
                oDynamicFilterRangeTrackBar.AvailableMaximum),

            SystemBrushes.GrayText, ref iAvailableRangeTextLeft,
            ref iAvailableRangeTextRight, ref iTop
            );

        iTop += oDrawingObjects.GetFontHeightMultiple(0.4F);
    }
    DrawRangeText
    (
        DrawingObjects oDrawingObjects,
        String sLeftText,
        String sRightText,
        Brush oBrush,
        Int32 iLeft,
        Int32 iRight,
        ref Int32 iTop
    )
    {
        Debug.Assert(oDrawingObjects != null);
        Debug.Assert( !String.IsNullOrEmpty(sLeftText) );
        Debug.Assert( !String.IsNullOrEmpty(sRightText) );
        Debug.Assert(oBrush != null);
        AssertValid();

        DrawRangeText(oDrawingObjects, sLeftText, sRightText, oBrush,
            ref iLeft, ref iRight, ref iTop);
    }
    DrawSelectedRangeText
    (
        DrawingObjects oDrawingObjects,
        IDynamicFilterRangeTrackBar oDynamicFilterRangeTrackBar,
        Int32 iAvailableRangeTextLeft,
        Int32 iAvailableRangeTextRight,
        Int32 iSelectedRangeLineLeft,
        Int32 iSelectedRangeLineRight,
        Int32 iTop
    )
    {
        Debug.Assert(oDrawingObjects != null);
        Debug.Assert(oDynamicFilterRangeTrackBar != null);
        AssertValid();

        // Measure the minimum and maximum selected values.

        String sSelectedMinimumText =
            oDynamicFilterRangeTrackBar.ValueToString(
                oDynamicFilterRangeTrackBar.SelectedMinimum);

        Int32 iSelectedMinimumTextWidth = MeasureTextWidth(oDrawingObjects,
            sSelectedMinimumText);

        String sSelectedMaximumText =
            oDynamicFilterRangeTrackBar.ValueToString(
                oDynamicFilterRangeTrackBar.SelectedMaximum);

        Int32 iSelectedMaximumTextWidth = MeasureTextWidth(
            oDrawingObjects, sSelectedMaximumText);

        // If there is enough room, draw the selected minimum text with its
        // right edge aligned with the left edge of the selected line, and the
        // selected maximum text with its left edge aligned with the right edge
        // of the selected line.  Don't let any text exceed the bounds
        // specified by iAvailableRangeTextLeft and iAvailableRangeTextRight,
        // and don't let the text run into each other.

        Int32 iSelectedMinimumTextRight = Math.Max(
            iSelectedRangeLineLeft,
            iAvailableRangeTextLeft + iSelectedMinimumTextWidth
            );

        iSelectedMinimumTextRight = Math.Min(
            iSelectedMinimumTextRight,
            iAvailableRangeTextRight - iSelectedMaximumTextWidth
            );

        Int32 iSelectedMaximumTextLeft = Math.Min(
            iSelectedRangeLineRight,
            iAvailableRangeTextRight - iSelectedMaximumTextWidth
            );

        iSelectedMaximumTextLeft = Math.Max(
            iSelectedMaximumTextLeft,
            iAvailableRangeTextLeft + iSelectedMinimumTextWidth
            );

        if (iSelectedMinimumTextRight - iSelectedMinimumTextWidth >=
            iAvailableRangeTextLeft)
        {
            oDrawingObjects.Graphics.DrawString(sSelectedMinimumText,
                oDrawingObjects.Font, SystemBrushes.Highlight,
                iSelectedMinimumTextRight, iTop,
                oDrawingObjects.RightAlignStringFormat);
        }

        if (iSelectedMaximumTextLeft + iSelectedMaximumTextWidth <=
            iAvailableRangeTextRight)
        {
            oDrawingObjects.Graphics.DrawString(sSelectedMaximumText,
                oDrawingObjects.Font, SystemBrushes.Highlight,
                iSelectedMaximumTextLeft, iTop);
        }
    }
    DrawRangeText
    (
        DrawingObjects oDrawingObjects,
        String sLeftText,
        String sRightText,
        Brush oBrush,
        ref Int32 iLeft,
        ref Int32 iRight,
        ref Int32 iTop
    )
    {
        Debug.Assert(oDrawingObjects != null);
        Debug.Assert( !String.IsNullOrEmpty(sLeftText) );
        Debug.Assert( !String.IsNullOrEmpty(sRightText) );
        Debug.Assert(oBrush != null);
        AssertValid();

        oDrawingObjects.Graphics.DrawString(sLeftText, oDrawingObjects.Font,
            oBrush, iLeft, iTop);

        oDrawingObjects.Graphics.DrawString(sRightText, oDrawingObjects.Font,
            oBrush, iRight, iTop, oDrawingObjects.RightAlignStringFormat);

        iLeft += MeasureTextWidth(oDrawingObjects, sLeftText);
        iRight -= MeasureTextWidth(oDrawingObjects, sRightText);
        iTop += oDrawingObjects.GetFontHeightMultiple(1.0F);
    }