当前位置: 首页>>代码示例>>C#>>正文


C# AlignV类代码示例

本文整理汇总了C#中AlignV的典型用法代码示例。如果您正苦于以下问题:C# AlignV类的具体用法?C# AlignV怎么用?C# AlignV使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


AlignV类属于命名空间,在下文中一共展示了AlignV类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: GraphItem

        /// <summary>
        /// Constructor that creates a <see cref="GraphItem"/> with the specified
        /// position, <see cref="CoordType"/>, <see cref="AlignH"/>, and <see cref="AlignV"/>.
        /// Other properties are set to default values as defined in the <see cref="Default"/> class.
        /// </summary>
        /// <remarks>
        /// The four coordinates define the starting point and ending point for
        /// <see cref="ArrowItem"/>'s, or the topleft and bottomright points for
        /// <see cref="ImageItem"/>'s.  For <see cref="GraphItem"/>'s that only require
        /// one point, the <see paramref="x2"/> and <see paramref="y2"/> values
        /// will be ignored.  The units of the coordinates are specified by the
        /// <see cref="ZedGraph.Location.CoordinateFrame"/> property.
        /// </remarks>
        /// <param name="x">The x position of the item.</param>
        /// <param name="y">The y position of the item.</param>
        /// <param name="x2">The x2 position of the item.</param>
        /// <param name="y2">The x2 position of the item.</param>
        /// <param name="coordType">The <see cref="CoordType"/> enum value that
        /// indicates what type of coordinate system the x and y parameters are
        /// referenced to.</param>
        /// <param name="alignH">The <see cref="ZedGraph.AlignH"/> enum that specifies
        /// the horizontal alignment of the object with respect to the (x,y) location</param>
        /// <param name="alignV">The <see cref="ZedGraph.AlignV"/> enum that specifies
        /// the vertical alignment of the object with respect to the (x,y) location</param>
        public GraphItem( float x, float y, float x2, float y2, CoordType coordType,
					AlignH alignH, AlignV alignV )
        {
            this.Tag = null;
            this.zOrder = ZOrder.A_InFront;
            this.location = new Location( x, y, x2, y2, coordType, alignH, alignV );
        }
开发者ID:InsungChoi,项目名称:dddd,代码行数:31,代码来源:GraphItem.cs

示例2: Init

        /// <summary>
        /// Generic initializer to default values
        /// </summary>
        private void Init()
        {
            _color = Color.White;
            _secondaryValueGradientColor = Color.White;
            _brush = null;
            _type = FillType.None;
            _isScaled = Default.IsScaled;
            _alignH = Default.AlignH;
            _alignV = Default.AlignV;
            _rangeMin = 0.0;
            _rangeMax = 1.0;
            _rangeDefault = double.MaxValue;
            _gradientBM = null;

            _colorList = null;
            _positionList = null;
            _angle = 0;
            _image = null;
            _wrapMode = WrapMode.Tile;
        }
开发者ID:kjburns31,项目名称:vixen-modules,代码行数:23,代码来源:Fill.cs

示例3: TextObj

 /// <summary>
 /// Constructor that sets all <see cref="TextObj"/> properties to default
 /// values as defined in the <see cref="Default"/> class.
 /// </summary>
 /// <param name="text">The text to be displayed.</param>
 /// <param name="x">The x position of the text.  The units
 /// of this position are specified by the
 /// <see cref="ZedGraph.Location.CoordinateFrame"/> property.  The text will be
 /// aligned to this position based on the <see cref="AlignH"/>
 /// property.</param>
 /// <param name="y">The y position of the text.  The units
 /// of this position are specified by the
 /// <see cref="ZedGraph.Location.CoordinateFrame"/> property.  The text will be
 /// aligned to this position based on the
 /// <see cref="AlignV"/> property.</param>
 /// <param name="coordType">The <see cref="CoordType"/> enum value that
 /// indicates what type of coordinate system the x and y parameters are
 /// referenced to.</param>
 /// <param name="alignH">The <see cref="ZedGraph.AlignH"/> enum that specifies
 /// the horizontal alignment of the object with respect to the (x,y) location</param>
 /// <param name="alignV">The <see cref="ZedGraph.AlignV"/> enum that specifies
 /// the vertical alignment of the object with respect to the (x,y) location</param>
 public TextObj( string text, double x, double y, CoordType coordType, AlignH alignH, AlignV alignV )
     : base(x, y, coordType, alignH, alignV)
 {
     Init( text );
 }
开发者ID:viwhi1,项目名称:TDMaker,代码行数:27,代码来源:TextObj.cs

示例4: GetBox

        /// <summary>
        /// Returns a polygon that defines the bounding box of
        /// the text, taking into account alignment and rotation parameters.
        /// </summary>
        /// <param name="g">
        /// A graphic device object to be drawn into.  This is normally e.Graphics from the
        /// PaintEventArgs argument to the Paint() method.
        /// </param>
        /// <param name="text">A string value containing the text to be
        /// displayed.  This can be multiple lines, separated by newline ('\n')
        /// characters</param>
        /// <param name="x">The X location to display the text, in screen
        /// coordinates, relative to the horizontal (<see cref="AlignH"/>)
        /// alignment parameter <paramref name="alignH"/></param>
        /// <param name="y">The Y location to display the text, in screen
        /// coordinates, relative to the vertical (<see cref="AlignV"/>
        /// alignment parameter <paramref name="alignV"/></param>
        /// <param name="alignH">A horizontal alignment parameter specified
        /// using the <see cref="AlignH"/> enum type</param>
        /// <param name="alignV">A vertical alignment parameter specified
        /// using the <see cref="AlignV"/> enum type</param>
        /// <param name="scaleFactor">
        /// The scaling factor to be used for rendering objects.  This is calculated and
        /// passed down by the parent <see cref="GraphPane"/> object using the
        /// <see cref="PaneBase.CalcScaleFactor"/> method, and is used to proportionally adjust
        /// font sizes, etc. according to the actual size of the graph.
        /// </param>
        /// <param name="layoutArea">The limiting area (<see cref="SizeF"/>) into which the text
        /// must fit.  The actual rectangle may be smaller than this, but the text will be wrapped
        /// to accomodate the area.</param>
        /// <returns>A polygon of 4 points defining the area of this text</returns>
        public PointF[] GetBox( Graphics g, string text, float x,
				float y, AlignH alignH, AlignV alignV,
				float scaleFactor, SizeF layoutArea )
        {
            // make sure the font size is properly scaled
            Remake( scaleFactor, this.Size, ref _scaledSize, ref _font );

            // Get the width and height of the text
            SizeF sizeF;
            if ( layoutArea.IsEmpty )
                sizeF = g.MeasureString( text, _font );
            else
                sizeF = g.MeasureString( text, _font, layoutArea );

            // Create a bounding box rectangle for the text
            RectangleF rect = new RectangleF( new PointF( -sizeF.Width / 2.0F, 0.0F ), sizeF );

            Matrix matrix = new Matrix();
            SetupMatrix( matrix, x, y, sizeF, alignH, alignV, _angle );

            PointF[] pts = new PointF[4];
            pts[0] = new PointF( rect.Left, rect.Top );
            pts[1] = new PointF( rect.Right, rect.Top );
            pts[2] = new PointF( rect.Right, rect.Bottom );
            pts[3] = new PointF( rect.Left, rect.Bottom );
            matrix.TransformPoints( pts );

            return pts;
        }
开发者ID:sntree,项目名称:ZedGraph,代码行数:60,代码来源:FontSpec.cs

示例5: Fill

        /// <summary>
        /// The Copy Constructor
        /// </summary>
        /// <param name="rhs">The Fill object from which to copy</param>
        public Fill( Fill rhs )
        {
            _color = rhs._color;
            _secondaryValueGradientColor = rhs._color;

            if ( rhs._brush != null )
                _brush = (Brush) rhs._brush.Clone();
            else
                _brush = null;
            _type = rhs._type;
            _alignH = rhs.AlignH;
            _alignV = rhs.AlignV;
            _isScaled = rhs.IsScaled;
            _rangeMin = rhs._rangeMin;
            _rangeMax = rhs._rangeMax;
            _rangeDefault = rhs._rangeDefault;
            _gradientBM = null;

            if ( rhs._colorList != null )
                _colorList = (Color[]) rhs._colorList.Clone();
            else
                _colorList = null;

            if ( rhs._positionList != null )
            {
                _positionList = (float[]) rhs._positionList.Clone();
            }
            else
                _positionList = null;

            if ( rhs._image != null )
                _image = (Image) rhs._image.Clone();
            else
                _image = null;

            _angle = rhs._angle;
            _wrapMode = rhs._wrapMode;
        }
