I just saw an interesting request in our support department. When our users open such support cases, our engineers immediately begin creating sample applications tailored to the user's requirements. Providing fast, customer-oriented, and satisfying technical support is one of our most important business targets. Feel free to test our support department when you are having any questions. We spend a lot of time and effort to provide this kind of support quality.

Anyway, back to this specific requirement. A user wanted to know whether the current input position is in the visible area of the TextControl instance on the form. Generally, this task is quite easy. You simply need to compare the current input position and the scroll position with the height of the control itself. The same, also, for the horizontal position.

What you need to care about is the conversion between the used unit twips and the 1/100 inch for the width and height of controls in .NET. The following function returns true, if the current input position is currently visible.

private bool IsInputPositionVisible()
{
    // get resolution to calculate convert twips 1/100 inch
    Graphics g = textControl1.CreateGraphics();
    int DPI = (int)(1440 / g.DpiX);

    // get input and scroll positions and convert to 1/100 inch
    int inputPosX  = (textControl1.InputPosition.Location.X / DPI);
    int inputPosY  = (textControl1.InputPosition.Location.Y / DPI);
    int scrollPosX = (textControl1.ScrollLocation.X / DPI);
    int scrollPosY = (textControl1.ScrollLocation.Y / DPI);

    // check whether input position is inside visible area
    return ((inputPosX > scrollPosX && inputPosX < scrollPosX + textControl1.Width) &&
            (inputPosY > scrollPosY && inputPosY < scrollPosY + textControl1.Height))
            ? true : false;
}

Do you have any challenges programming with TX Text Control? Feel free to contact our support department.