View Issue Details
ID | Project | Category | View Status | Date Submitted | Last Update |
---|---|---|---|---|---|
0002127 | JEDI VCL | 00 JVCL Components | public | 2004-09-06 05:08 | 2004-09-11 01:35 |
Reporter | miracle2k | Assigned To | AHUser | ||
Priority | normal | Severity | minor | Reproducibility | always |
Status | resolved | Resolution | fixed | ||
Product Version | 3.00 BETA | ||||
Target Version | Fixed in Version | ||||
Summary | 0002127: JvgStaticText - ftaBroadwise painting | ||||
Description | If the Alignment property of an TJvgStaticText component is set to ftaBroadwise, there is an issue when drawing the last line. If this line is only short (say two words for example), the first word is at the beginning of the line, the second one at the end. In such a case (were the width needed is considerably smaller than the amount available, the text should be painted left justified. | ||||
Additional Information | I made the following changes to achieve this, but it was only a quick hack and is probably not the prettiest solution. In DrawTextBroadWise, replace ************* begin if LexemCount > 1 then Dec(LexemCount); DrawLine(Width - (LineWidth - Size.cx)); end else DrawLine(Width - LineWidth) end; ************* with ************* begin if LexemCount > 1 then Dec(LexemCount); DrawLine(Width - (LineWidth - Size.cx)); end else begin if ((Width - LineWidth) / Width) < 0.3 then DrawLine(Width - LineWidth) else DrawLineLeftAligned; end; ************* Note that 0.3 is a factor that specifies the percentage of space that the available width must exceed the width needed for the text. That could be made configurable via a property. DrawLineLeftAligned() looks like this: procedure DrawLineLeftAligned; var i, DrawPos1, DrawPos2: Integer; Lexem: string; begin DrawPos1 := DrawPos; DrawPos2 := DrawPos; LineWidth := 0; for i := 1 to LexemCount do begin Lexem := Lexem + GetNextLexem(DrawPos1, DrawPos2, i = 1); DrawPos1 := DrawPos2; end; TextOut(Canvas.Handle, 0, LineNo * TextHeight, PChar(Lexem), Length(Lexem)); end; | ||||
Tags | No tags attached. | ||||