本文整理汇总了C#中TextBuffer.DrawBox方法的典型用法代码示例。如果您正苦于以下问题:C# TextBuffer.DrawBox方法的具体用法?C# TextBuffer.DrawBox怎么用?C# TextBuffer.DrawBox使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TextBuffer
的用法示例。
在下文中一共展示了TextBuffer.DrawBox方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: DrawMenu
public void DrawMenu(TextBuffer GUIText)
{
ValidateSelected();
Widget[] Entries = MenuEntries.ToArray();
// Separator
int Width = MenuTitle.Length + 5;
int Height = 3;
for (int i = 0; i < Entries.Length; i++) {
Width = Math.Max(Width, Entries[i].Width + 3);
Height += Entries[i].Height;
}
int X = GUIText.BufferWidth / 2 - Width / 2 - 1;
int Y = GUIText.BufferHeight / 2 - Height / 2 - 1;
//DrawBox(GUIText, Width, 0, 0, GUIText.BufferHeight - 1);
// Outline
for (int x = 0; x < Width; x++)
for (int y = 0; y < Height; y++)
GUIText[X + x, Y + y] = 0;
GUIText.DrawBox(X, Y, Width, Height);
GUIText.Print(X + 2, Y, "[" + MenuTitle + "]");
// Entries
int YOff = 0;
for (int i = 0; i < Entries.Length; i++) {
Entries[i].Draw(GUIText, X + 2, Y + 2 + YOff, i == Selected);
YOff += Entries[i].Height;
}
/*GUIText.Print(X + 2, Y + i + 2, Entries[i],
i == Selected ? Color.Black : ConsoleColor.Gray.ToColor(), i == Selected ? Color.White : Color.Black);*/
}
示例2: Draw
public override void Draw(TextBuffer TBuffer, int X, int Y, bool IsSelected)
{
Color Fg = ConsoleColor.Gray.ToColor();
Color Bg = Color.Black;
if (IsSelected && !CaptureInput) {
Fg = Color.Black;
if (Enabled)
Bg = Color.White;
else
Bg = ConsoleColor.DarkGray.ToColor();
}
TBuffer.DrawBox(X, Y, Width, Entries.Length + 1);
TBuffer.Print(X + 1, Y, "[" + Txt + "]", Fg, Bg);
for (int i = 0; i < Entries.Length; i++) {
Color F = Color.White;
Color B = Color.Black;
if (CaptureInput && Selected == i) {
F = Color.Black;
B = Color.White;
}
string Pref = " ";
if (Selected == i || SelectedActive == i)
Pref = ">";
TBuffer.Print(X + 1, Y + i + 1, Pref, F, B);
TBuffer.Print(X + 3, Y + i + 1, Entries[i]);
}
}