how to keep two different events for right click as well as left click? i want zoomIn for left click and zoomOut for right click i have written my code in the following manner if any mistakes or errors please help me
i mean two different functions or events for each right click as well as left click and here goes my program
private void pictureBox1_MouseClick_1(object sender, MouseEventArgs e)
{
if (e.Button == System.Windows.Forms.MouseButtons.Right )
{
double zoomLevel = 1.1;
System.Drawing.Rectangle screenSize = new System.Drawing.Rectangle();
screenSize.Width = SystemInformation.VirtualScreen.Width ;
screenSize.Height = SystemInformation.VirtualScreen.Height;
//int zoomFactor = 10;
Image img = pictureBox1.Image;
Bitmap bitMapImg = new Bitmap(img);
if (bitMapImg.Width < screenSize.Width && bitMapImg.Height < screenSize.Height)
{
Size newSize = new Size((int)(bitMapImg.Width / zoomLevel), (int)(bitMapImg.Height / zoomLevel));
Bitmap bmp = new Bitmap(bitMapImg, newSize);
pictureBox1.Image = (Image)bmp;
pictureBox1.SizeMode = PictureBoxSizeMode.CenterImage;
}
}
}
private void pictureBox1_Click(object sender, EventArgs e)
{
double zoomLevel = 1.1;
System.Drawing.Rectangle screenSize = new System.Drawing.Rectangle();
screenSize.Width = SystemInformation.VirtualScreen.Width * 10;
screenSize.Height = SystemInformation.VirtualScreen.Height * 10;
//int zoomFactor = 10;
Image img = pictureBox1.Image;
Bitmap bitMapImg = new Bitmap(img);
if (bitMapImg.Width < screenSize.Width && bitMapImg.Height < screenSize.Height)
{
Size newSize = new Size((int)(bitMapImg.Width * zoomLevel), (int)(bitMapImg.Height * zoomLevel));
Bitmap bmp = new Bitmap(bitMapImg, newSize);
pictureBox1.Image = (Image)bmp;
pictureBox1.SizeMode = PictureBoxSizeMode.CenterImage;
}
}