Results 1 to 1 of 1

Thread: Textbox Recreation

Threaded View

  1. #1

    Thread Starter
    New Member Maintex's Avatar
    Join Date
    Aug 2001
    Location
    England (Temporarily working in Germany)
    Posts
    4

    Question

    Firstly, thanks for replying.

    I am using DrawText (Sorry not DrawTextEx) to write the text, formatted easily, i.e. centred, left/right justified is all done for me. It writes directly to the device context. I am not, and do not, want to use a text box in my ActiveX control, otherwise I might as well use that, but I am trying to duplicate it because that is what I chose to do for Uni (methinks a bit optimistic now - seemed simple at the time though ).

    Anyway, I have got to the point where I can write the text how I want it, but I cannot find out anything at all about how the text is displayed and I really need this information to know where to draw the rectangles for selected text and where to draw the cursor. For example:

    DrawText hDC, Text, Len(Text), udRect, DT_WORDBREAK + DT_LEFT

    udRect provides the area in which to draw the text (it is data type RECT)

    So, I can display the text, I know my selected text starts at say..23 characters into the Text, how do I know the X and Y values of this position so that I can draw the selection highlighting or the cursor? How do I find out what text has been drawn on each line? If I could find this out, I could calculate the X and Y values easily, but I don't know this. Do you know how I can find this out?

    Alternatively, I know that the MCI control can be configured to use another non-windowless control (I think) for its output, is there anyway I could perhaps redirect the output of a text box to a control? Or is there a way I can sort-of sub-class a textbox and re-route its graphical output to my ActiveX controls device context?

    I have spent the past three weeks researching a solution and I have found a way to do it by parsing the string myself, formatting and word-wrapping the text and using the Print method to print it to the ActiveX control. However, my parsing functions, despite three versions, each faster than the previous, is still too slow when approaching 20,000 characters. I need to the control to handle 65,535 characters. I was thinking about using C++ in a DLL and duplicating my parsing methods, but I don't know C++ well enough right now and I cannot learn it and create the control before the due date of this project. Anyway, if anyone can help at all, I would be extremely grateful. Thanks.
    Last edited by Maintex; Feb 14th, 2002 at 07:47 PM.
    Maintex

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width