本文整理汇总了C#中StringAlignment类的典型用法代码示例。如果您正苦于以下问题:C# StringAlignment类的具体用法?C# StringAlignment怎么用?C# StringAlignment使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
StringAlignment类属于命名空间,在下文中一共展示了StringAlignment类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: WatermarkFileWithText
public void WatermarkFileWithText(string inputFile, string outputFile, string text, Font font, int x, int y,
bool renderOver,
Brush under, Brush over, StringAlignment xAlignment,
StringAlignment yAlignment)
{
Image imgPhoto = null;
Image outputPhoto = null;
try
{
try
{
imgPhoto = Image.FromFile(inputFile);
}
catch (Exception ex)
{
throw new InvalidOperationException("Failed to open file \"" + inputFile + "\"", ex);
}
WatermarkImageWithText(imgPhoto, ref outputPhoto, SmoothingMode.AntiAlias, text, font, x, y, renderOver,
under, over, xAlignment, yAlignment);
imgPhoto.Dispose();
imgPhoto = null;
outputPhoto.Save(outputFile, ImageFormat.Jpeg);
}
finally
{
if (imgPhoto != null) imgPhoto.Dispose();
if (outputPhoto != null) outputPhoto.Dispose();
}
}
示例2: MonthViewBoxEventArgs
internal MonthViewBoxEventArgs(Graphics g, Rectangle bounds, string text, StringAlignment textAlign, Color textColor, Color backColor, Color borderColor)
{
_graphics = g;
_bounds = bounds;
Text = text;
TextColor = textColor;
BackgroundColor = backColor;
BorderColor = borderColor;
switch (textAlign)
{
case StringAlignment.Center:
TextFlags |= TextFormatFlags.HorizontalCenter;
break;
case StringAlignment.Far:
TextFlags |= TextFormatFlags.Right;
break;
case StringAlignment.Near:
TextFlags |= TextFormatFlags.Left;
break;
default:
break;
}
TextFlags |= TextFormatFlags.VerticalCenter;
}
示例3: addButton
/* ==========================================================
* PUBLIC METHODS
* ==========================================================
*/
public void addButton(int xPos, int yPos, int width, int height, string label = "", bool showText = true, StringAlignment alignment = StringAlignment.CENTER)
{
BasicButton button = new BasicButton(xPos, yPos, width, height, basicBox, buttonFontStyle1, label, alignment, showText);
componentsOnScreen.Add(button);
buttonsOnScreen.Add(button);
}
示例4: GetAlignmentFromStringAlignment
/// <summary>
/// converts two given alignment values to one content alignment
/// </summary>
public static ContentAlignment GetAlignmentFromStringAlignment(StringAlignment alignment,
StringAlignment linealignment)
{
ContentAlignment ret;
//horizontal
switch(alignment)
{
case StringAlignment.Near:
ret=anyleft; break;
case StringAlignment.Center:
ret=anycenter; break;
default:
ret=anyright; break;
}
//vertical
switch(linealignment)
{
case StringAlignment.Near:
ret&=anytop; break;
case StringAlignment.Center:
ret&=anymiddle; break;
default:
ret&=anybottom; break;
}
return ret;
}
示例5: VMergedCell
public VMergedCell(int firstRow, int lastRow, StringAlignment alignment,
StringAlignment lineAlignment)
: this(firstRow, lastRow)
{
this.alignment = alignment;
this.lineAlignment = lineAlignment;
}
示例6: CreateInfomationBitmap
private static Bitmap CreateInfomationBitmap(string content, int width, int height,
StringAlignment hAlign = StringAlignment.Near,
StringAlignment vAlign = StringAlignment.Near)
{
Bitmap b = new Bitmap(width, height);
Graphics g = Graphics.FromImage(b);
GraphicsPath path = new GraphicsPath();
FontFamily fontFamily = new FontFamily("微软雅黑");
StringFormat format = new StringFormat();
format.Alignment = hAlign;
format.LineAlignment = vAlign;
path.AddString(content,
fontFamily, (int)FontStyle.Bold, 16, new Rectangle(0, 0, width, height), format);
fontFamily.Dispose();
g.SmoothingMode = SmoothingMode.AntiAlias;
g.FillPath(Brushes.Black, path);
Pen pen = new Pen(Color.Black, 2);
g.DrawPath(pen, path);
g.Dispose();
pen.Dispose();
Bitmap infoBitmap = RenderUtils.BoxBlur(b, 1);
g = Graphics.FromImage(infoBitmap);
g.SmoothingMode = SmoothingMode.AntiAlias;
g.FillPath(Brushes.White, path);
g.Dispose();
return infoBitmap;
}
示例7: HeadingButton
public HeadingButton(string aString, string aFontName, int pointSize, FontStyle style, int x, int y, int width, int height, StringAlignment align, StringAlignment lineAlign, uint txtColor, Graphic background)
:base(aString,aFontName,pointSize,style, x,y,width,height,align,lineAlign,txtColor,background)
{
//GFont aFont = new GFont(aFontName, pointSize, Guid.NewGuid());
//this.Font = aFont;
Enabled = true;
}
示例8: FixedWidthColumn
public FixedWidthColumn(string name, int width, StringAlignment align, char blankChar)
{
this._name = name;
this._w = width;
this._align = align;
this._blank = blankChar;
}
示例9: HMergedCell
public HMergedCell(int leftColumn, int rightColumn, StringAlignment alignment,
StringAlignment lineAlignment)
: this(leftColumn, rightColumn)
{
this.alignment = alignment;
this.lineAlignment = lineAlignment;
}
示例10: SimpleLabel
public SimpleLabel(
string text = "",
float x = 0.0f, float y = 0.0f,
Font font = null, Brush brush = null,
float width = float.MaxValue, float height = float.MaxValue,
StringAlignment horizontalAlignment = StringAlignment.Near,
StringAlignment verticalAlignment = StringAlignment.Near,
IEnumerable<string> alternateText = null)
{
Text = text;
X = x;
Y = y;
Font = font ?? new Font("Arial", 1.0f);
Brush = brush ?? new SolidBrush(Color.Black);
Width = width;
Height = height;
HorizontalAlignment = horizontalAlignment;
VerticalAlignment = verticalAlignment;
IsMonospaced = false;
HasShadow = true;
ShadowColor = Color.FromArgb(128, 0, 0, 0);
((List<string>)(AlternateText = new List<string>())).AddRange(alternateText ?? new string[0]);
Format = new StringFormat
{
Alignment = HorizontalAlignment,
LineAlignment = VerticalAlignment,
FormatFlags = StringFormatFlags.NoWrap,
Trimming = StringTrimming.EllipsisCharacter
};
}
示例11: GetTextBoxColumn
protected override object GetTextBoxColumn(StringAlignment alignment)
{
var column = new DataGridTextColumn();
// TODO: set alignment in style
column.Width = alignment == StringAlignment.Near ? 160 : 80;
return column;
}
示例12: ListColumnDefinition
public ListColumnDefinition(string id, string text, string groupName, int width, StringAlignment align)
{
this.align = align;
this.groupName = groupName;
this.id = id;
this.width = width;
this.text = text;
}
示例13: StringFormat
public StringFormat(StringFormatFlags options) {
this.native = LibIGraph.CreateStringFormat
(StringAlignment.Near, options, StringAlignment.Near, StringTrimming.None);
this.trimming = StringTrimming.None;
this.alignment = StringAlignment.Near;
this.lineAlignment = StringAlignment.Near;
this.stringFormatFlags = options;
}
示例14: MprStlTxt
public MprStlTxt(Font f, Color c, bool rtl, StringAlignment a, StringAlignment la)
{
Font = f;
Color = c;
DirectionRightToLeft = rtl;
Alignment = a;
LineAlignment = la;
}
示例15: TextField
public TextField(string text) {
Alignment = StringAlignment.Near;
Outline = 0;
OutlineColor = Color.Black;
Text = text;
TextColor = Color.White;
VerticalAlignment = StringAlignment.Near;
}