R
R
Romanson2016-03-26 15:44:40
Delphi
Romanson, 2016-03-26 15:44:40

Does anyone know MultiResBitmap in Image Delphi?

added several pictures to MultiResBitmap, added several Buttons, when you click each of the nicknames you need to change to the corresponding picture in MultiResBitmap. let's say Button1 on picture 1. etc. I can't log in how to do it

unit Unit2;

interface

uses
  System.SysUtils, System.Types, System.UITypes, System.Classes, System.Variants,
  FMX.Types, FMX.Controls, FMX.Forms, FMX.Graphics, FMX.Dialogs, FMX.StdCtrls,
  FMX.Controls.Presentation, FMX.Objects;

type
  TForm2 = class(TForm)
    Button1: TButton;
    Label1: TLabel;
    Button2: TButton;
    Button3: TButton;
    Panel1: TPanel;
    Image1: TImage;
    procedure Button1Click(Sender: TObject);
    procedure Button2Click(Sender: TObject);
    procedure Button3Click(Sender: TObject);
    procedure FormCreate(Sender: TObject);
    procedure Panel1DragOver(Sender: TObject; const [Ref] Data: TDragObject;
      const [Ref] Point: TPointF; var Operation: TDragOperation);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form2: TForm2;

implementation

{$R *.fmx}

procedure TForm2.Button1Click(Sender: TObject);
begin
panel1.Visible:=true;
label1.Text:='1111';
end;

procedure TForm2.Button2Click(Sender: TObject);
begin
image1.MultiResBitmap.Bitmaps[2];
image1.Release;
label1.Text:='2222';
panel1.Visible:=true;
end;

procedure TForm2.Button3Click(Sender: TObject);
begin
label1.Text:='3333';
panel1.Visible:=true;
end;

procedure TForm2.FormCreate(Sender: TObject);
begin
panel1.Visible:=false;
end;

procedure TForm2.Panel1DragOver(Sender: TObject; const [Ref] Data: TDragObject;
  const [Ref] Point: TPointF; var Operation: TDragOperation);
begin
if label1.Text = '1111' then
image1.MultiResBitmap.Bitmaps[1]; // что тут делать?

end;

end.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
O
ORTOL, 2016-03-29
@Romanson

Pictures change according to the following algorithm ...

procedure TForm1.Button1Click(Sender: TObject);
begin
 Image1.Bitmap.Assign(Image1.MultiResBitmap.Items[1].Bitmap);
end;

Just change to the appropriate index... Indexes start from zero, one is the next picture.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question