0

I have a question. Is it possible to change X and Y point values type from int to Int32? I have panel 50 000 pixels wide and I can only recognize the X dimension up to about 32k.

public void pictureBox2_Click(object sender, EventArgs e)
    {

       Point point = pictureBox2.PointToClient(MousePosition);
       MessageBox.Show(point.ToString());
       MessageBox.Show(point.X.ToString()); 
    }

This is my code, I need change X to Int32. Any solution? Thanks in advance,

  • 2
    `int` and `Int32` are the same. – DaveShaw May 26 '15 at 20:53
  • If it's stopping at 32k, then you probably have a 16 bit int (short) somewhere. 16 bit signed ints only go up to 32,767, which would make sense. Without a MCVE though, we can't really help you. – Kaslai May 26 '15 at 21:23

1 Answers1

5

An int is Int32, it is just an alias for it. The max value for an int is 2,147,483,647, which you are well within.

(An int is a 32 bit number, it does not mean it can only go to 32,000.)

Community
  • 1
  • 1
Cyral
  • 13,999
  • 6
  • 50
  • 90
  • So why when I click on my image I can get value only from first 32k rows and the rest of 50k is 'non-clickable'? – Don Wasyllo May 26 '15 at 21:02
  • 1
    You need to show a [Minimal, Complete, and Verifiable example](http://stackoverflow.com/help/mcve) so we can help. It is not related to the size of an int however. – Cyral May 26 '15 at 21:03
  • I think that the problem is that there is 16 bit mouse click limit on picturebox. Am I right? – Don Wasyllo May 26 '15 at 21:32
  • You are probably right, the max value of an `Int16` (or `short`) is 32767. Edit: You are, see http://stackoverflow.com/q/22951737/1218281 – Cyral May 26 '15 at 21:33
  • It looks like shorts are used in the actual windows API: https://msdn.microsoft.com/en-us/library/windows/desktop/ms645607%28v=vs.85%29.aspx – Cyral May 26 '15 at 21:36