Menü görünümü :?????
Lütfen yardımcı olabilir misiniz ?
Bu tür de ki menülerde konum belirleyemiyorum. Yani demek istediğim bu görünen menüler sayfanın ortalarında yada herhangi bir yerinde olmasını nasıl sağlarım ?
Saygılarımla ,teşekkür ederim.
Menü için yazmış olduğum kodlar.
namespace Konular
{
public class Class1
{
static int index = 0;
public static void notlar()
{
Console.Title = "N O T L A R I M";
Console.OutputEncoding = Encoding.GetEncoding("ibm857");
//Dizi tanımlama işlemi ile menü oluşturmak
string[] dizi_menuler = new string[] { "C # CONSOLE KODLAMA \t", "C # NESNEL KODLAMA \t", "Çıkış" };
Console.WriteLine(dizi_menuler[0]);
Console.WriteLine(dizi_menuler[1]);
Console.WriteLine(dizi_menuler[2]);
List<string> list_menuler = new List<string>(dizi_menuler);
Console.CursorVisible = false;
while (true)
{
Console.Clear();
string secili_oge;
secili_oge = menuler(list_menuler);
if (secili_oge == "C # CONSOLE KODLAMA")
{
Konu_Console.Console_dersi();
}
else if (secili_oge == "C # NESNEL KODLAMA")
{
// Console.Clear();
Konu_Nesnel.Nesnel_dersi();
}
else if (secili_oge == "Çıkış")
{
Environment.Exit(0);
}
}
}
private static string menuler(List<string> list_menu)
{
for (int i = 0; i < list_menu.Count; i++)
{
if (i == index)
{
Console.BackgroundColor = ConsoleColor.Red;
Console.ForegroundColor = ConsoleColor.Green;
Console.Write(list_menu);
}
else
{
Console.Write(list_menu);
}
Console.ResetColor();
}
ConsoleKeyInfo basilantus;
basilantus = Console.ReadKey();
if (basilantus.Key == ConsoleKey.UpArrow)
{
if (index <= 0)
{
}
else
{
index--;
}
}
else if (basilantus.Key == ConsoleKey.DownArrow)
{
if (index == list_menu.Count - 1)
{
}
else
{
index++;
}
}
else if (basilantus.Key == ConsoleKey.Enter)
{
return list_menu[index];
}
else if (basilantus.Key != ConsoleKey.RightArrow || basilantus.Key != ConsoleKey.LeftArrow || basilantus.Key != ConsoleKey.Enter)
{
Console.WriteLine("Hatalı bir tıklama işlemi !!!");
}
else
{
return "";
}
Console.Clear();
return "";
}
}
}
Lütfen yardımcı olabilir misiniz ?
Bu tür de ki menülerde konum belirleyemiyorum. Yani demek istediğim bu görünen menüler sayfanın ortalarında yada herhangi bir yerinde olmasını nasıl sağlarım ?
Saygılarımla ,teşekkür ederim.
Menü için yazmış olduğum kodlar.
namespace Konular
{
public class Class1
{
static int index = 0;
public static void notlar()
{
Console.Title = "N O T L A R I M";
Console.OutputEncoding = Encoding.GetEncoding("ibm857");
//Dizi tanımlama işlemi ile menü oluşturmak
string[] dizi_menuler = new string[] { "C # CONSOLE KODLAMA \t", "C # NESNEL KODLAMA \t", "Çıkış" };
Console.WriteLine(dizi_menuler[0]);
Console.WriteLine(dizi_menuler[1]);
Console.WriteLine(dizi_menuler[2]);
List<string> list_menuler = new List<string>(dizi_menuler);
Console.CursorVisible = false;
while (true)
{
Console.Clear();
string secili_oge;
secili_oge = menuler(list_menuler);
if (secili_oge == "C # CONSOLE KODLAMA")
{
Konu_Console.Console_dersi();
}
else if (secili_oge == "C # NESNEL KODLAMA")
{
// Console.Clear();
Konu_Nesnel.Nesnel_dersi();
}
else if (secili_oge == "Çıkış")
{
Environment.Exit(0);
}
}
}
private static string menuler(List<string> list_menu)
{
for (int i = 0; i < list_menu.Count; i++)
{
if (i == index)
{
Console.BackgroundColor = ConsoleColor.Red;
Console.ForegroundColor = ConsoleColor.Green;
Console.Write(list_menu);
}
else
{
Console.Write(list_menu);
}
Console.ResetColor();
}
ConsoleKeyInfo basilantus;
basilantus = Console.ReadKey();
if (basilantus.Key == ConsoleKey.UpArrow)
{
if (index <= 0)
{
}
else
{
index--;
}
}
else if (basilantus.Key == ConsoleKey.DownArrow)
{
if (index == list_menu.Count - 1)
{
}
else
{
index++;
}
}
else if (basilantus.Key == ConsoleKey.Enter)
{
return list_menu[index];
}
else if (basilantus.Key != ConsoleKey.RightArrow || basilantus.Key != ConsoleKey.LeftArrow || basilantus.Key != ConsoleKey.Enter)
{
Console.WriteLine("Hatalı bir tıklama işlemi !!!");
}
else
{
return "";
}
Console.Clear();
return "";
}
}
}