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


C# StringAlignment类代码示例

本文整理汇总了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();
            }
        }
开发者ID:tiwariritesh7,项目名称:devdefined-tools,代码行数:32,代码来源:Watermarker.cs

示例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;
        }
开发者ID:Gauss-IT,项目名称:GaussLMS,代码行数:26,代码来源:MonthViewBoxEventArgs.cs

示例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);
        }
开发者ID:Kairna,项目名称:TouchAndPlay,代码行数:11,代码来源:BasicScreen.cs

示例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;
 }
开发者ID:kjburns31,项目名称:vixen-modules,代码行数:29,代码来源:GraphicsEx.cs

示例5: VMergedCell

 public VMergedCell(int firstRow, int lastRow, StringAlignment alignment,
     StringAlignment lineAlignment)
     : this(firstRow, lastRow)
 {
     this.alignment = alignment;
     this.lineAlignment = lineAlignment;
 }
开发者ID:stankela,项目名称:gimnastika,代码行数:7,代码来源:VMergedCell.cs

示例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;
        }
开发者ID:KotonoYuuri,项目名称:OriginalFireBarrager,代码行数:27,代码来源:Infomations.cs

示例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;
	}
开发者ID:Wiladams,项目名称:NewTOAPIA,代码行数:7,代码来源:HeadingButton.cs

示例8: FixedWidthColumn

 public FixedWidthColumn(string name, int width, StringAlignment align, char blankChar)
 {
     this._name = name;
     this._w = width;
     this._align = align;
     this._blank = blankChar;
 }
开发者ID:tenshino,项目名称:RainstormStudios,代码行数:7,代码来源:FixedWidthStreamWriter.cs

示例9: HMergedCell

 public HMergedCell(int leftColumn, int rightColumn, StringAlignment alignment,
     StringAlignment lineAlignment)
     : this(leftColumn, rightColumn)
 {
     this.alignment = alignment;
     this.lineAlignment = lineAlignment;
 }
开发者ID:stankela,项目名称:gimnastika,代码行数:7,代码来源:HMergedCell.cs

示例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
     };
 }
开发者ID:Rezura,项目名称:LiveSplit,代码行数:30,代码来源:SimpleLabel.cs

示例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;
 }
开发者ID:dogbiscuituk,项目名称:TagScanner32767,代码行数:7,代码来源:GridControllerWPF.cs

示例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;
 }
开发者ID:jcboliveira,项目名称:gps-running,代码行数:8,代码来源:OverlayColumnIds.cs

示例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;
		}
开发者ID:bradparks,项目名称:DotNetAnywhere,代码行数:8,代码来源:StringFormat.cs

示例14: MprStlTxt

 public MprStlTxt(Font f, Color c, bool rtl, StringAlignment a, StringAlignment la)
 {
     Font = f;
     Color = c;
     DirectionRightToLeft = rtl;
     Alignment = a;
     LineAlignment = la;
 }
开发者ID:jalil1408,项目名称:BiomPSP,代码行数:8,代码来源:MprStlTxt.cs

示例15: TextField

 public TextField(string text) {
     Alignment = StringAlignment.Near;
     Outline = 0;
     OutlineColor = Color.Black;
     Text = text;
     TextColor = Color.White;
     VerticalAlignment = StringAlignment.Near;
 }
开发者ID:dwinkelman,项目名称:imagelibrary,代码行数:8,代码来源:TextField.cs


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