Недавно добавленные исходники

•  DeLiKaTeS Tetris (Тетрис)  4 640

•  TDictionary Custom Sort  6 644

•  Fast Watermark Sources  6 422

•  3D Designer  9 363

•  Sik Screen Capture  6 750

•  Patch Maker  7 139

•  Айболит (remote control)  7 150

•  ListBox Drag & Drop  6 009

•  Доска для игры Реверси  97 597

•  Графические эффекты  7 335

•  Рисование по маске  6 622

•  Перетаскивание изображений  5 492

•  Canvas Drawing  5 872

•  Рисование Луны  5 595

•  Поворот изображения  5 103

•  Рисование стержней  3 672

•  Paint on Shape  2 903

•  Генератор кроссвордов  3 801

•  Головоломка Paletto  3 053

•  Теорема Монжа об окружностях  3 861

•  Пазл Numbrix  2 544

•  Заборы и коммивояжеры  3 257

•  Игра HIP  2 227

•  Игра Go (Го)  2 162

•  Симулятор лифта  2 539

•  Программа укладки плитки  2 177

•  Генератор лабиринта  2 677

•  Проверка числового ввода  2 327

•  HEX View  2 662

•  Физический маятник  2 294

 
скрыть

Клонирование свойств элемента управления



Оформил: DeeCo

uses
   TypInfo;

 function CloneProperty(SourceComp, TargetComp: TObject;
   Properties: array of string): Boolean;
 var
   i: Integer;
 begin
   Result := True;
   try
     for i := Low(Properties) to High(Properties) do
     begin
       if not IsPublishedProp(SourceComp, Properties[I]) then Continue;
       if not IsPublishedProp(TargetComp, Properties[I]) then Continue;
       if PropType(SourceComp, Properties[I]) <> PropType(TargetComp, Properties[I]) then
         Continue;
       case PropType(SourceComp, Properties[i]) of
         tkClass:
           SetObjectProp(TargetComp, Properties[i],
             GetObjectProp(SourceComp, Properties[i]));
         tkMethod:
           SetMethodProp(TargetComp, Properties[I], GetMethodProp(SourceComp,
             Properties[I]));
         else
           SetPropValue(TargetComp, Properties[i], GetPropValue(SourceComp, Properties[i]));
       end;
     end;
   except
     Result := False;
   end;
 end;

 procedure TForm1.Button1Click(Sender: TObject);
 begin
   if CloneProperty(Button1, Button2, ['Left', 'Font', 'PopupMenu', 'OnClick']) then
     ShowMessage('OK');
 end;







Copyright © 2004-2025 "Delphi Sources" by BrokenByte Software. Delphi World FAQ

Группа ВКонтакте