當前位置: 首頁>>代碼示例>>C#>>正文


C# Graphics.DrawStringBordered方法代碼示例

本文整理匯總了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 );
				}
			}

		}
開發者ID:GodLesZ,項目名稱:svn-dump,代碼行數:40,代碼來源:Userbar.cs

示例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 );
		}
開發者ID:GodLesZ,項目名稱:svn-dump,代碼行數:14,代碼來源:Userbar.cs

示例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 );
			}
		}
開發者ID:GodLesZ,項目名稱:svn-dump,代碼行數:16,代碼來源:Signatur.cs


注:本文中的System.Drawing.Graphics.DrawStringBordered方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。