I have a custom user control with a textbox on it and I'd like to expose the baseline (of the text in the textbox) snapline outside of the custom control. I know that you create a designer (inherited from ControlDesigner) and override SnapLines to get access to the snaplines, but I'm wondering how to get the text baseline of a control that I have exposed by my custom user control.
.net – Baseline snaplines in custom Winforms controls
design-timenetuser-controlswindows-forms-designerwinforms
Related Topic
- C# – How to make a textbox that only accepts numbers
- C# – “The Controls collection cannot be modified because the control contains code blocks”
- C# – Customizing the behavior of ControlDesigners for Controls derived from native .NET controls
- C# – Metadata file ‘.dll’ could not be found
- C# – User Control – Custom Properties
- Scala: list.flatten: no implicit argument matching parameter type (Any) = > Iterable[Any] was found
Best Answer
As an update to the Miral's answer.. here are a few of the "missing steps", for someone new that's looking how to do this. :) The C# code above is almost 'drop-in' ready, with the exception of changing a few of the values to reference the UserControl that will be modified.
Possible References Needed:
System.Design (@robyaw)
Usings needed:
On your UserControl you need the following Attribute:
Then you need a "designer" class that will have the SnapLines override: