using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Runtime.InteropServices; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; namespace ScaBox30 { public partial class Ayuda : Form { public Ayuda() { InitializeComponent(); InitializeItems(); InitializeButtons(); } // WINDOW CLOSE BUTTON private void btnClose_Click(object sender, EventArgs e) { this.Close(); } // WINDOW MAXIMIZE BUTTON private void btnMax_Click(object sender, EventArgs e) { if (WindowState == FormWindowState.Maximized) { this.WindowState = FormWindowState.Normal; } else { WindowState = FormWindowState.Maximized; } } private void button1_Click(object sender, EventArgs e) { this.Close(); } private void InitializeItems() { this.FormBorderStyle = FormBorderStyle.None; this.Padding = new Padding(Globals.borderSize);//Set border size this.btnClose.DialogResult = DialogResult.Cancel; this.labelCaption.Text = this.Text; this.panelTitleBar.BackColor = Globals.primaryColor; this.panelTitleBar.Padding = new Padding(0, 0, 0, Globals.borderSize); this.BackColor = Globals.primaryColor; } private void InitializeButtons() { int xCenter = (this.panelButtons.Width - button1.Width) / 2; int yCenter = (this.panelButtons.Height - button1.Height) / 2; //Cancel Button button1.Visible = true; button1.Text = "Salir"; button1.DialogResult = DialogResult.Cancel;//Set DialogResult button1.BackColor = Globals.colors.retry_cancell; } #region -> Drag Form [DllImport("user32.DLL", EntryPoint = "SendMessage")] private extern static void SendMessage(System.IntPtr hWnd, int wMsg, int wParam, int lParam); [DllImport("user32.DLL", EntryPoint = "ReleaseCapture")] private extern static void ReleaseCapture(); private void panelTitleBar_MouseDown(object sender, MouseEventArgs e) { ReleaseCapture(); SendMessage(this.Handle, 0x112, 0xf012, 0); } #endregion } }