change font in grid

How can I change font style for my rxdbgrid using that font component?
EnejAsked:
Who is Participating?
 
alanwhincupConnect With a Mentor Commented:
Here you are:

procedure TForm1.FormCreate(Sender: TObject);
begin
  //Change Font ComboBox selection to the Grid's current font.
  FontComboBox1.FontName := RxGrid1.Font.Name;
end;

procedure TForm1.FontComboBox1Change(Sender: TObject);
begin
  //Change Grids current font to whatever is chosen on FontComboBox.
  RxGrid1.Font.Name := FontComboBox1.FontName;
end;

Cheers,

Alan
0
 
DrDelphiCommented:
 Fontdialog1.Execute;
  With FontDialog1 do
  begin
    Rxgrid1.Font.Name:=Font.Name;
    Rxgrid1.Font.Size:=font.size;
    Rxgrid1.Font.Color:=font.Color;
    RxGrid1.font.Style:=font.Style;
    (*Etc,etc,etc*)
  end;


Good luck!!
0
 
EnejAuthor Commented:
What I had in mind is that FontComboBox that comes with RX tools....I tried above sugg. and it only changes once!?
I want the font to change through fontcombo and not the popup classic dialog to come up.
When I select a font in that combo I want the font to change automatic without popup dialog...
0
Get expert help—faster!

Need expert help—fast? Use the Help Bell for personalized assistance getting answers to your important questions.

 
EnejAuthor Commented:
I use that fontcombo.How do you change wit that thing?I do not want font dlg. to appear...
0
 
DrDelphiCommented:
Well, I can't help you with the Rx component, but if all you want is to change the current font, you could just as easily do this:

procedure TForm1.FormCreate(Sender: TObject);
begin
  combobox1.items:=Screen.fonts;
end;

procedure TForm1.ComboBox1Change(Sender: TObject);
begin
  dbgrid1.font.name:=Combobox1.Items[Combobox1.itemindex];

end;





Good luck!!
0
 
DrDelphiCommented:
Alan,
  Did that actually work for you? I tried with version 2.75 of the RXlib and it didn't.

0
 
EnejAuthor Commented:
This is OK !T
0
 
alanwhincupCommented:
DrDelphi,
  I have the same version and it appears to work...
0
 
DrDelphiCommented:
Hmmmm.... weird! I'm going to have to look into this.
0
All Courses

From novice to tech pro — start learning today.