Hi, ich habe da jetzt mit
Delphi-Quelltext
1: 2: 3: 4: 5: 6: 7: 8: 9: 10:
| if(BoldBtn.Down) and (ItalicBtn.Down)then FontPanel.Font.Style := [fsBold,fsItalic] else if(BoldBtn.Down)then FontPanel.Font.Style := [fsBold] else if(ItalicBtn.Down)then FontPanel.Font.Style := [fsItalic] else FontPanel.Font.Style := []; |
die FontStyles bestimmt aber jetzt wollte ich auch noch Underline und StrikeOut verwenden das wird ja dann
ein reisen Code! Kann man das kürzer fassen?
Also z.B.
Delphi-Quelltext
1: 2: 3: 4:
| if BoldBtn.Down then Font.Style .. Add(fsBold) if ItalicBtn.Down then Font.Style .. Add(fsItalic) |
wie läßt sich das machen?
// EDIT
OK ich habs rausgefunden
Delphi-Quelltext
1: 2: 3: 4: 5: 6: 7:
| with FontPanel.Font do begin Style := []; if(BoldBtn.Down) then Style := Style + [fsBold]; if(ItalicBtn.Down) then Style := Style + [fsItalic]; if(UnderLineBtn.Down) then Style := Style + [fsUnderline]; end; |
Moderiert von
Christian S.: Delphi-Tags hinzugefügt.