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

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

•  TDictionary Custom Sort  6 476

•  Fast Watermark Sources  6 267

•  3D Designer  9 217

•  Sik Screen Capture  6 605

•  Patch Maker  6 991

•  Айболит (remote control)  6 991

•  ListBox Drag & Drop  5 861

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

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

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

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

•  Canvas Drawing  5 736

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

•  Поворот изображения  4 974

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

•  Paint on Shape  2 801

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

•  Головоломка Paletto  2 954

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

•  Пазл Numbrix  2 481

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

•  Игра HIP  2 129

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

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

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

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

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

•  HEX View  2 590

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

 
скрыть

Как определить, насдледовано ли свойство от определённого класса



Автор: Peter Below

function GetFontProp(anObj: TObject): TFont;
var
  PInfo: PPropInfo;
begin
  {Try to get a pointer to the property information for a property with the name 'Font'.
  TObject.ClassInfo returns a pointer to the RTTI table, which we need to pass to GetPropInfo}
  PInfo := GetPropInfo(anObj.ClassInfo, 'font');
  Result := nil;
  if PInfo <> nil then
    {found a property with this name, check if it has the correct type}
    if (PInfo^.Proptype^.Kind = tkClass) and
      GetTypeData(PInfo^.Proptype^)^.ClassType.InheritsFrom(TFont) then
      Result := TFont(GetOrdProp(anObj, PInfo));
end;