Components for Delphi and C++ Builder.

Go to Russian forum
Go to EhLib.com
It is currently 28 Mar 2024, 23:17

All times are UTC




Post new topic Reply to topic  [ 13 posts ]  Go to page 1, 2  Next
Author Message
 Post subject: Repeat Image in Column
PostPosted: 15 Sep 2018, 14:05 
Offline

Joined: 31 Aug 2018, 19:06
Posts: 92
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: 92
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: 660
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 4108 times ]

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

Joined: 08 May 2014, 18:06
Posts: 660
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: 92
No, I mean about repeat:
For Example 'Score' Column


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

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


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

Joined: 08 May 2014, 18:06
Posts: 660
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 3901 times ]

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

Joined: 31 Aug 2018, 19:06
Posts: 92
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: 660
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 3045 times ]

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

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


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 13 posts ]  Go to page 1, 2  Next

All times are UTC


Who is online

Users browsing this forum: No registered users and 9 guests


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:  
Powered by phpBB® Forum Software © phpBB Group