public override string ToString() { return(string.Concat(new string[] { "加入複數随机角色 : ", Pattern, " 至 : ", CellNumber.ToString(), " 格子" })); }
public override void Draw(Graphics graphics, Color colour, Size display) { base.Draw(graphics, colour, display); // Draw cell number Rectangle bounds = GetBounds(); Program.DrawTextAligned(graphics, colour, CellNumber.ToString(), bounds, (int)Program.Text.Alignment.Middle); Size size = bounds.Size; Program.DrawRectangle(graphics, colour, Center, size); // Draw greyscaleValue string text; const int binaryFormat = (int)Program.DataFormats.Binary; const int decimalFormat = (int)Program.DataFormats.Decimal; const int hexFormat = (int)Program.DataFormats.Hexadecimal; const int stringFormat = (int)Program.DataFormats.String; switch (Program.DataFormat) { case binaryFormat: text = Program.ConvertToBinary(this.Value); break; case decimalFormat: text = Program.ConvertToDecimal(this.Value).ToString(); break; case hexFormat: text = Program.ConvertToHexadecimal(this.Value); break; case stringFormat: default: text = string.Empty + this.Value; break; } Rectangle valueBounds = bounds; valueBounds.X += labelWidth; valueBounds.Width -= labelWidth; Program.DrawRectangle(graphics, colour, valueBounds); Program.DrawText(graphics, colour, text, valueBounds, (int)Program.Text.Justified.Center, (int)Program.Text.Alignment.Middle); }