?? character.cs
字號:
using System;
using System.Collections.Generic;
using System.Text;
using System.Drawing;
using System.Windows.Forms;
namespace HuaRongDao
{
public class Character:Control
{
private string _logicName = "CC";
private Size _logicSize = new Size(2,2);
private Point _logicLocation = Point.Empty;
private bool _isCC = true;
private Rectangle _logicBounds = Rectangle.Empty;
private bool _isFocused = false;
public Character()
{
}
public Character(string logicName, Size logicSize)
{
_logicName = logicName;
_logicSize = logicSize;
_isCC = false;
}
public Character(string logicName, Size logicSize, Point logicLocation)
{
_logicName = logicName;
_logicSize = logicSize;
LogicLocation = logicLocation;
_isCC = false;
}
public Character(string logicName, Size logicSize, Point logicLocation, bool isCC)
{
_logicName = logicName;
_logicSize = logicSize;
LogicLocation = logicLocation;
_isCC = isCC;
}
public string LogicName
{
get { return _logicName; }
}
public Size LogicSize
{
get { return _logicSize; }
}
public Point LogicLocation
{
get { return _logicLocation; }
set
{
_logicLocation = value;
_logicBounds = new Rectangle(value, this.LogicSize);
OnLogicLocationChanged(new EventArgs());
}
}
public bool IsFocused
{
get { return _isFocused; }
set
{
_isFocused = value;
this.Refresh();
}
}
public event EventHandler LogicLocationChanged = null;
protected virtual void OnLogicLocationChanged(EventArgs e)
{
if (this.LogicLocationChanged != null)
{
this.LogicLocationChanged(this, e);
}
}
public bool IsCC
{
get { return true; }
}
public Rectangle LogicBounds
{
get { return _logicBounds; }
}
protected override void OnPaint(PaintEventArgs e)
{
Rectangle rect = new Rectangle(new Point(0,0), this.Size);
if (this.IsFocused)
{
e.Graphics.FillRectangle(Brushes.Aquamarine, rect);
}
e.Graphics.DrawString(this.LogicName, SystemFonts.DefaultFont, Brushes.Black, rect);
rect.Width --;
rect.Height--;
e.Graphics.DrawRectangle(Pens.Black, rect);
}
}
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -