Import / export GraphicContainer
This commit is contained in:
parent
d3ca72b5ff
commit
231b2c42bf
@ -201,7 +201,7 @@ object GraphicsEditorForm: TGraphicsEditorForm
|
||||
Left = 20
|
||||
Top = 360
|
||||
Bitmap = {
|
||||
494C010107000900040010001000FFFFFFFFFF10FFFFFFFFFFFFFFFF424D3600
|
||||
494C010107000900080010001000FFFFFFFFFF10FFFFFFFFFFFFFFFF424D3600
|
||||
0000000000003600000028000000400000002000000001002000000000000020
|
||||
0000000000000000000000000000000000000000000000000000000000000000
|
||||
0000000000000000000000000000000000000000000000000000000000000000
|
||||
|
@ -466,6 +466,7 @@ var
|
||||
index: Integer;
|
||||
graphic: TX2GraphicContainerItem;
|
||||
fileName: string;
|
||||
startIndex: Integer;
|
||||
|
||||
begin
|
||||
if dlgImport.Execute then
|
||||
@ -476,8 +477,21 @@ begin
|
||||
exit;
|
||||
end;
|
||||
|
||||
{ Items inherited from the ancestor through visual inheritance can not
|
||||
be deleted. Start at the first one introduced at this level. }
|
||||
startIndex := 0;
|
||||
while (startIndex < FComponent.GraphicCount) and (csAncestor in FComponent.Graphics[startIndex].ComponentState) do
|
||||
Inc(startIndex);
|
||||
|
||||
lstGraphics.Clear;
|
||||
FComponent.Clear;
|
||||
|
||||
if startIndex = 0 then
|
||||
FComponent.Clear
|
||||
else
|
||||
begin
|
||||
for index := Pred(FComponent.GraphicCount) downto startIndex do
|
||||
FComponent.Graphics[index].Free;
|
||||
end;
|
||||
|
||||
importPath := ExtractFilePath(dlgImport.FileName);
|
||||
importFile := TIniFile.Create(dlgImport.FileName);
|
||||
@ -485,6 +499,8 @@ begin
|
||||
index := 0;
|
||||
|
||||
while importFile.ValueExists('PictureName', IntToStr(index)) do
|
||||
begin
|
||||
if index >= startIndex then
|
||||
begin
|
||||
graphic := TX2GraphicContainerItem(FComponentDesigner.CreateComponent(TX2GraphicContainerItem, nil, 0, 0, 0, 0));
|
||||
|
||||
@ -497,6 +513,7 @@ begin
|
||||
if (Length(fileName) > 0) and FileExists(importPath + fileName) then
|
||||
graphic.Picture.LoadFromFile(importPath + fileName);
|
||||
end;
|
||||
end;
|
||||
|
||||
Inc(index);
|
||||
end;
|
||||
|
Loading…
Reference in New Issue
Block a user