开发者ID:kjburns31,项目名称:vixen-modules,代码行数:42,代码来源:Fill.cs

示例6: SetupMatrix

        private Matrix SetupMatrix( Matrix matrix, float x, float y, SizeF sizeF, AlignH alignH,
				AlignV alignV, float angle )
        {
            // Move the coordinate system to local coordinates
            // of this text object (that is, at the specified
            // x,y location)
            matrix.Translate( x, y, MatrixOrder.Prepend );

            // Rotate the coordinate system according to the
            // specified angle of the FontSpec
            if ( _angle != 0.0F )
                matrix.Rotate( -angle, MatrixOrder.Prepend );

            // Since the text will be drawn by g.DrawString()
            // assuming the location is the TopCenter
            // (the Font is aligned using StringFormat to the
            // center so multi-line text is center justified),
            // shift the coordinate system so that we are
            // actually aligned per the caller specified position
            float xa, ya;
            if ( alignH == AlignH.Left )
                xa = sizeF.Width / 2.0F;
            else if ( alignH == AlignH.Right )
                xa = -sizeF.Width / 2.0F;
            else
                xa = 0.0F;

            if ( alignV == AlignV.Center )
                ya = -sizeF.Height / 2.0F;
            else if ( alignV == AlignV.Bottom )
                ya = -sizeF.Height;
            else
                ya = 0.0F;

            // Shift the coordinates to accomodate the alignment
            // parameters
            matrix.Translate( xa, ya, MatrixOrder.Prepend );

            return matrix;
        }
开发者ID:sntree,项目名称:ZedGraph,代码行数:40,代码来源:FontSpec.cs

示例7: Draw

        /// <summary>
        /// Render the specified <paramref name="text"/> to the specifed
        /// <see cref="Graphics"/> device.  The text, border, and fill options
        /// will be rendered as required.
        /// </summary>
        /// <param name="g">
        /// A graphic device object to be drawn into.  This is normally e.Graphics from the
        /// PaintEventArgs argument to the Paint() method.
        /// </param>
        /// <param name="pane">
        /// A reference to the <see cref="PaneBase"/> object that is the parent or
        /// owner of this object.
        /// </param>
        /// <param name="text">A string value containing the text to be
        /// displayed.  This can be multiple lines, separated by newline ('\n')
        /// characters</param>
        /// <param name="x">The X location to display the text, in screen
        /// coordinates, relative to the horizontal (<see cref="AlignH"/>)
        /// alignment parameter <paramref name="alignH"/></param>
        /// <param name="y">The Y location to display the text, in screen
        /// coordinates, relative to the vertical (<see cref="AlignV"/>
        /// alignment parameter <paramref name="alignV"/></param>
        /// <param name="alignH">A horizontal alignment parameter specified
        /// using the <see cref="AlignH"/> enum type</param>
        /// <param name="alignV">A vertical alignment parameter specified
        /// using the <see cref="AlignV"/> enum type</param>
        /// <param name="scaleFactor">
        /// The scaling factor to be used for rendering objects.  This is calculated and
        /// passed down by the parent <see cref="GraphPane"/> object using the
        /// <see cref="PaneBase.CalcScaleFactor"/> method, and is used to proportionally adjust
        /// font sizes, etc. according to the actual size of the graph.
        /// </param>
        /// <param name="layoutArea">The limiting area (<see cref="SizeF"/>) into which the text
        /// must fit.  The actual rectangle may be smaller than this, but the text will be wrapped
        /// to accomodate the area.</param>
        public void Draw( Graphics g, PaneBase pane, string text, float x,
			float y, AlignH alignH, AlignV alignV,
			float scaleFactor, SizeF layoutArea )
        {
            // make sure the font size is properly scaled
            //Remake( scaleFactor, this.Size, ref this.scaledSize, ref this.font );

            SmoothingMode sModeSave = g.SmoothingMode;
            TextRenderingHint sHintSave = g.TextRenderingHint;
            if ( _isAntiAlias )
            {
                g.SmoothingMode = SmoothingMode.HighQuality;
                g.TextRenderingHint = TextRenderingHint.AntiAlias;
            }

            SizeF sizeF;
            if ( layoutArea.IsEmpty )
                sizeF = MeasureString( g, text, scaleFactor );
            else
                sizeF = MeasureString( g, text, scaleFactor, layoutArea );

            // Save the old transform matrix for later restoration
            Matrix saveMatrix = g.Transform;
            g.Transform = SetupMatrix( g.Transform, x, y, sizeF, alignH, alignV, _angle );

            // Create a rectangle representing the border around the
            // text.  Note that, while the text is drawn based on the
            // TopCenter position, the rectangle is drawn based on
            // the TopLeft position.  Therefore, move the rectangle
            // width/2 to the left to align it properly
            RectangleF rectF = new RectangleF( -sizeF.Width / 2.0F, 0.0F,
                                sizeF.Width, sizeF.Height );

            // If the background is to be filled, fill it
            _fill.Draw( g, rectF );

            // Draw the border around the text if required
            _border.Draw( g, pane, scaleFactor, rectF );

            // make a center justified StringFormat alignment
            // for drawing the text
            StringFormat strFormat = new StringFormat();
            strFormat.Alignment = _stringAlignment;
            //			if ( this.stringAlignment == StringAlignment.Far )
            //				g.TranslateTransform( sizeF.Width / 2.0F, 0F, MatrixOrder.Prepend );
            //			else if ( this.stringAlignment == StringAlignment.Near )
            //				g.TranslateTransform( -sizeF.Width / 2.0F, 0F, MatrixOrder.Prepend );

            // Draw the drop shadow text.  Note that the coordinate system
            // is set up such that 0,0 is at the location where the
            // CenterTop of the text needs to be.
            if ( _isDropShadow )
            {
                float xShift = (float)( Math.Cos( _dropShadowAngle ) *
                            _dropShadowOffset * _font.Height );
                float yShift = (float)( Math.Sin( _dropShadowAngle ) *
                            _dropShadowOffset * _font.Height );
                RectangleF rectD = rectF;
                rectD.Offset( xShift, yShift );
                // make a solid brush for rendering the font itself
                using ( SolidBrush brushD = new SolidBrush( _dropShadowColor ) )
                    g.DrawString( text, _font, brushD, rectD, strFormat );
            }

            // make a solid brush for rendering the font itself
//.........这里部分代码省略.........
开发者ID:sntree,项目名称:ZedGraph,代码行数:101,代码来源:FontSpec.cs

示例8: Init

 /// <summary>
 /// Generic initializer to default values
 /// </summary>
 private void Init()
 {
     color = Color.White;
     brush = null;
     type = FillType.None;
     this.isScaled = Default.IsScaled;
     this.alignH = Default.AlignH;
     this.alignV = Default.AlignV;
     this.rangeMin = 0.0;
     this.rangeMax = 1.0;
     gradientBM = null;
 }
开发者ID:InsungChoi,项目名称:dddd,代码行数:15,代码来源:Fill.cs

示例9: Location

 /// <summary>
 /// Constructor for the <see cref="Location"/> class that specifies the
 /// x, y position and the <see cref="CoordType"/>.
 /// </summary>
 /// <remarks>
 /// The (x,y) position corresponds to the top-left corner;
 /// </remarks>
 /// <param name="x">The x position, specified in units of <see paramref="coordType"/>.
 /// </param>
 /// <param name="y">The y position, specified in units of <see paramref="coordType"/>.
 /// </param>
 /// <param name="coordType">The <see cref="CoordType"/> enum that specifies the
 /// units for <see paramref="x"/> and <see paramref="y"/></param>
 /// <param name="alignH">The <see cref="ZedGraph.AlignH"/> enum that specifies
 /// the horizontal alignment of the object with respect to the (x,y) location</param>
 /// <param name="alignV">The <see cref="ZedGraph.AlignV"/> enum that specifies
 /// the vertical alignment of the object with respect to the (x,y) location</param>
 public Location( float x, float y, CoordType coordType, AlignH alignH, AlignV alignV )
 {
     this.x = x;
     this.y = y;
     this.width = 0;
     this.height = 0;
     this.coordinateFrame = coordType;
     this.alignH = alignH;
     this.alignV = alignV;
 }
开发者ID:InsungChoi,项目名称:dddd,代码行数:27,代码来源:Location.cs

示例10: Fill

 /// <summary>
 /// Constructor that creates a <see cref="Brush"/> fill, using a user-supplied, custom
 /// <see cref="Brush"/>.  This constructor will make the brush unscaled (see <see cref="IsScaled"/>),
 /// but it provides <see paramref="alignH"/> and <see paramref="alignV"/> parameters to control
 /// alignment of the brush with respect to the filled object.
 /// </summary>
 /// <param name="brush">The <see cref="Brush"/> to use for fancy fills.  Typically, this would
 /// be a <see cref="LinearGradientBrush"/> or a <see cref="TextureBrush"/> class</param>
 /// <param name="alignH">Controls the horizontal alignment of the brush within the filled object
 /// (see <see cref="AlignH"/></param>
 /// <param name="alignV">Controls the vertical alignment of the brush within the filled object
 /// (see <see cref="AlignV"/></param>
 public Fill( Brush brush, AlignH alignH, AlignV alignV )
 {
     Init();
     this.alignH = alignH;
     this.alignV = alignV;
     this.isScaled = false;
     this.color = Color.White;
     this.brush = (Brush) brush.Clone();
     this.type = FillType.Brush;
 }
开发者ID:InsungChoi,项目名称:dddd,代码行数:22,代码来源:Fill.cs

示例11: TextItem

 /// <summary>
 /// Constructor that sets all <see cref="TextItem"/> properties to default
 /// values as defined in the <see cref="Default"/> class.
 /// </summary>
 /// <param name="text">The text to be displayed.</param>
 /// <param name="x">The x position of the text.  The units
 /// of this position are specified by the
 /// <see cref="ZedGraph.Location.CoordinateFrame"/> property.  The text will be
 /// aligned to this position based on the <see cref="AlignH"/>
 /// property.</param>
 /// <param name="y">The y position of the text.  The units
 /// of this position are specified by the
 /// <see cref="ZedGraph.Location.CoordinateFrame"/> property.  The text will be
 /// aligned to this position based on the
 /// <see cref="AlignV"/> property.</param>
 /// <param name="coordType">The <see cref="CoordType"/> enum value that
 /// indicates what type of coordinate system the x and y parameters are
 /// referenced to.</param>
 /// <param name="alignH">The <see cref="ZedGraph.AlignH"/> enum that specifies
 /// the horizontal alignment of the object with respect to the (x,y) location</param>
 /// <param name="alignV">The <see cref="ZedGraph.AlignV"/> enum that specifies
 /// the vertical alignment of the object with respect to the (x,y) location</param>
 public TextItem( string text, float x, float y, CoordType coordType, AlignH alignH, AlignV alignV )
     : base(x, y, coordType, alignH, alignV)
 {
     Init( text );
 }
开发者ID:InsungChoi,项目名称:dddd,代码行数:27,代码来源:TextItem.cs

示例12: PointInBox

        /// <summary>
        /// Determines if the specified screen point lies within the bounding box of
        /// the text, taking into account alignment and rotation parameters.
        /// </summary>
        /// <param name="pt">The screen point, in pixel units</param>
        /// <param name="g">
        /// A graphic device object to be drawn into.  This is normally e.Graphics from the
        /// PaintEventArgs argument to the Paint() method.
        /// </param>
        /// <param name="text">A string value containing the text to be
        /// displayed.  This can be multiple lines, separated by newline ('\n')
        /// characters</param>
        /// <param name="x">The X location to display the text, in screen
        /// coordinates, relative to the horizontal (<see cref="AlignH"/>)
        /// alignment parameter <paramref name="alignH"/></param>
        /// <param name="y">The Y location to display the text, in screen
        /// coordinates, relative to the vertical (<see cref="AlignV"/>
        /// alignment parameter <paramref name="alignV"/></param>
        /// <param name="alignH">A horizontal alignment parameter specified
        /// using the <see cref="AlignH"/> enum type</param>
        /// <param name="alignV">A vertical alignment parameter specified
        /// using the <see cref="AlignV"/> enum type</param>
        /// <param name="scaleFactor">
        /// The scaling factor to be used for rendering objects.  This is calculated and
        /// passed down by the parent <see cref="GraphPane"/> object using the
        /// <see cref="GraphPane.CalcScaleFactor"/> method, and is used to proportionally adjust
        /// font sizes, etc. according to the actual size of the graph.
        /// </param>
        /// <returns>true if the point lies within the bounding box, false otherwise</returns>
        public bool PointInBox( PointF pt, Graphics g, string text, float x,
			float y, AlignH alignH, AlignV alignV,
			double scaleFactor )
        {
            // make sure the font size is properly scaled
            Remake( scaleFactor, this.Size, ref this.scaledSize, ref this.font );

            // Get the width and height of the text
            SizeF sizeF = g.MeasureString( text, this.font );

            // Create a bounding box rectangle for the text
            RectangleF rect = new RectangleF( new PointF( -sizeF.Width / 2.0F, 0.0F), sizeF );

            // Build a transform matrix that inverts that drawing transform
            // in this manner, the point is brought back to the box, rather
            // than vice-versa.  This allows the container check to be a simple
            // RectangleF.Contains, since the rectangle won't be rotated.
            Matrix matrix = new Matrix();

            // In this case, the bounding box is anchored to the
            // top-left of the text box.  Handle the alignment
            // as needed.
            float	xa, ya;
            if ( alignH == AlignH.Left )
                xa = sizeF.Width / 2.0F;
            else if ( alignH == AlignH.Right )
                xa = -sizeF.Width / 2.0F;
            else
                xa = 0.0F;

            if ( alignV == AlignV.Center )
                ya = -sizeF.Height / 2.0F;
            else if ( alignV == AlignV.Bottom )
                ya = -sizeF.Height;
            else
                ya = 0.0F;

            // Shift the coordinates to accomodate the alignment
            // parameters
            matrix.Translate( -xa, -ya, MatrixOrder.Prepend );

            // Rotate the coordinate system according to the
            // specified angle of the FontSpec
            if ( angle != 0.0F )
                matrix.Rotate( angle, MatrixOrder.Prepend );

            // Move the coordinate system to local coordinates
            // of this text object (that is, at the specified
            // x,y location)
            matrix.Translate( -x, -y, MatrixOrder.Prepend );

            PointF[] pts = new PointF[1];
            pts[0] = pt;
            matrix.TransformPoints( pts );

            return rect.Contains( pts[0] );
        }
开发者ID:InsungChoi,项目名称:dddd,代码行数:86,代码来源:FontSpec.cs

示例13: DrawTenPower

        /// <summary>
        /// Render the specified <paramref name="text"/> to the specifed
        /// <see cref="Graphics"/> device.  The text, border, and fill options
        /// will be rendered as required.  This special case method will show the
        /// specified text as a power of 10, using the <see cref="Default.SuperSize"/>
        /// and <see cref="Default.SuperShift"/>.
        /// </summary>
        /// <param name="g">
        /// A graphic device object to be drawn into.  This is normally e.Graphics from the
        /// PaintEventArgs argument to the Paint() method.
        /// </param>
        /// <param name="pane">
        /// A reference to the <see cref="ZedGraph.GraphPane"/> object that is the parent or
        /// owner of this object.
        /// </param>
        /// <param name="text">A string value containing the text to be
        /// displayed.  This can be multiple lines, separated by newline ('\n')
        /// characters</param>
        /// <param name="x">The X location to display the text, in screen
        /// coordinates, relative to the horizontal (<see cref="AlignH"/>)
        /// alignment parameter <paramref name="alignH"/></param>
        /// <param name="y">The Y location to display the text, in screen
        /// coordinates, relative to the vertical (<see cref="AlignV"/>
        /// alignment parameter <paramref name="alignV"/></param>
        /// <param name="alignH">A horizontal alignment parameter specified
        /// using the <see cref="AlignH"/> enum type</param>
        /// <param name="alignV">A vertical alignment parameter specified
        /// using the <see cref="AlignV"/> enum type</param>
        /// <param name="scaleFactor">
        /// The scaling factor to be used for rendering objects.  This is calculated and
        /// passed down by the parent <see cref="GraphPane"/> object using the
        /// <see cref="GraphPane.CalcScaleFactor"/> method, and is used to proportionally adjust
        /// font sizes, etc. according to the actual size of the graph.
        /// </param>
        public void DrawTenPower( Graphics g, GraphPane pane, string text, float x,
			float y, AlignH alignH, AlignV alignV,
			double scaleFactor )
        {
            // make sure the font size is properly scaled
            Remake( scaleFactor, this.Size, ref this.scaledSize, ref this.font );
            float scaledSuperSize = this.scaledSize * Default.SuperSize;
            Remake( scaleFactor, this.Size * Default.SuperSize, ref scaledSuperSize,
                ref this.superScriptFont );

            // Get the width and height of the text
            SizeF size10 = g.MeasureString( "10", this.font );
            SizeF sizeText = g.MeasureString( text, this.superScriptFont );
            SizeF totSize = new SizeF( size10.Width + sizeText.Width,
                                    size10.Height + sizeText.Height * Default.SuperShift );
            float charWidth = g.MeasureString( "x", this.superScriptFont ).Width;

            // Save the old transform matrix for later restoration
            Matrix matrix = g.Transform;

            // Move the coordinate system to local coordinates
            // of this text object (that is, at the specified
            // x,y location)
            g.TranslateTransform( x, y, MatrixOrder.Prepend );

            // Rotate the coordinate system according to the
            // specified angle of the FontSpec
            if ( angle != 0.0F )
                g.RotateTransform( -angle, MatrixOrder.Prepend );

            // Since the text will be drawn by g.DrawString()
            // assuming the location is the TopCenter
            // (the Font is aligned using StringFormat to the
            // center so multi-line text is center justified),
            // shift the coordinate system so that we are
            // actually aligned per the caller specified position
            float xa, ya;
            if ( alignH == AlignH.Left )
                xa = totSize.Width / 2.0F;
            else if ( alignH == AlignH.Right )
                xa = -totSize.Width / 2.0F;
            else
                xa = 0.0F;

            if ( alignV == AlignV.Center )
                ya = -totSize.Height / 2.0F;
            else if ( alignV == AlignV.Bottom )
                ya = -totSize.Height;
            else
                ya = 0.0F;

            // Shift the coordinates to accomodate the alignment
            // parameters
            g.TranslateTransform( xa, ya, MatrixOrder.Prepend );

            // make a solid brush for rendering the font itself
            SolidBrush brush = new SolidBrush( this.fontColor );

            // make a center justified StringFormat alignment
            // for drawing the text
            StringFormat strFormat = new StringFormat();
            strFormat.Alignment = this.stringAlignment;

            // Create a rectangle representing the border around the
            // text.  Note that, while the text is drawn based on the
            // TopCenter position, the rectangle is drawn based on
//.........这里部分代码省略.........
开发者ID:InsungChoi,项目名称:dddd,代码行数:101,代码来源:FontSpec.cs

示例14: PointInBox

        /// <summary>
        /// Determines if the specified screen point lies within the bounding box of
        /// the text, taking into account alignment and rotation parameters.
        /// </summary>
        /// <param name="pt">The screen point, in pixel units</param>
        /// <param name="g">
        /// A graphic device object to be drawn into.  This is normally e.Graphics from the
        /// PaintEventArgs argument to the Paint() method.
        /// </param>
        /// <param name="text">A string value containing the text to be
        /// displayed.  This can be multiple lines, separated by newline ('\n')
        /// characters</param>
        /// <param name="x">The X location to display the text, in screen
        /// coordinates, relative to the horizontal (<see cref="AlignH"/>)
        /// alignment parameter <paramref name="alignH"/></param>
        /// <param name="y">The Y location to display the text, in screen
        /// coordinates, relative to the vertical (<see cref="AlignV"/>
        /// alignment parameter <paramref name="alignV"/></param>
        /// <param name="alignH">A horizontal alignment parameter specified
        /// using the <see cref="AlignH"/> enum type</param>
        /// <param name="alignV">A vertical alignment parameter specified
        /// using the <see cref="AlignV"/> enum type</param>
        /// <param name="scaleFactor">
        /// The scaling factor to be used for rendering objects.  This is calculated and
        /// passed down by the parent <see cref="GraphPane"/> object using the
        /// <see cref="PaneBase.CalcScaleFactor"/> method, and is used to proportionally adjust
        /// font sizes, etc. according to the actual size of the graph.
        /// </param>
        /// <param name="layoutArea">The limiting area (<see cref="SizeF"/>) into which the text
        /// must fit.  The actual rectangle may be smaller than this, but the text will be wrapped
        /// to accomodate the area.</param>
        /// <returns>true if the point lies within the bounding box, false otherwise</returns>
        public bool PointInBox( PointF pt, Graphics g, string text, float x,
			float y, AlignH alignH, AlignV alignV,
			float scaleFactor, SizeF layoutArea )
        {
            // make sure the font size is properly scaled
            Remake( scaleFactor, this.Size, ref _scaledSize, ref _font );

            // Get the width and height of the text
            SizeF sizeF;
            if ( layoutArea.IsEmpty )
                sizeF = g.MeasureString( text, _font );
            else
                sizeF = g.MeasureString( text, _font, layoutArea );

            // Create a bounding box rectangle for the text
            RectangleF rect = new RectangleF( new PointF( -sizeF.Width / 2.0F, 0.0F ), sizeF );

            // Build a transform matrix that inverts that drawing transform
            // in this manner, the point is brought back to the box, rather
            // than vice-versa.  This allows the container check to be a simple
            // RectangleF.Contains, since the rectangle won't be rotated.
            Matrix matrix = GetMatrix( x, y, sizeF, alignH, alignV, _angle );

            PointF[] pts = new PointF[1];
            pts[0] = pt;
            matrix.TransformPoints( pts );

            return rect.Contains( pts[0] );
        }
开发者ID:sntree,项目名称:ZedGraph,代码行数:61,代码来源:FontSpec.cs

示例15: GetMatrix

        private Matrix GetMatrix( float x, float y, SizeF sizeF, AlignH alignH, AlignV alignV,
							float angle )
        {
            // Build a transform matrix that inverts that drawing transform
            // in this manner, the point is brought back to the box, rather
            // than vice-versa.  This allows the container check to be a simple
            // RectangleF.Contains, since the rectangle won't be rotated.
            Matrix matrix = new Matrix();

            // In this case, the bounding box is anchored to the
            // top-left of the text box.  Handle the alignment
            // as needed.
            float xa, ya;
            if ( alignH == AlignH.Left )
                xa = sizeF.Width / 2.0F;
            else if ( alignH == AlignH.Right )
                xa = -sizeF.Width / 2.0F;
            else
                xa = 0.0F;

            if ( alignV == AlignV.Center )
                ya = -sizeF.Height / 2.0F;
            else if ( alignV == AlignV.Bottom )
                ya = -sizeF.Height;
            else
                ya = 0.0F;

            // Shift the coordinates to accomodate the alignment
            // parameters
            matrix.Translate( -xa, -ya, MatrixOrder.Prepend );

            // Rotate the coordinate system according to the
            // specified angle of the FontSpec
            if ( angle != 0.0F )
                matrix.Rotate( angle, MatrixOrder.Prepend );

            // Move the coordinate system to local coordinates
            // of this text object (that is, at the specified
            // x,y location)
            matrix.Translate( -x, -y, MatrixOrder.Prepend );

            return matrix;
        }
开发者ID:sntree,项目名称:ZedGraph,代码行数:43,代码来源:FontSpec.cs


注:本文中的AlignV类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。