Pixel question - Programmers Heaven

Howdy, Stranger!

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

Categories

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.