R
Ravi Kumar12233
Guest
n my windows form i am using this below code to use the customclose, minimize and maximize button in my frmdashboard from ,
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Runtime.ConstrainedExecution;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using Mechanical_Straightening_Dies.Properties;
namespace Mechanical_Straightening_Dies
{
public partial class FrmDashBoard : Form
{
public FrmDashBoard()
{
InitializeComponent();
}
[DllImport("user32.DLL", EntryPoint = "ReleaseCapture")]
private extern static void ReleaseCapture();
[DllImport("user32.DLL", EntryPoint = "SendMessage")]
private extern static void SendMessage(System.IntPtr one, int two, int three, int four);
private void Frmdashboardexit_click(object sender, EventArgs e)
{
System.Windows.Forms.Application.Exit();
}
private void FrmDashBoard_FormClosing(object sender, FormClosingEventArgs e)
{
String msg = "Do you really want to exit?";
string caption = "Exit Application";
MessageBoxButtons buttons = MessageBoxButtons.YesNo;
MessageBoxIcon ico = MessageBoxIcon.Question;
DialogResult result;
result = MessageBox.Show(this, msg, caption, buttons, ico);
if (result == DialogResult.Yes)
{
MessageBox.Show("Thank you", "MSDies", MessageBoxButtons.OK, MessageBoxIcon.Information);
e.Cancel = false;
}
else
{
e.Cancel = true;
}
}
private void panel1_MouseDown(object sender, MouseEventArgs e)
{
ReleaseCapture();
SendMessage(Handle, 0x112, 0xf012, 0);
}
private void Frmdashboardmax_Click(object sender, EventArgs e)
{
if(WindowState == FormWindowState.Normal)
{
WindowState = FormWindowState.Maximized;
Frmdashboardmax.Image = Resources.icons8_maximize_window_96;
}
else
{
WindowState = FormWindowState.Normal;
Frmdashboardmax.Image = Resources.icons8_maximize_window_96;
}
}
private void FrmdashboardMin_Click(object sender, EventArgs e)
{
WindowState = FormWindowState.Minimized;
}
}
}
Continue reading...
but after maximising the buttons are coming in centre of top panel instead of remaining in corner , how to correct this ?
And also is there any way that the reports i show in this form can be mailed converted to pdf(only report) , if it is kindly provide the link ..i'll learn.
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Runtime.ConstrainedExecution;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using Mechanical_Straightening_Dies.Properties;
namespace Mechanical_Straightening_Dies
{
public partial class FrmDashBoard : Form
{
public FrmDashBoard()
{
InitializeComponent();
}
[DllImport("user32.DLL", EntryPoint = "ReleaseCapture")]
private extern static void ReleaseCapture();
[DllImport("user32.DLL", EntryPoint = "SendMessage")]
private extern static void SendMessage(System.IntPtr one, int two, int three, int four);
private void Frmdashboardexit_click(object sender, EventArgs e)
{
System.Windows.Forms.Application.Exit();
}
private void FrmDashBoard_FormClosing(object sender, FormClosingEventArgs e)
{
String msg = "Do you really want to exit?";
string caption = "Exit Application";
MessageBoxButtons buttons = MessageBoxButtons.YesNo;
MessageBoxIcon ico = MessageBoxIcon.Question;
DialogResult result;
result = MessageBox.Show(this, msg, caption, buttons, ico);
if (result == DialogResult.Yes)
{
MessageBox.Show("Thank you", "MSDies", MessageBoxButtons.OK, MessageBoxIcon.Information);
e.Cancel = false;
}
else
{
e.Cancel = true;
}
}
private void panel1_MouseDown(object sender, MouseEventArgs e)
{
ReleaseCapture();
SendMessage(Handle, 0x112, 0xf012, 0);
}
private void Frmdashboardmax_Click(object sender, EventArgs e)
{
if(WindowState == FormWindowState.Normal)
{
WindowState = FormWindowState.Maximized;
Frmdashboardmax.Image = Resources.icons8_maximize_window_96;
}
else
{
WindowState = FormWindowState.Normal;
Frmdashboardmax.Image = Resources.icons8_maximize_window_96;
}
}
private void FrmdashboardMin_Click(object sender, EventArgs e)
{
WindowState = FormWindowState.Minimized;
}
}
}
Continue reading...