Hola amigos.
Trabajando con: FB 2.0, IBX, Delphi6, Win10
Estoy tratando de cargar ICONOS PNG sobre botones BitBtn en tiempo de ejecución -ya he leido que BitBtn solo acepta el formato BMP-. Los iconos los quiero cargar a los botones -creados en tiempo de ejecución- utilizando un campo de la tabla que tiene la RUTA del icono, pero marca error ya que este tipo de botón no acepta los PNG's solo BMP.
Como le hago para que los acepte y muestre el icono en el botón?
Estoy consultando los siguientes hilos:
http://www.clubdelphi.com/~cadetill/...ad.php?t=27568
https://www.clubdelphi.com/foros/showthread.php?t=8020
https://www.clubdelphi.com/foros/sho...ght=png+bitbtn
En espera de encontrar como solucionarlo....
Hasta ahorita lo estoy intentando asi, pero obviamente me salta el error:
Código:
'Bitmap image is not valid'
Aqui el código:
Código Delphi
[-]
procedure TfrmRegComanda.FormShow(Sender: TObject);
var
PosY: Integer;
nLeft:Integer;
begin
nLin:=1;
if frmMeseroMain.nRegID=0 then
begin
Edit1.Text:=IntToStr(frmAbrirMesas.cbxMesa.KeyValue)+' '+frmAbrirMesas.cbxLetra.Text;
Edit3.Text:=frmMeseroMain.Label3.Caption;
Edit2.Text:=frmAbrirMesas.mskNumPersonas.Text;
Edit4.Text:=IntToStr( frmMeseroMain.nRegID );
sBtnCerrarCuenta.Enabled:=False;
sBtnEnviar.Enabled:=True;
sBtnCambiaMesa.Enabled:=False;
frmMeseroMain.qryGenerator.Close;
frmMeseroMain.qryGenerator.Open;
frmMeseroMain.nRegID:=frmMeseroMain.qryGenerator.FieldByName('ID').AsInteger+1;
dsCM.Close;
dsCM.Open;
dsCM.Append;
dsCM.FieldByName('COMANDA_NUM_MESA').AsInteger:=frmAbrirMesas.cbxMesa.KeyValue; dsCM.FieldByName('COMANDA_MESA_LETRA').AsString:=frmAbrirMesas.cbxLetra.Text; dsCM.FieldByName('COMANDA_ESTATUS').AsString:='A';
dsCM.FieldByName('COMANDA_EMP_ID').AsString:=frmMeseroMain.vNumEmpl;
dsCM.FieldByName('COMANDA_N_PERSONAS').AsString:=frmAbrirMesas.mskNumPersonas.Text;
dsCM.Post;
end Else
begin
dsCM.Close;
dsCM.ParamByName('COMANDA_ID').AsInteger:=frmMeseroMain.nRegID;
dsCM.Open;
dsCM.Edit;
if dsCM.FieldByName('COMANDA_ESTATUS').AsString='A' then
begin
sBtnCerrarCuenta.Enabled:=True;
sBtnEnviar.Enabled:=True;
sBtnCambiaMesa.Enabled:=True;
end else
begin
sBtnCerrarCuenta.Enabled:=False;
sBtnEnviar.Enabled:=False;
sBtnCambiaMesa.Enabled:=False;
end;
dsCD.Close;
dsCD.ParamByName('COMANDA_ID').AsInteger:=dsCM.FieldByName('COMANDA_ID').AsInteger;
dsCD.Open;
dsCD.First;
Edit1.Text:=dsCM.FieldByName('COMANDA_NUM_MESA').AsString+' '+dsCM.FieldByName('COMANDA_MESA_LETRA').AsString;
Edit3.Text:=frmMeseroMain.Label3.Caption;
Edit2.Text:=dsCM.FieldByName('COMANDA_N_PERSONAS').AsString;
Edit4.Text:=IntToStr( frmMeseroMain.nRegID );
While not(dsCD.Eof)do
begin
qryProducto.Close;
qryProducto.ParamByName('PROD_ID').AsInteger:=dsCD.FieldByName('PRODUCTO_ID').AsInteger;
qryProducto.Open;
SG.RowCount:=SG.RowCount+1;
SG.RowHeights[nLin] := 80;
SG.Cells[0,nLin]:=IntToStr( nLin );
SG.Cells[1,nLin]:=dsCD.FieldByName('PRODUCTO_ID').AsString;
SG.Cells[2,nLin]:=TRIMLEFT(dsCD.FieldByName('COMANDA_DESCR_PROD_MODIF').AsString);
SG.Cells[3,nLin]:=IntToStr(1);
SG.Cells[4,nLin]:=FormatFloat('$##,##0.00',qryProducto.FieldByName('PRECIO').AsFloat) ;
SG.Cells[6,nLin]:=dsCD.FieldByName('COMANDA_STAT_COCINA').AsString;
Importe:=qryProducto.FieldByName('PRECIO').AsCurrency*dsCD.FieldByName('COMANDA_D_CANT').AsFloat;
SG.Cells[5,nLin]:=FormatFloat('$##,##0.00', Importe);
TotPagar:=TotPagar+Importe;
mskImporte.Text:=FormatFloat('$##,##0.00',TotPagar);
nLin:=nLin+1;
dsCD.Next;
end;
end;
while ScrollBox1.ControlCount > 0 do
ScrollBox1.Controls[0].Free;
PosY:=8;
nLeft:=8;
n:=1;
qryCategorias.Close;
qryCategorias.Open;
qryCategorias.First;
if not(qryCategorias.IsEmpty) then
begin
While not qryCategorias.Eof do
begin
BtnsCategorias[n]:=TBitBtn.Create(Self);
with BtnsCategorias[n] do
begin
Caption:=copy( UPPERCASE( qryCategorias.fieldbyname('DESCRIPCION').AsString ),1,9)+#13+
copy( UPPERCASE( qryCategorias.fieldbyname('DESCRIPCION').AsString ),10,20);
Parent:=ScrollBox1;
Height:=100;
Top:=PosY;
Left:=nLeft;
if nLeft=408 then begin nLeft:=8;
PosY:=PosY+Height+5
end Else Begin
nLeft:=nLeft+100;
end;
Width:=100;
OnClick:=OnButtonClick1;
Font.Size:=10;
Tag:=qryCategorias.FieldByName('CATEGORIA_ID').AsInteger;
Font.Style:=[fsBold];
Layout:=blGlyphTop;
Glyph.LoadFromFile(qryCategorias.FieldByName('RUTA_ICONO').AsString );
end;
qryCategorias.Next;
inc(n);
end;
end;
Click_en_BTNCatego:=0;
end;
Como hacer para que acepte iconos PNG Y BMP....solo esos 2 tipos.
Muchas gracias amigos por su tiempo.
P.D. Estoy revisando los links de hasta abajo....