I have a windows form that I can drag around programmatically created control labels. I am using the location property to determine each label position.
Each label is created as a preview with placeholder '#' where a number is to be. I want to know what the form coordinates are of a specific character in that label.
As a code example:
Label myLabel = new Label
{
Text = "Average: ##.#Unit",
Name = "myLabelName"
};
Controls.Add(myLabel);
...
// After label is dragged around
Point myLabelLocation = myLabel.Location;
This gives me the label's coordinates. Let's say I want similar coordinates, but I want them for the first #.
Another way to look at this, I "split" the label right before '#'. How do I get this location?