Re: DBRichEdit font behavior



Op Sat, 22 Apr 2006 17:25:16 GMT schreef "Chris L."
<christopher.leongc@xxxxxxxxxxx>:

Hi,

I hooked a DBRichEdit VCL to a memo field of my table. When I copied rich
text to the DBRichEdit control, it saved the font information also. When I
scroll to another record in the table, the DBRichEdit control kept the font
info of the first character of the last memo value. It is now displaying the
contents of the memo in that font.

I tried this to change the font
procedure TForm1.FontSizeChange(Sender: Tobject);
begin
if FontDialog1.Execute then
begin
DBRichEdit.SelStart := 0;
DBRichEdit.SelectAll;
DBRichEdit.Font := FontDialog1.Font;
DBRichEdit.Invalidate;
end;
end; // nothing happens unless a different font
or size is selected

of use
DBRichEdit.SetFocus;
DBRichEdit.SelectAll;
// toggle between plaintext and richtext
if not DBRichEdit.Plaintext then
DBRichEdit.PlainText := True
else
DBRichEdit.PlainText := False;
DBRichEdit.Invalidate; // also nothing happens unless a
different font or size is selected


If I use the default font of FontDialog1 nothing happens. What I meant is:
if the DBRichEdit is displaying text in Arial size 16, and FontDialog1
default is San Serif 8, nothing happens. DBRichEdit still displays text in
Arial 16. Why is that?
What is the best way to keep the display text in the design time font value
when scrolling through the table?

Thanks.

Chris


Maybe use DefAttributes to set the attributes of the entire control?
Plaintext only has an influence on how the text is saved (as RTF or as
plain text).

Bart

--
Bart Broersma
broersma.juda_ANTISPAM_@xxxxxxxxxx
(ff _ANTISPAM_ wegpoetsen uit dit adres natuurlijk)
.



Relevant Pages

  • DBRichEdit font behavior
    ... I hooked a DBRichEdit VCL to a memo field of my table. ... text to the DBRichEdit control, it saved the font information also. ...
    (comp.lang.pascal.delphi.misc)
  • Re: Changing default font when pasting to form from clipboard
    ... the clipboard, and pasted it into a memo field, and the font was correctly ... try using the Memo field's AfterUpdate event to ... force the font back to Calibri. ...
    (microsoft.public.access.forms)
  • Re: Is a ZOOM feeture available in a form?
    ... When in Form Datasheet view, double-click on the memo field and it ... will display the data in a zoom box. ... font size you have selected. ...
    (microsoft.public.access.forms)
  • Strip formatting with paste in Palm Desktop?
    ... Is there a way to set the software to strip formating (font, bolding, ... etc.) when pasting into a memo? ... A registry edit perhaps? ...
    (comp.sys.palmtops.pilot)