this.PointToScreen(this.Label1.Location)
You need to create an account or log in to post comments to this site.
12374 users tagging and storing useful source code snippets
Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world
this.PointToScreen(this.Label1.Location)
You need to create an account or log in to post comments to this site.
This one works for me:
private Point findCoords2(Control c) { // Recurse through all parent controls... Point coord = new Point(); // Own location inside control coord = c.Location; // Add parents control coord (There is always at least one parent! ... if this isn't the Form...) while (c.Parent != null) { c = c.Parent; coord.X += c.Location.X; coord.Y += c.Location.Y; } // Add pixel borders coord.X += c.Margin.Left + 1; // 23 for "classic" Windows look // 30 for Windows XP standard look //coord.Y += 30; // Or try this... coord.Y += c.Bounds.Height - c.ClientSize.Height - (c.Margin.Top + 1); return coord; }