Иллюстрированный самоучитель по Delphi 7 для профессионалов

Использование диалогов для загрузки и сохранения графических файлов

procedure TForml.SavePictureDialoglTypeChange(Sender: TObject);
var ParentHandle:THandle;wRect:TRect;
PicPanel,PaintPanel:TPanel;JEdit: TEdit;
Expanded: boolean;
begin
With Sender as TSavePictureDialog do
begin
PicPanel: = (FindComponent('PicturePanel') as TPanel);
if not Assigned(PicPanel) then Exit;
ParentHandle: = GetParent(Handle);
PaintPanel: = (FindComponent('PaintPanel') as TPanel);
PaintPanel.Align: = alNone;
Expanded: = FindComponent('JLabel') <> nil;
if Filterlndex >1 then begin if not Expanded then
begin
GetWindowRect(ParentHandle,WRect);
SetWindowPos(ParentHandle,0.0.0,
WRect.Right-WRect.Left,
WRect.Bottom-WRect.Top+DeltaH,
SWP_NOMOVE+SWP_NOZORDER);
GetWindowRect(Handle,WRect);
SetWindowPos(handle,0.0.0,WRect.Right-
WRect.Left,
WRect.Bottom-WRect.Top+DeltaH,
SWP_NOMOVE+SWP_NOZORDER);
Expanded: = True;
PicPanel.Height: = PicPanel.Height+DeltaH;
if FindComponent('JLabel')=nil
then with TLabel.Create(Sender as TSavePictureDialog) do
begin
Parent: = PicPanel;
Name: = 'JLabel';
Caption: = 'Quality';
Left: = 5;
Height: = 25;
Top: = PaintPanel.Top+PaintPanel.Height+5; end;
if FindComponent('JEdit')=nil then
begin
JEdit: = TEdit.Create(Sender as TSavePictureDialog);
with JEdit do
begin
Parent: = PicPanel;
Name: = 'JEdit';
Text: = '75';
Left:-50;Width: = 50;
Height: = 25;
Top: = PaintPanel.Top+PaintPanel.Height+5;
end;
end;
if FindComponent('JUpDown')=nil then
with TUpDown.Create(Sender as TSavePictureDialog) do
begin
Parent: = PicPanel;
Name: = 'JUpDown';
Associate: = JEdit;
Increment: = 5;
Min: = 1; Max: = 100;
Position: = 75; end;
if FindComponent('JCheck')=nil then
with TCheckBox.Create(Sender as TSavePictureDialog) do
begin
Name: = 'JCheck';
Caption: = 'Progressive Encoding'; Parent: = PicPanel;
Left: = 5;Width: = PicPanel.Width – 10; Height: = 25;
Top: = PaintPanel.Top+PaintPanel.Height+35;
end;
end;
end
else
SavePictureDialoglClose(Sender);
end;
end;
Если Вы заметили ошибку, выделите, пожалуйста, необходимый текст и нажмите CTRL + Enter, чтобы сообщить об этом редактору.