Hi,
is possible in the OnCellFormatting evnto or in some other event to set che font type and font size of the specific cell ?
Thanks.
FontSize of the Cell
Started by Andrea Lai, Jun 17 2011 10:43 AM
5 replies to this topic
#1
Posted 17 June 2011 - 10:43 AM
#2
Posted 17 June 2011 - 03:05 PM
Hi,
Currently you may only use HtmlColumn for different Text sizes. But, you may use custom drawing if you need to draw text in different sizes (more at: http://dn.bergsoft.n...in-nextgrid.htm)
If you don't know how to use custom drawing, maybe I can write some code for you.
Best regards
Currently you may only use HtmlColumn for different Text sizes. But, you may use custom drawing if you need to draw text in different sizes (more at: http://dn.bergsoft.n...in-nextgrid.htm)
If you don't know how to use custom drawing, maybe I can write some code for you.
Best regards
boki@bergsoft.net | LinkedIn Profile
--
BergSoft Home Page: www.bergsoft.net
Users Section: users.bergsoft.net
Articles and Tutorials: help.bergsoft.net (Developers Network)
--
BergSoft Facebook page
--
Send us applications made with our components and we will submit them on: www.bergsoft.net/apps.htm. Link to this page will be also set on home page too.
--
BergSoft Home Page: www.bergsoft.net
Users Section: users.bergsoft.net
Articles and Tutorials: help.bergsoft.net (Developers Network)
--
BergSoft Facebook page
--
Send us applications made with our components and we will submit them on: www.bergsoft.net/apps.htm. Link to this page will be also set on home page too.
#3
Posted 17 June 2011 - 05:56 PM
Hi,
If you write some lines of code as you would be very grateful.
Tanks.
If you write some lines of code as you would be very grateful.
Tanks.
#4
Posted 18 June 2011 - 08:47 PM
Hello Andrea,
Please set DrawingOptions for this Column to doCustomOnly.
Then in OnCustomDrawCell event of NextGrid add:
I hope that this helps.
Best regards
Please set DrawingOptions for this Column to doCustomOnly.
Then in OnCustomDrawCell event of NextGrid add:
procedure TForm1.NextGrid1CustomDrawCell(Sender: TObject; ACol,
ARow: Integer; CellRect: TRect; CellState: TCellState);
begin
with NextGrid1.Columns[ACol].Display do
begin
if (ARow = 1) then
begin
Canvas.Font.Size := 14;
end;
AsString := NextGrid1.Cell[ACol, ARow].AsString;
PaintBackground(NextGrid1.CellByName[ACol, ARow].Color, True);
Paint;
end;
end;I hope that this helps.
Best regards
boki@bergsoft.net | LinkedIn Profile
--
BergSoft Home Page: www.bergsoft.net
Users Section: users.bergsoft.net
Articles and Tutorials: help.bergsoft.net (Developers Network)
--
BergSoft Facebook page
--
Send us applications made with our components and we will submit them on: www.bergsoft.net/apps.htm. Link to this page will be also set on home page too.
--
BergSoft Home Page: www.bergsoft.net
Users Section: users.bergsoft.net
Articles and Tutorials: help.bergsoft.net (Developers Network)
--
BergSoft Facebook page
--
Send us applications made with our components and we will submit them on: www.bergsoft.net/apps.htm. Link to this page will be also set on home page too.
#5
Posted 20 June 2011 - 06:45 PM
Hi,
is possible to set also the color of background if the cell is selected ?
Thanks
is possible to set also the color of background if the cell is selected ?
Thanks
#6
Posted 20 June 2011 - 07:44 PM
Hi,
sorry but I have a problem.
I have write this function :
procedure TForm1.MyNextGrid1CustomDrawCell(Sender: TObject; ACol,
ARow: Integer; CellRect: TRect; CellState: TCellState);
begin
with MyNextGrid1.Columns[ACol].Display do
begin
if (ACol = 1) then
begin
if MyNextGrid1.Cell[2, ARow].AsInteger = 2 then
begin
Canvas.Font.Size := 11;
Canvas.Font.Style := [fsBold];
Canvas.Font.Color := clRed;
end
else Canvas.Font.Size := 18;
AsFloat := MyNextGrid1.Cell[ACol, ARow].AsFloat;
if MyNextGrid1.SelectedRow = ARow then MyNextGrid1.CellByName[ACol, ARow].Color := clYellow
else MyNextGrid1.CellByName[ACol, ARow].Color := clWhite;
PaintBackground(MyNextGrid1.CellByName[ACol, ARow].Color, True);
Paint;
end;
end;
end;
The problem is that the column continues to flash annoyingly.
Thanks.
sorry but I have a problem.
I have write this function :
procedure TForm1.MyNextGrid1CustomDrawCell(Sender: TObject; ACol,
ARow: Integer; CellRect: TRect; CellState: TCellState);
begin
with MyNextGrid1.Columns[ACol].Display do
begin
if (ACol = 1) then
begin
if MyNextGrid1.Cell[2, ARow].AsInteger = 2 then
begin
Canvas.Font.Size := 11;
Canvas.Font.Style := [fsBold];
Canvas.Font.Color := clRed;
end
else Canvas.Font.Size := 18;
AsFloat := MyNextGrid1.Cell[ACol, ARow].AsFloat;
if MyNextGrid1.SelectedRow = ARow then MyNextGrid1.CellByName[ACol, ARow].Color := clYellow
else MyNextGrid1.CellByName[ACol, ARow].Color := clWhite;
PaintBackground(MyNextGrid1.CellByName[ACol, ARow].Color, True);
Paint;
end;
end;
end;
The problem is that the column continues to flash annoyingly.
Thanks.
1 user(s) are reading this topic
0 members, 1 guests, 0 anonymous users











