📄 idrawsetting.cs
字号:
using System;
using System.Drawing;
using System.Collections;
using System.Windows.Forms;
namespace MinesWeeper
{
/// <summary>
/// IMineSetting の概要の説明です。
/// </summary>
public interface IDrawSetting
{
//根据显示返回不同颜色
Color GetColorByString(String display);
//每一个点的宽度
//(当更改大小时应该要触发一个事件给显示控件的)
int Width { get; set; }
//显示的字体
Font DisplayFont { get; set; }
//显示笔刷
SolidBrush DisplayBrush { get; }
//雷的显示字符串
String MineDisplay { get; set; }
//雷区边框的显示式样
Border3DStyle GetBorderStyle(bool isOpened);
}
public class DefaultDrawSetting : IDrawSetting
{
Hashtable showColors = new Hashtable(10);
SolidBrush drawBrush = new SolidBrush(Color.Black);
Font drawFont = new Font("Arial Black", 7);
String mineString = "★";
int drawLength = 18;
public DefaultDrawSetting()
{
showColors.Add("1",Color.Blue);
showColors.Add("2",Color.Brown);
showColors.Add("3",Color.Chocolate);
showColors.Add("4",Color.DeepSkyBlue);
showColors.Add("5",Color.DeepPink);
showColors.Add("6",Color.Cornsilk);
showColors.Add("7",Color.Coral);
showColors.Add("8",Color.Crimson);
showColors.Add(mineString,Color.Red);
}
public int Width
{
get
{
return drawLength;
}
set
{
drawLength = value;
}
}
public String MineDisplay
{
get{ return mineString; }
set{ mineString = value; }
}
public Font DisplayFont
{
get
{
// TODO: DefaultDrawSetting.DisplayFont getter 実装を追加します。
return drawFont;
}
set
{
drawFont = value;
}
}
public SolidBrush DisplayBrush
{
get { return drawBrush; }
}
public Border3DStyle GetBorderStyle(bool isOpened)
{
return (isOpened ? Border3DStyle.SunkenInner : Border3DStyle.RaisedInner);
}
public Color GetColorByString(String display)
{
Object obj = showColors[display];
if(null == obj)
{
return Color.DarkViolet;
}
return (Color)obj;
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -