DBNavigator - trocando os glyphs em runtime

Top  Previous  Next

Change glyphs of TBDNavigator Buttons

 

{

Form1 has DBNavigator1. In the OnCreate

event for the form the custom bitmap ('GoFirst') for

the First button is loaded from the resource.

}

 procedure TForm1.FormCreate(Sender: TObject);

 var

  i         : Integer;

  tempGlyph : tBitmap;

 begin

  tempGlyph :=TBitmap.Create;

  try

   tempGlyph.LoadFromResourceName

             (HInstance,'GoFirst');

   with DBNavigator1 do begin

    for i := 0 to ControlCount - 1 do

     if Controls[c] is TNavigateBtn then

      with TNavigateBtn(Controls[c])

      do begin

       case Index of

         nbFirst: Glyph := tempGlyph;

       end;

      end;

    end;

  finally

    tempGlyph.Free;

   end;

 end;