Advertisement
Guest User

govno

a guest
Nov 30th, 2015
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.20 KB | None | 0 0
  1. private void pictureBox1_MouseMove(object sender, MouseEventArgs e)
  2. {
  3. int pheight = pictureBox1.Size.Height;
  4. int pwidth = pictureBox1.Size.Width;
  5. int gcount = 0;
  6. int vcount = 0;
  7.  
  8. for (int i = pwidth; i > 0; i -= 20)
  9. {
  10. vcount++;
  11. }
  12. for (int i = pheight; i > 0; i -= 20)
  13. {
  14. gcount++;
  15. }
  16. vcount = vcount % 2 == 0 ? vcount / 2 : vcount / 2 - 1;
  17. gcount = gcount % 2 == 0 ? gcount / 2 : gcount / 2 - 1;
  18. 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;
  19. int xn = e.X - pwidth + (20 * vcount);
  20. int yn = -e.Y +pheight - (20 * gcount); //The location of the cursor in the axe Oy;
  21. double locX = (double)xn / 20;
  22. double locY = (double)yn / 20;
  23. label3.AutoSize = true; //Autosizing of our label;
  24. label3.Text = String.Format("X: {0: 00.00}, Y: {1: 00.00}", locX, locY);
  25. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement