本文整理汇总了C#中AlignH类的典型用法代码示例。如果您正苦于以下问题:C# AlignH类的具体用法?C# AlignH怎么用?C# AlignH使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
AlignH类属于命名空间,在下文中一共展示了AlignH类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: 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;
}
示例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;
}
示例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 );
}
示例4: Scale
/// <summary>
/// Constructor for deserializing objects
/// </summary>
/// <param name="info">A <see cref="SerializationInfo"/> instance that defines the serialized data
/// </param>
/// <param name="context">A <see cref="StreamingContext"/> instance that contains the serialized data
/// </param>
protected Scale( SerializationInfo info, StreamingContext context )
{
// The schema value is just a file version parameter. You can use it to make future versions
// backwards compatible as new member variables are added to classes
int sch = info.GetInt32( "schema" );
_min = info.GetDouble( "min" );
_max = info.GetDouble( "max" );
_majorStep = info.GetDouble( "majorStep" );
_minorStep = info.GetDouble( "minorStep" );
_exponent = info.GetDouble( "exponent" );
_baseTic = info.GetDouble( "baseTic" );
_minAuto = info.GetBoolean( "minAuto" );
_maxAuto = info.GetBoolean( "maxAuto" );
_majorStepAuto = info.GetBoolean( "majorStepAuto" );
_minorStepAuto = info.GetBoolean( "minorStepAuto" );
_magAuto = info.GetBoolean( "magAuto" );
_formatAuto = info.GetBoolean( "formatAuto" );
_minGrace = info.GetDouble( "minGrace" );
_maxGrace = info.GetDouble( "maxGrace" );
_mag = info.GetInt32( "mag" );
_isReverse = info.GetBoolean( "isReverse" );
_isPreventLabelOverlap = info.GetBoolean( "isPreventLabelOverlap" );
_isUseTenPower = info.GetBoolean( "isUseTenPower" );
_isVisible = true;
_isVisible = info.GetBoolean( "isVisible" );
_isSkipFirstLabel = info.GetBoolean( "isSkipFirstLabel" );
_isSkipLastLabel = info.GetBoolean( "isSkipLastLabel" );
_isSkipCrossLabel = info.GetBoolean( "isSkipCrossLabel" );
_textLabels = (string[]) info.GetValue( "textLabels", typeof(string[]) );
_format = info.GetString( "format" );
_majorUnit = (DateUnit) info.GetValue( "majorUnit", typeof(DateUnit) );
_minorUnit = (DateUnit) info.GetValue( "minorUnit", typeof(DateUnit) );
_isLabelsInside = info.GetBoolean( "isLabelsInside" );
_align = (AlignP)info.GetValue( "align", typeof( AlignP ) );
if ( schema >= 11 )
_alignH = (AlignH)info.GetValue( "alignH", typeof( AlignH ) );
_fontSpec = (FontSpec)info.GetValue( "fontSpec", typeof( FontSpec ) );
_labelGap = info.GetSingle( "labelGap" );
}
示例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;
}
示例6: 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="PaneBase.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,
float scaleFactor )
{
SmoothingMode sModeSave = g.SmoothingMode;
TextRenderingHint sHintSave = g.TextRenderingHint;
if ( _isAntiAlias )
{
g.SmoothingMode = SmoothingMode.HighQuality;
g.TextRenderingHint = TextRenderingHint.AntiAlias;
}
// make sure the font size is properly scaled
Remake( scaleFactor, this.Size, ref _scaledSize, ref _font );
float scaledSuperSize = _scaledSize * Default.SuperSize;
Remake( scaleFactor, this.Size * Default.SuperSize, ref scaledSuperSize,
ref _superScriptFont );
// Get the width and height of the text
SizeF size10 = g.MeasureString( "10", _font );
SizeF sizeText = g.MeasureString( text, _superScriptFont );
SizeF totSize = new SizeF( size10.Width + sizeText.Width,
size10.Height + sizeText.Height * Default.SuperShift );
float charWidth = g.MeasureString( "x", _superScriptFont ).Width;
// Save the old transform matrix for later restoration
Matrix saveMatrix = g.Transform;
g.Transform = SetupMatrix( g.Transform, x, y, totSize, alignH, alignV, _angle );
// make a center justified StringFormat alignment
// for drawing the text
StringFormat strFormat = new StringFormat();
strFormat.Alignment = _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
// the TopLeft position. Therefore, move the rectangle
// width/2 to the left to align it properly
RectangleF rectF = new RectangleF( -totSize.Width / 2.0F, 0.0F,
totSize.Width, totSize.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 solid brush for rendering the font itself
using ( SolidBrush brush = new SolidBrush( _fontColor ) )
{
// Draw the actual 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.
g.DrawString( "10", _font, brush,
( -totSize.Width + size10.Width ) / 2.0F,
sizeText.Height * Default.SuperShift, strFormat );
g.DrawString( text, _superScriptFont, brush,
( totSize.Width - sizeText.Width - charWidth ) / 2.0F,
0.0F,
strFormat );
}
// Restore the transform matrix back to original
g.Transform = saveMatrix;
//.........这里部分代码省略.........
示例7: Location
/// <summary>
/// The Copy Constructor
/// </summary>
/// <param name="rhs">The <see cref="Location"/> object from which to copy</param>
public Location( Location rhs )
{
this.x = rhs.x;
this.y = rhs.y;
this.width = rhs.width;
this.height = rhs.height;
this.coordinateFrame = rhs.CoordinateFrame;
this.alignH = rhs.AlignH;
this.alignV = rhs.AlignV;
}
示例8: 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(double x, double y, CoordType coordType, AlignH alignH, AlignV alignV)
{
_x = x;
_y = y;
_width = 0;
_height = 0;
_coordinateFrame = coordType;
_alignH = alignH;
_alignV = alignV;
}
示例9: Style
/// <summary>
/// Apply style to Zedgraph text object
/// </summary>
/// <param name="textObj"></param>
/// <param name="color"></param>
/// <param name="size"></param>
/// <param name="alignH"></param>
public static TextObj Style(this TextObj textObj, Color color, int size, AlignH alignH)
{
textObj.Style(color, size);
textObj.Location.AlignH = alignH;
return textObj;
}
示例10: 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;
}
示例11: 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>
public void Draw( Graphics g, PaneBase pane, string text, float x,
float y, AlignH alignH, AlignV alignV,
float scaleFactor )
{
this.Draw( g, pane, text, x, y, alignH, alignV,
scaleFactor, new SizeF() );
}
示例12: 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;
}
示例13: 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>
/// <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 )
{
return PointInBox( pt, g, text, x, y, alignH, alignV, scaleFactor, new SizeF() );
}
示例14: 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;
}
示例15: ImageObj
/// <overloads>Constructors for the <see cref="ImageObj"/> object</overloads>
/// <summary>
/// A constructor that allows the <see cref="System.Drawing.Image"/> and
/// <see cref="RectangleF"/> location for the
/// <see cref="ImageObj"/> to be pre-specified.
/// </summary>
/// <param name="image">A <see cref="System.Drawing.Image"/> class that defines
/// the image</param>
/// <param name="rect">A <see cref="RectangleF"/> struct that defines the
/// image location, specifed in units based on the
/// <see cref="Location.CoordinateFrame"/> 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 ImageObj(Image image, RectangleF rect, CoordType coordType,
AlignH alignH, AlignV alignV)
: base(rect.X, rect.Y, rect.Width, rect.Height, coordType,
alignH, alignV)
{
_image = image;
_isScaled = Default.IsScaled;
}