IconPicker
#4

i have loaded image and everything is perfect, but when i try to click with mouse nothing happens.

 

i have written what someone told me:

//defining the title width and height in pixels
int title_Width = 32;
int title_height = 32;

//our image
Bitmap bmp = null;

private void pictureBox1_MouseClick(object sender, MouseEventArgs e)
{
//getting the mouse location on the image
int mouse_Location_x = e.X;
int mouse_Location_y = e.Y;

//seeing in what title I clicked
int title_x = (mouse_Location_x / title_Width) - 1;
int title_y = (mouse_Location_y / title_height) - 1;

//creating a Rectangle for the image
Rectangle rect = new Rectangle(title_Width * title_x, title_height *
title_y, title_Width, title_height);

//getting the image
bmp = new Bitmap(title_Width, title_height);
pictureBox1.DrawToBitmap(bmp, rect);
}

but when i click nothing happens, so i dont know what are wrong because this function clearly draws a rectangle.

 

P.S. i have loaded image in a bitmap.

Bitmap myImage = new Bitmap("Images/ItemBtn" + comboBox1.SelectedIndex + ".jpg");
pictureBox1.ClientSize = new Size(512, 512);
pictureBox1.Image = (Image)myImage;



Messages In This Thread
[No subject] - by soryjero - 07-21-2013, 12:36 PM
[No subject] - by someone - 07-21-2013, 05:01 PM
[No subject] - by soryjero - 07-21-2013, 10:37 PM
[No subject] - by soryjero - 07-24-2013, 10:46 AM
[No subject] - by someone - 07-24-2013, 05:44 PM
[No subject] - by soryjero - 07-24-2013, 06:49 PM
[No subject] - by someone - 07-24-2013, 07:08 PM
[No subject] - by Wizatek - 07-24-2013, 08:21 PM
[No subject] - by soryjero - 07-24-2013, 10:12 PM
[No subject] - by Wizatek - 07-25-2013, 06:30 AM
[No subject] - by soryjero - 07-25-2013, 09:29 AM
[No subject] - by Johnny5 - 07-25-2013, 10:24 AM

Forum Jump:


Users browsing this thread: 1 Guest(s)