I have the following method in C#:
private string adjustColumnValueLength(String value, int maxLength, PaintEventArgs e)
{
// Set up our string font
Syst
You should only call that method from a Paint
event handler. I guess you have something in your code like:
private void Control_Paint(object sender, PainEventArgs e) { ... }
You should call your method from there (and nowhere else!):
private void Control_Paint(object sender, PainEventArgs e)
{
adjustColumnValueLength("value", 10, e);
}
If you don't have that, create a event handler:
this.Control.Paint += Control_Paint;
Also read: Custom Control Painting and Rendering.