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

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

•  TDictionary Custom Sort  6 491

•  Fast Watermark Sources  6 283

•  3D Designer  9 229

•  Sik Screen Capture  6 618

•  Patch Maker  6 997

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

•  ListBox Drag & Drop  5 871

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

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

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

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

•  Canvas Drawing  5 743

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

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

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

•  Paint on Shape  2 805

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

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

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

•  Пазл Numbrix  2 482

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

•  Игра HIP  2 134

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

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

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

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

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

•  HEX View  2 593

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

 
скрыть

Изменить экранный курсор без необходимости возвращать предыдущий



Оформил: DeeCo

// By implementing Interface we can set the cursor without restore it in the end. 
// Example: In convensional way... 
var
   Cur: TCursor;
 begin
   Cur := Screen.Cursor;
   Screen.Cursor := crSQLWait;
   //do coding here 
  //What happend is that if your code did not finish, the screen cursor will 
  //remain as crSQLWait.. even with try..finally block (sometimes) 
  Screen.Cursor := Cur;
 end;

 // By using interface, we can implement as follows 
type
   ImyCursor = interface
     [(GUID - Ctrl - Shift - G)]
   end;
   TmyCursor = class(TInterfacedObjects, ImyCursor);
   private
   FCursor: TCursor;
   public
 constructor Create;
   destructor Destroy; override;
     end;

 implementation

 TmyCursor.Create;

 begin
   FCursor := Screen.Cursor;
 end;

 TmyCursor.Destroy;

 begin
   Screen.Cursor := FCursor;
   inherited;
 end;

 procedure....var
   C: ImyCursor;
 begin
   C := TmyCursor.Create;
   Screen.Curosr := crSQLWait; // whatever cursor you like 
  // Do coding here without worring to free it. 
  // Screen Cursor will restore when the TMyCursor object get out of scope. 
end;