Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- private void pictureBox1_MouseMove(object sender, MouseEventArgs e)
- {
- int pheight = pictureBox1.Size.Height;
- int pwidth = pictureBox1.Size.Width;
- int gcount = 0;
- int vcount = 0;
- for (int i = pwidth; i > 0; i -= 20)
- {
- vcount++;
- }
- for (int i = pheight; i > 0; i -= 20)
- {
- gcount++;
- }
- vcount = vcount % 2 == 0 ? vcount / 2 : vcount / 2 - 1;
- gcount = gcount % 2 == 0 ? gcount / 2 : gcount / 2 - 1;
- PointF xoy = new PointF(pwidth - (20 * vcount), pheight - (20 * gcount)); // начала координат - точка (0;0) int xn = e.X - pwidth - (20 * vcount); //The location of the cursor in the axe Ox;
- int xn = e.X - pwidth + (20 * vcount);
- int yn = -e.Y +pheight - (20 * gcount); //The location of the cursor in the axe Oy;
- double locX = (double)xn / 20;
- double locY = (double)yn / 20;
- label3.AutoSize = true; //Autosizing of our label;
- label3.Text = String.Format("X: {0: 00.00}, Y: {1: 00.00}", locX, locY);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement