1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71
| unit uMainForm;
{$mode objfpc}{$H+}
interface
uses
Types, Classes, SysUtils, Forms, Controls, Graphics, Dialogs, ExtCtrls, Menus, ComCtrls, ActnList, StdCtrls, ShellCtrls, ExtDlgs, Buttons,
XMLPropStorage, LazFileUtils //...;
type
{ TMainForm }
TFrameType = (fstCommonFilter, fstCommonFilterEx, fstCommonFilterBlur, fstMotionFilterBlur);
TMainForm = class(TForm)
pnlFrame : TPanel; // Si tu les panels sont créés dynamiquement déclarer un array of TPanle dans la section private
private
FInternalFrame : TFrame; // si tu plusieurs frame en même temps il faut faire un array of TFrame
procedure InitFrame(Idx : Integer); // ou par exemple en paramètre tu peux passer le TframeType + d'autres parmètres supplémentaire que tu as besoin
end;
var
MainForm : TMainForm;
implementation
{$R *.lfm}
Uses
uMyFrame;
procedure TMainForm.InitFilterUI(Idx : Integer);
Var
bmp : TBitmap;
sl : TStringList;
begin
if Assigned(FInternalFrame) then // ici il est important de vérifier si ta frame existe déja
begin
FreeAndNil(FInternalFrame); // si oui on libère avec FreeAndNil c'est important de mettre la variable à NIL
end;
Case Idx of
0 : // Ajustement du Contraste
begin
bmp := TBitmap.Create;
DMMain.ImageList.GetBitmap(38, Bmp);
pnlSettingsTool.Height := 180;
FInternalFrame := CreateMyFrame(pnlSettingsTool,'Ajuster le contraste',bmp,True,true,true, true, false, true,'Facteur : ','','','','','','', @HandleFilterChangeSettings);
pnlSettingsTool.Height := 35 + FInternalFrame.Constraints.MaxHeight;
FInternalFrame.Parent := pnlSettingsTool;
FInternalFrame.Align := alClient;
Bmp.Free;
end;
1 : // Ajustement de la luminositée
begin
bmp := TBitmap.Create;
DMMain.ImageList.GetBitmap(39, Bmp);
pnlSettingsTool.Height := 180;
FInternalFrame := CreateMyFrame(pnlSettingsTool,'Ajuster la luminosité',bmp,True,true,true, true, false, false,'Facteur : ','','','','','','', @HandleFilterChangeSettings);
pnlSettingsTool.Height := 35 + FInternalFrame.Constraints.MaxHeight;
FInternalFrame.Parent := pnlSettingsTool;
FInternalFrame.Align := alClient;
Bmp.Free;
end;
//...
end;
pnlSettingsTool.Visible := True;
end;
//...
end. |
Partager