Hi! I want to know how i can get a button postion by (x,y) is ther any method for this?!

Recommended Answers

All 2 Replies

Well, peymankop your questioning is improved. :)
Was the answer I gave you in the other thread not sufficient?

commented: Such a good reply +6

Haha ddanbe you can't get him to open a new thread and then tell him to refer to the old one... saying that it's made me laugh!.

peymankop, to get the location (opsition on the form) of the button, simply create 2 int variable called X and Y and store the X and Y values of the button's Location property in them like so:

private int x;
private int y;

private void GetButtonLocation()
{
    x = button1.Location.X;
    y = button1.location.Y;
}

You will need to call GetButtonLocation() from you constructor method (the first method that is executed when the form loads).

commented: Let's say, Ilike your comments :) +14
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.