Example #1
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);
        }
    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);
        }
    }
    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);
    }
Example #4
0
        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);
            }
        }