Components for Delphi and C++ Builder.

Go to Russian forum
Go to EhLib.com
It is currently 25 Jan 2021, 09:25

All times are UTC




Post new topic Reply to topic  [ 10 posts ] 
Author Message
 Post subject: Repeat Image in Column
PostPosted: 15 Sep 2018, 14:05 
Offline

Joined: 31 Aug 2018, 19:06
Posts: 40
Hi,
I want repeat a image(similar images list or from other source) in column with specific number , please guide me.


Top
 Profile  
 
PostPosted: 15 Sep 2018, 16:37 
Offline

Joined: 31 Aug 2018, 19:06
Posts: 40
Another question is about column title
how can i change align between text and image in title(for example show image right/left text or also set space between title caption and image)


Top
 Profile  
 
PostPosted: 20 Sep 2018, 06:51 
Offline

Joined: 08 May 2014, 18:06
Posts: 428
Hello

Assign Column.ImageList = MyImageList
and write
Column.OnGetCellParams event with setting Params.ImageIndex parameter


Code:
procedure TForm1.DBGridEh1Columns0GetCellParams(Sender: TObject;
  EditMode: Boolean; Params: TColCellParamsEh);
begin
  if (MemTableEh1.FieldByName('Continent').AsString = 'North America') then
    Params.ImageIndex := 1;
end;



You can also assign Column.ShowImageAndText = True to show image and field value in the cell.


Attachments:
sshot-4.png
sshot-4.png [ 13.33 KiB | Viewed 1296 times ]

_________________
Best regards
EhLib Support Team
Top
 Profile  
 
PostPosted: 20 Sep 2018, 07:18 
Offline

Joined: 08 May 2014, 18:06
Posts: 428
Hello

Quote:
Another question is about column title
how can i change align between text and image in title(for example show image right/left text or also set space between title caption and image)


Unfortunately you can not control these parameters.
The only way is to use OnDrawTitleCell event.

_________________
Best regards
EhLib Support Team


Top
 Profile  
 
PostPosted: 27 Sep 2018, 08:18 
Offline

Joined: 31 Aug 2018, 19:06
Posts: 40
No, I mean about repeat:
For Example 'Score' Column


Attachments:
Grid.png
Grid.png [ 4.02 KiB | Viewed 1279 times ]
Top
 Profile  
 
PostPosted: 12 Nov 2018, 06:12 
Offline

Joined: 31 Aug 2018, 19:06
Posts: 40
Hi,
Is there a way to do this?


Top
 Profile  
 
PostPosted: 12 Nov 2018, 08:18 
Offline

Joined: 08 May 2014, 18:06
Posts: 428
Hello

You can draw images from imagelist in the TColumnEh.OnAdvDrawDataCell event handler

Code:
procedure TForm1.DBGridEh1Columns1AdvDrawDataCell(Sender: TCustomDBGridEh; Cell,
  AreaCell: TGridCoord; Column: TColumnEh; const ARect: TRect;
  var Params: TColCellParamsEh; var Processed: Boolean);
var
  steps: Integer;
  i: Integer;
begin
  Sender.DefaultDrawColumnDataCell(Cell, AreaCell, Column, ARect, Params);
  Processed := True;
  steps := MemTableEh1.FieldByName('Population').AsInteger div 1000000;
  if steps > 10 then steps := 10;
  for I := 0 to steps do
  begin
    ilPaymentType.Draw(Sender.Canvas, 2 + i * 18 + ARect.Left, ARect.Top + 2, 1);
  end;
end;


Attachments:
sshot-44.png
sshot-44.png [ 32.37 KiB | Viewed 1089 times ]

_________________
Best regards
EhLib Support Team
Top
 Profile  
 
PostPosted: 01 Dec 2020, 06:11 
Offline

Joined: 31 Aug 2018, 19:06
Posts: 40
jsm wrote:
Another question is about column title
how can i change align between text and image in title(for example show image right/left text or also set space between title caption and image)

Seems interesting, is it possible to add it?


Top
 Profile  
 
PostPosted: 02 Dec 2020, 19:38 
Offline

Joined: 08 May 2014, 18:06
Posts: 428
Hello

Is there a way for you to use spaces in the text to simulate indentation?


Attachments:
sshot-164.png
sshot-164.png [ 30.83 KiB | Viewed 233 times ]

_________________
Best regards
EhLib Support Team
Top
 Profile  
 
PostPosted: 03 Dec 2020, 16:18 
Offline

Joined: 31 Aug 2018, 19:06
Posts: 40
Hi,
For space yes, but for Alignment?


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 10 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB® Forum Software © phpBB Group