Version OScar
This commit is contained in:
117
Soluciones/ADSUtileriasWF/ADSUtileriasNetFrame/Views/FormBase.cs
Normal file
117
Soluciones/ADSUtileriasWF/ADSUtileriasNetFrame/Views/FormBase.cs
Normal file
@@ -0,0 +1,117 @@
|
||||
using FontAwesome.Sharp;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace ADSUtileriasNetFrame.Views
|
||||
{
|
||||
public class FormBase : Form
|
||||
{
|
||||
public void GuardaLog(string mensaje)
|
||||
{
|
||||
ADSNetLibrary.Helpers.ModExtensiones.GuardaLog(mensaje);
|
||||
}
|
||||
public static System.Windows.Forms.DialogResult Alert(string mensage, string Titulo, System.Windows.Forms.MessageBoxButtons botones = System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon Icon = System.Windows.Forms.MessageBoxIcon.None)
|
||||
{
|
||||
System.Windows.Forms.DialogResult result = System.Windows.Forms.DialogResult.None;
|
||||
result = System.Windows.Forms.MessageBox.Show(mensage, Titulo, botones, Icon);
|
||||
//switch (button)
|
||||
//{
|
||||
// case MessageBoxButtons.YesNo:
|
||||
// using (frmYesNo yesNo = new frmYesNo())
|
||||
// {
|
||||
// yesNo.Text = caption;
|
||||
// yesNo.Message = message;
|
||||
// result = yesNo.ShowDialog();
|
||||
// }
|
||||
// break;
|
||||
// case MessageBoxButtons.OK:
|
||||
// using (frmOK ok = new frmOK())
|
||||
// {
|
||||
// ok.Text = caption;
|
||||
// ok.Message = message;
|
||||
// result = ok.ShowDialog();
|
||||
// }
|
||||
// break;
|
||||
//}
|
||||
return result;
|
||||
}
|
||||
|
||||
//UtileriasServiceWCF.ResponseLogin UserV2
|
||||
//public WCF_PV.Usuario UsuarioActual { get { return ModVarsPV.UsuarioActual; } set { ModVarsPV.UsuarioActual = value; } }
|
||||
#region "F U N C I O N E S D E W I N D O W S"
|
||||
#region "mover /arrastrar formulario"
|
||||
|
||||
private const int WM_NCLBUTTONDOWN = 0xA1;
|
||||
private const int HT_CAPTION = 0x2;
|
||||
[DllImportAttribute("user32.dll")]
|
||||
private static extern int SendMessage(IntPtr hWnd,
|
||||
int Msg, int wParam, int lParam);
|
||||
[DllImportAttribute("user32.dll")]
|
||||
private static extern bool ReleaseCapture();
|
||||
|
||||
#endregion
|
||||
#region colorbar
|
||||
//[DllImport("User32.dll", CharSet = CharSet.Auto)]
|
||||
//public static extern int ReleaseDC(IntPtr hWnd, IntPtr hDC);
|
||||
|
||||
//[DllImport("User32.dll")]
|
||||
//private static extern IntPtr GetWindowDC(IntPtr hWnd);
|
||||
|
||||
//protected override void WndProc(ref Message m)
|
||||
//{
|
||||
// base.WndProc(ref m);
|
||||
// const int WM_NCPAINT = 0x85;
|
||||
// if (m.Msg == WM_NCPAINT)
|
||||
// {
|
||||
// IntPtr hdc = GetWindowDC(m.HWnd);
|
||||
// if ((int)hdc != 0)
|
||||
// {
|
||||
// Graphics g = Graphics.FromHdc(hdc);
|
||||
// g.FillRectangle(Brushes.Green, new Rectangle(0, 0, 4800, 23));
|
||||
// g.Flush();
|
||||
// ReleaseDC(m.HWnd, hdc);
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
#endregion
|
||||
public void ArrastrarForm_MouseDown(object sender, MouseEventArgs e)
|
||||
{
|
||||
if (e.Button == MouseButtons.Left)
|
||||
{
|
||||
ReleaseCapture();
|
||||
SendMessage(Handle, WM_NCLBUTTONDOWN, HT_CAPTION, 0);
|
||||
}
|
||||
|
||||
}
|
||||
public void BtnClose_Click(object sender, EventArgs e)
|
||||
{
|
||||
Environment.Exit(0);
|
||||
}
|
||||
|
||||
|
||||
public void BtnMaximizeRestore_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (WindowState == FormWindowState.Maximized)
|
||||
{
|
||||
WindowState = FormWindowState.Normal;
|
||||
((IconButton)sender).IconChar = FontAwesome.Sharp.IconChar.WindowMaximize;
|
||||
}
|
||||
else
|
||||
{
|
||||
WindowState = FormWindowState.Maximized;
|
||||
((IconButton)sender).IconChar = FontAwesome.Sharp.IconChar.WindowRestore;
|
||||
|
||||
}
|
||||
}
|
||||
public void BtnMinimize_Click(object sender, EventArgs e)
|
||||
{
|
||||
WindowState = FormWindowState.Minimized;
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user