artem_niko Posted May 21, 2022 Share Posted May 21, 2022 Good afternoon! For some reason, when icons are found in a UniDBGrid column, the background of the icon is black instead of transparent. I am using icon format: What modules should be added so that the icons do not have a black background? My uses: uses Windows, Messages, SysUtils, Variants, Classes, Graphics, FireDAC.Phys.FBDef, FireDAC.Stan.Intf, FireDAC.Stan.Option, FireDAC.Stan.Error, FireDAC.UI.Intf, FireDAC.Phys.Intf, FireDAC.Stan.Def, FireDAC.Stan.Pool, FireDAC.Stan.Async, FireDAC.Phys, FireDAC.Phys.FB, FireDAC.VCLUI.Wait, FireDAC.Stan.Param, FireDAC.DatS, FireDAC.DApt.Intf, FireDAC.DApt, uniButton, uniBitBtn, UniFSButton, uniPanel, uniGUIClasses, uniBasicGrid, uniDBGrid, System.Actions, Vcl.ActnList, uniMainMenu, uniSplitter, FireDAC.Comp.Client, Data.DB, uniGUIBaseClasses, uniImageList, FireDAC.Comp.DataSet, FireDAC.Phys.IBBase, uniPageControl, Vcl.Controls, Vcl.Forms, jpeg, pngimage, System.Math, uniGUITypes, uniGUIAbstractClasses, System.IniFiles, Soap.EncdDecd, uniGUIFrame, System.TypInfo, uniLabel, uniCheckBox, uniDBNavigator, uniEdit, uniGUIForm, uniTimer, UniFSiGrowl, uniImage, uniWidgets, uniDBEdit, IdTCPConnection, IdTCPClient, IdExplicitTLSClientServerBase, IdMessageClient, IdSMTPBase, IdSMTP, IdMessage, IdBaseComponent, IdComponent, IdIOHandler, IdIOHandlerSocket, IdIOHandlerStack, IdSSL, IdSSLOpenSSL, IdHashMessageDigest, uniMenuButton, UniFSMenuButton, uniHTMLFrame, UniFSGoogleChart, uniRadioButton, uniStringGrid, uniChart, uniMultiItem, uniListBox, uniDateTimePicker, System.DateUtils, UniFSToggle, uniSpinEdit, uniComboBox; Quote Link to comment Share on other sites More sharing options...
artem_niko Posted December 13, 2022 Author Share Posted December 13, 2022 On 5/21/2022 at 6:59 PM, artem_niko said: Good afternoon! For some reason, when icons are found in a UniDBGrid column, the background of the icon is black instead of transparent. I am using icon format: What modules should be added so that the icons do not have a black background? My uses: uses Windows, Messages, SysUtils, Variants, Classes, Graphics, FireDAC.Phys.FBDef, FireDAC.Stan.Intf, FireDAC.Stan.Option, FireDAC.Stan.Error, FireDAC.UI.Intf, FireDAC.Phys.Intf, FireDAC.Stan.Def, FireDAC.Stan.Pool, FireDAC.Stan.Async, FireDAC.Phys, FireDAC.Phys.FB, FireDAC.VCLUI.Wait, FireDAC.Stan.Param, FireDAC.DatS, FireDAC.DApt.Intf, FireDAC.DApt, uniButton, uniBitBtn, UniFSButton, uniPanel, uniGUIClasses, uniBasicGrid, uniDBGrid, System.Actions, Vcl.ActnList, uniMainMenu, uniSplitter, FireDAC.Comp.Client, Data.DB, uniGUIBaseClasses, uniImageList, FireDAC.Comp.DataSet, FireDAC.Phys.IBBase, uniPageControl, Vcl.Controls, Vcl.Forms, jpeg, pngimage, System.Math, uniGUITypes, uniGUIAbstractClasses, System.IniFiles, Soap.EncdDecd, uniGUIFrame, System.TypInfo, uniLabel, uniCheckBox, uniDBNavigator, uniEdit, uniGUIForm, uniTimer, UniFSiGrowl, uniImage, uniWidgets, uniDBEdit, IdTCPConnection, IdTCPClient, IdExplicitTLSClientServerBase, IdMessageClient, IdSMTPBase, IdSMTP, IdMessage, IdBaseComponent, IdComponent, IdIOHandler, IdIOHandlerSocket, IdIOHandlerStack, IdSSL, IdSSLOpenSSL, IdHashMessageDigest, uniMenuButton, UniFSMenuButton, uniHTMLFrame, UniFSGoogleChart, uniRadioButton, uniStringGrid, uniChart, uniMultiItem, uniListBox, uniDateTimePicker, System.DateUtils, UniFSToggle, uniSpinEdit, uniComboBox; Any idea? Quote Link to comment Share on other sites More sharing options...
Sherzod Posted December 13, 2022 Share Posted December 13, 2022 7 hours ago, artem_niko said: Any idea? Testcase? Quote Link to comment Share on other sites More sharing options...
artem_niko Posted December 13, 2022 Author Share Posted December 13, 2022 2 minutes ago, Sherzod said: Testcase? Yes, as it were, what an example... I just added a picture display, and it's with a black background. Actually, my question does not mean "how to do it", but maybe some module needs to be connected that supports PNG files, I asked about it. Well, for example, in standard VCL, there is a PNGImage module there. Quote Link to comment Share on other sites More sharing options...
Sherzod Posted December 13, 2022 Share Posted December 13, 2022 2 minutes ago, artem_niko said: I just added a picture display In what way? Quote Link to comment Share on other sites More sharing options...
artem_niko Posted December 13, 2022 Author Share Posted December 13, 2022 7 minutes ago, Sherzod said: In what way? Like this: procedure TUniFrame1.UniDBGrid1FieldImage( const Column: TUniDBGridColumn; const AField: TField; var OutImage: TGraphic; var DoNotDispose: Boolean; var ATransparent: TUniTransparentOption); begin if SameText(AField.FieldName, 'MyField') then begin DoNotDispose:=True; if AField.AsInteger = 0 then OutImage:=UniImage1.Picture.Graphic else if AField.AsInteger = 1 then OutImage:=UniImage2.Picture.Graphic; end; end; Quote Link to comment Share on other sites More sharing options...
Sherzod Posted December 13, 2022 Share Posted December 13, 2022 The icon in png format? Quote Link to comment Share on other sites More sharing options...
Sherzod Posted December 13, 2022 Share Posted December 13, 2022 Could you attach here? Quote Link to comment Share on other sites More sharing options...
artem_niko Posted December 13, 2022 Author Share Posted December 13, 2022 19 minutes ago, Sherzod said: The icon in png format? Yes, PNG... Quote Link to comment Share on other sites More sharing options...
artem_niko Posted December 13, 2022 Author Share Posted December 13, 2022 19 minutes ago, Sherzod said: Could you attach here? arrow_80px2.bmp arrow_pointing_left_80px2.bmp Quote Link to comment Share on other sites More sharing options...
Sherzod Posted December 13, 2022 Share Posted December 13, 2022 5 minutes ago, artem_niko said: arrow_80px2.bmp 1.41 kB · 0 downloads arrow_pointing_left_80px2.bmp 1.41 kB · 0 downloads BMP !? Quote Link to comment Share on other sites More sharing options...
artem_niko Posted December 13, 2022 Author Share Posted December 13, 2022 11 minutes ago, Sherzod said: BMP !? No, I'm using PNG format... With BMP also not working right Quote Link to comment Share on other sites More sharing options...
Sherzod Posted December 13, 2022 Share Posted December 13, 2022 Attach a png icon please to check. Quote Link to comment Share on other sites More sharing options...
artem_niko Posted December 13, 2022 Author Share Posted December 13, 2022 27 minutes ago, Sherzod said: Attach a png icon please to check. Quote Link to comment Share on other sites More sharing options...
Sherzod Posted December 13, 2022 Share Posted December 13, 2022 Quote Link to comment Share on other sites More sharing options...
Sherzod Posted December 13, 2022 Share Posted December 13, 2022 Displayed correctly? Quote Link to comment Share on other sites More sharing options...
artem_niko Posted December 13, 2022 Author Share Posted December 13, 2022 2 minutes ago, Sherzod said: Displayed correctly? On you picture yes, correctly... You using my code? Quote Link to comment Share on other sites More sharing options...
Sherzod Posted December 13, 2022 Share Posted December 13, 2022 Well, yes. ... else if SameText(AField.FieldName, 'gender') then begin DoNotDispose := True; // we provide an static image so do not free it. if AField.AsString = 'male' then OutImage := UniImage1.Picture.Graphic else if AField.AsString = 'female' then OutImage := UniImage3.Picture.Graphic; end; 1 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.