Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 1057181
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T17:49:36+00:00 2026-05-16T17:49:36+00:00

Important: we really need the stated functionality, so please don’t start suggesting alternatives. We’re

  • 0

Important: we really need the stated functionality, so please don’t start suggesting alternatives.

We’re trying to display and input text on a custom WinForms control that includes text and non-text regions – in other words, a modern canvas.

We need to be able to display the text and caret on the custom control at various zoom levels and using other custom effects. However, we do not want (or have the wherewithal) to write keyboard and mouse input method code, line services code, etc – the solution must support all languages that the standard TextBox supports.

Therefore, the approach we’re considering is to use a hidden textbox, and to route keyboard and mouse events to it after suitable translation, and to use its public accessors to determine how the characters are laid out. This would theoretically enable us to highlight selected text, draw a caret, perform the right actions when the user presses a key (including selecting and deleting text with the keyboard.)

In other words, the text region is a proxy of the hidden textbox.
The result is that we build on the functionality of the textbox while overcoming its limitations such as lack of zoom, etc.

We expect that the display part is doable but the keyboard and mouse input are probably very tricky.

Questions:
Has this been tried before with any success? Any working code would be excellent.

Update: A quick and dirty experiment seems to indicate that the TextBox does not respect the mouse coordinates sent in mouse messages but seems to read the current mouse position directly. Therefore, a new question:

Is it possible to cast all TextBox mouse events in terms of direct TextBox actions, in a way that would work across all languages? Our guess that the hit testing method GetCharIndexFromPosition together with the text selection method Select, should suffice. Does this seem reasonable?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-16T17:49:37+00:00Added an answer on May 16, 2026 at 5:49 pm

    I would recommend that you use a hidden TextBox as you suggest and then send it WM_PRINT messages in order to have its content drawn onto a bitmap. Then you can draw that bitmap onto the actual area of interest and in doing apply changes such as zooming or rotation and so forth. Any keyboard messages can be simply forwarded to the hidden TextBox and so the caret and contents will be updated as expected by the user. The tricky part is just the mouse handling. You need to take the client coordinate and then use the reverse transformation (zooming, rotation etc) to get from client to the actual coordinates of the hidden TextBox.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I need a solution for the really common but important issue that i am
Well I don't think that it's really important but since the program has to
Is it really important to know algorithms to build mobile applications? I have strong
I know this question is not really important.. however I've been wondering: Which of
Question context: let say that there is some really important row in config/locales/en.yml that
I'm working on an ASP.NET website (MVC3 but not really important for my question)
An important property of really SOLID code is the fact that constructor calls do
Important : Please see this very much related question: Return multiple values in C++
I apologize for a lengthy question, but I really need your help. As a
I am trying to parse a noisy input, ideally I would be able to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.