修改指令:
1 | sudo dpkg-reconfigure dash |
參考文件:DashAsBinSh
1 | sudo dpkg-reconfigure dash |
1 2 | sudo apt-get update sudo apt-get install mingetty |
1 | sudo vi /etc/default/grub |
1 | sudo update-grub |
1 | sudo vi /etc/init/tty1.conf |

1 2 3 4 5 6 7 8 | class Program { static void Main(string[] args) { Console.SetCursorPosition(36, Console.CursorTop); Console.WriteLine("Hello World"); } } |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | public static class ConsoleEx { public static bool IsOutputRedirected { get { return FileType.Char != GetFileType(GetStdHandle(StdHandle.Stdout)); } } public static bool IsInputRedirected { get { return FileType.Char != GetFileType(GetStdHandle(StdHandle.Stdin)); } } public static bool IsErrorRedirected { get { return FileType.Char != GetFileType(GetStdHandle(StdHandle.Stderr)); } } private enum FileType { Unknown, Disk, Char, Pipe }; private enum StdHandle { Stdin = -10, Stdout = -11, Stderr = -12 }; [DllImport("kernel32.dll")] private static extern FileType GetFileType(IntPtr hdl); [DllImport("kernel32.dll")] static extern bool GetFileSizeEx(IntPtr hFile, out long lpFileSize); [DllImport("kernel32.dll")] private static extern IntPtr GetStdHandle(StdHandle std); } |
1 2 3 4 5 6 7 8 9 | class Program { static void Main(string[] args) { if (!ConsoleEx.IsOutputRedirected) Console.SetCursorPosition(36, Console.CursorTop); Console.WriteLine("Hello World"); } } |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 | class Program { private enum StdHandle { Stdin = -10, Stdout = -11, Stderr = -12 }; [DllImport("kernel32.dll")] private static extern IntPtr GetStdHandle(StdHandle std); [DllImport("kernel32.dll")] [System.Runtime.Versioning.ResourceExposure(System.Runtime.Versioning.ResourceScope.Process)] internal static extern bool GetConsoleMode(IntPtr hConsoleHandle, out int mode); public static bool IsRedirected { get { int mode; GetConsoleMode(GetStdHandle(StdHandle.Stdout), out mode); return mode == 0; } } static void Main(string[] args) { if (!IsRedirected) Console.SetCursorPosition(36, Console.CursorTop); Console.WriteLine("Hello World"); } } |
1 2 3 4 5 6 7 8 9 | class Program { static void Main(string[] args) { if (!Console.IsOutputRedirected) Console.SetCursorPosition(36, Console.CursorTop); Console.WriteLine("Hello World"); } } |
1 | private bool resize = false; |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | private void button1_MouseMove(object sender, MouseEventArgs e) { Button btn = (Button)sender; if (e.Button == MouseButtons.Left && resize) { btn.Width = e.X; btn.Height = e.Y; } else { Point pt = btn.PointToClient(Control.MousePosition); if (pt.X > btn.Width - 5 && pt.Y > btn.Height - 5) { btn.Cursor = Cursors.SizeNWSE; resize = true; } else { btn.Cursor = Cursors.Default; resize = false; } } } |
private Point mouse_offset;
private void button1_MouseDown(object sender, MouseEventArgs e) { mouse_offset = new Point(-e.X, -e.Y); }
1 2 3 4 5 6 7 8 9 10 | private void button1_MouseMove(object sender, MouseEventArgs e) { if (e.Button == MouseButtons.Left) { Button btn = (Button)sender; Point mousePos = PointToClient(Control.MousePosition); mousePos.Offset(mouse_offset.X, mouse_offset.Y); btn.Location = mousePos; } } |
private void CustomButton_Paint(object sender, PaintEventArgs e) { System.Drawing.Drawing2D.GraphicsPath myGraphicsPath = new System.Drawing.Drawing2D.GraphicsPath(); myGraphicsPath.AddEllipse(new Rectangle(0, 0, 50, 50)); myGraphicsPath.AddEllipse(new Rectangle(30, 35, 10, 10)); myGraphicsPath.AddEllipse(new Rectangle(50, 0, 50, 50)); myGraphicsPath.AddEllipse(new Rectangle(60, 35, 10, 10)); CustomButton.BackColor = Color.Brown; CustomButton.FlatStyle = FlatStyle.Flat; CustomButton.FlatAppearance.BorderSize = 0; CustomButton.Region = new Region(myGraphicsPath); }
FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
private Point mouse_offset;
private void Form1_MouseDown(object sender, MouseEventArgs e) { mouse_offset = new Point(-e.X, -e.Y); }
private void Form1_MouseMove(object sender, MouseEventArgs e) { if (e.Button == MouseButtons.Left) { Point mousePos = Control.MousePosition; mousePos.Offset(mouse_offset.X, mouse_offset.Y); Location = mousePos; } }
this.MouseDown += new System.Windows.Forms.MouseEventHandler(this.Form1_MouseDown); this.MouseMove += new System.Windows.Forms.MouseEventHandler(this.Form1_MouseMove);