⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 gamefont.cs

📁 Pocket 1945 is a classic shooter inspired by the classic 1942 game. The game is written in C# target
💻 CS
字号:
using System;
using System.Drawing;

namespace Pocket1945
{
	public class GameFont : IDrawable
	{
		#region Fields

		private Brush _brush = new SolidBrush(Color.Red);
		private Font _font = new Font("Tahoma", 10, FontStyle.Bold);
		private string _text = string.Empty;
		private int _x = 10;
		private int _y = 10;

		#endregion

		#region Properties

		public Font Font
		{
			get { return _font; }
			set { _font = value; }
		}

		public string Text
		{
			get { return _text; }
			set { _text = value; }
		}

		public int X
		{
			get { return _x; }
			set { _x = value; }
		}

		public int Y
		{
			get { return _y; }
			set { _y = value; }
		}

		#endregion

		#region Constructor

		public GameFont()
		{
		}

		public GameFont(Color color)
		{
			_brush = new SolidBrush(color);
		}

		public GameFont(Color color, string text)
		{
			_brush = new SolidBrush(color);
			_text = text;
		}

		public GameFont(Color color, string text, Font font)
		{
			_brush = new SolidBrush(color);
			_font = font;
			_text = text;
		}

		public GameFont(Color color, string text, Font font, int x, int y)
		{
			_brush = new SolidBrush(color);
			_font = font;
			_text = text;
			_x = x;
			_y = y;
		}

		#endregion

		public void Draw(Graphics g)
		{	
			g.DrawString(_text, _font, _brush, _x, _y);
		}
	}
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -