Jump to content

Possible to use svg in dbgrid?


d.bernaert

Recommended Posts

Hello,

I now have images on the main form that are displayed in the grid in the FiledImage event of the grid.

This works fine when this is a static image with a png loaded in the image (see below)

if SameText(UpperCase(AField.FieldName), 'LEFT_VOICEMAIL')
  then begin
         DoNotDispose := True;
         Case AField.AsInteger of
         0:   OutImage := MainForm.ImageEmpty.Picture.Graphic;
         1:   OutImage := MainForm.ImageGreen.Picture.Graphic;
         else OutImage := MainForm.ImageEmpty.Picture.Graphic;
         End;
       end;

I would like to use an svg image stored on disk if possible.

I've tried OutImage.LoadFromFile('images/databasedelete.svg'), but this gives me an access violation.

Thx

Dominique

 

Link to comment
Share on other sites

Hi ,

The nature of SVG is vector text format like this.

<svg 
      width="236" height="120" viewBox="0 0 236 120">
  <rect x="14" y="23" width="200" height="50" fill="#55FF55"
      stroke="black" stroke-width="1" />
</svg>

You should forget for Pictures and Graphics for SVG

Insted could use OnGetText Event and return SVG content to cell;

I often use SVG for column beautification and it works just fine.

Untitled.png

Untitled2.png

Link to comment
Share on other sites

  • 4 years later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...