本文整理汇总了C#中System.Drawing.Graphics.DrawStringBordered方法的典型用法代码示例。如果您正苦于以下问题:C# Graphics.DrawStringBordered方法的具体用法?C# Graphics.DrawStringBordered怎么用?C# Graphics.DrawStringBordered使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Drawing.Graphics
的用法示例。
在下文中一共展示了Graphics.DrawStringBordered方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: DrawShaiyaDetails
private void DrawShaiyaDetails( Graphics g, Rectangle drawSize ) {
Point stringStart;
SizeF mesure;
// never Initialized
if( ShaiyaName == null || ShaiyaLevel == null )
return;
// Icon
if( ShaiyaClass != null ) {
stringStart = new Point( drawSize.X + ShaiyaClassPadRight, drawSize.Y + ( drawSize.Height / 2 ) - ( ShaiyaClassHeight / 2 ) + ShaiyaClassPadTop );
g.DrawImage( ShaiyaClass, new Rectangle( stringStart.X, stringStart.Y, ShaiyaClassWidth, ShaiyaClassHeight ) );
}
// Name
if( ShaiyaName.Trim().Length > 0 ) {
ShaiyaName = ShaiyaName.Trim();
mesure = g.MeasureString( ShaiyaName, ShaiyaFont );
stringStart = new Point( drawSize.X + 20 + ShaiyaNamePadRight, drawSize.Y + ( drawSize.Height / 2 ) - (int)( mesure.Height / 2f ) + ShaiyaNamePadTop );
if( ShaiyaClass != null )
stringStart.X += ShaiyaClassWidth;
if( ShaiyaTextBorder == true )
g.DrawStringBordered( ShaiyaName, ShaiyaFont, new SolidBrush( ShaiyaTextColor ), new SolidBrush( Color.FromArgb( 255 - ShaiyaTextBorderAlpha, ShaiyaTextBorderColor ) ), stringStart.X, stringStart.Y );
else
g.DrawString( ShaiyaName, ShaiyaFont, new SolidBrush( ShaiyaTextColor ), stringStart.X, stringStart.Y );
// Level
if( ShaiyaLevel.Trim().Length > 0 ) {
ShaiyaLevel = ShaiyaLevel.Trim();
int levelPad = (int)mesure.Width + 10 + ShaiyaLevelPadRight;
mesure = g.MeasureString( ShaiyaName, ShaiyaFont );
stringStart = new Point( stringStart.X + levelPad, drawSize.Y + ( drawSize.Height / 2 ) - (int)( mesure.Height / 2f ) + ShaiyaLevelPadTop );
if( ShaiyaTextBorder == true )
g.DrawStringBordered( ShaiyaLevel, ShaiyaFont, new SolidBrush( ShaiyaTextColor ), new SolidBrush( Color.FromArgb( 255 - ShaiyaTextBorderAlpha, ShaiyaTextBorderColor ) ), stringStart.X, stringStart.Y );
else
g.DrawString( ShaiyaLevel, ShaiyaFont, new SolidBrush( ShaiyaTextColor ), stringStart.X, stringStart.Y );
}
}
}
示例2: DrawCustomString
private void DrawCustomString( Graphics g, Rectangle drawSize ) {
// never Initialized
if( CustomText == null || CustomFont == null )
return;
Point stringStart = new Point( drawSize.X + drawSize.Width + CustomPadRight, drawSize.Y + ( drawSize.Height / 2 ) + CustomPadTop );
SizeF mesure = g.MeasureString( CustomText, CustomFont );
stringStart.X -= (int)mesure.Width;
stringStart.Y -= (int)mesure.Height / 2;
if( CustomTextBorder == true )
g.DrawStringBordered( CustomText, CustomFont, new SolidBrush( CustomTextColor ), new SolidBrush( Color.FromArgb( 255 - CustomTextBorderAlpha, CustomTextBorderColor ) ), stringStart.X, stringStart.Y );
else
g.DrawString( CustomText, CustomFont, new SolidBrush( CustomTextColor ), stringStart.X, stringStart.Y );
}
示例3: DrawCustomString
private void DrawCustomString( Graphics g, Rectangle drawSize ) {
if( CustomTexts.Count == 0 )
return;
for( int i = 0; i < CustomTexts.Count; i++ ) {
CustomSettingSet set = CustomTexts[ i ];
Point stringStart = new Point( drawSize.X + drawSize.Width + set.PadRight, drawSize.Y + ( drawSize.Height / 2 ) + set.PadTop );
SizeF mesure = g.MeasureString( set.Text, set.Font );
stringStart.X -= (int)mesure.Width;
stringStart.Y -= (int)mesure.Height / 2;
if( set.TextBorder == true )
g.DrawStringBordered( set.Text, set.Font, new SolidBrush( CustomTextColor ), new SolidBrush( Color.FromArgb( 255 - set.BorderAlpha, CustomTextBorderColor ) ), stringStart.X, stringStart.Y );
else
g.DrawString( set.Text, set.Font, new SolidBrush( CustomTextColor ), stringStart.X, stringStart.Y );
}
}