Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

Pixel question

jamesb800jamesb800 Posts: 105Member
Hello......
I have two memos on a form. Memo1 has a string like this.....
[code]
Thi[val1]s is a str[val2]ing".
[/code]
I need it to end up in memo2 like this....

[code]
val1 val2 // lineout1
This is a string // lineout2
[/code]
I can accomplish this now if I use a fixed width font like courier new. If I use a font such as ariel, lineout1 and lineout2 do not align properly. I can figure the pixel width of the string using a label and this..... w:=Label1.Canvas.Textwidth(Memo1.Lines[0]); ... my problem is figuring out how to insert the lineout 1 chars in memo2 at the pixel from memo1. Does this make sense?

Can anyone help?

Thanks in advance,

James

Comments

  • zibadianzibadian Posts: 6,349Member
    : Hello......
    : I have two memos on a form. Memo1 has a string like this.....
    : [code]
    : Thi[val1]s is a str[val2]ing".
    : [/code]
    : I need it to end up in memo2 like this....
    :
    : [code]
    : val1 val2 // lineout1
    : This is a string // lineout2
    : [/code]
    : I can accomplish this now if I use a fixed width font like courier new. If I use a font such as ariel, lineout1 and lineout2 do not align properly. I can figure the pixel width of the string using a label and this..... w:=Label1.Canvas.Textwidth(Memo1.Lines[0]); ... my problem is figuring out how to insert the lineout 1 chars in memo2 at the pixel from memo1. Does this make sense?
    :
    : Can anyone help?
    :
    : Thanks in advance,
    :
    : James
    :
    Using memos in this way is very hard, since they are drawn by windows itself and don't have a canvas. I would suggest that you use a TPaintBox for it. Then you have much more control over the precise position of the text.
Sign In or Register to comment.