home *** CD-ROM | disk | FTP | other *** search
/ DOS/V Power Report 1997 August / VPR9708A.ISO / D3TRIAL / INSTALL / DATA.Z / DROPFONT.PAS < prev    next >
Pascal/Delphi Source File  |  1997-04-24  |  1KB  |  42 lines

  1. { Simple drag/drop demonstration program. }
  2. unit Dropfont;
  3.  
  4. interface
  5.  
  6. uses WinTypes, WinProcs, Classes, Graphics, Forms, Controls, StdCtrls;
  7.  
  8. type
  9.   TForm1 = class(TForm)
  10.     Label1: TLabel;
  11.     Label2: TLabel;
  12.     Label3: TLabel;
  13.     Label4: TLabel;
  14.     Memo1: TMemo;
  15.     procedure Memo1DragOver(Sender, Source: TObject; X, Y: Integer;
  16.       State: TDragState; var Accept: Boolean);
  17.     procedure Memo1DragDrop(Sender, Source: TObject; X, Y: Integer);
  18.   end;
  19.  
  20. var
  21.   Form1: TForm1;
  22.  
  23. implementation
  24.  
  25. {$R *.DFM}
  26.  
  27. { Only accept if the source of the drag is a label. Note that }
  28. { all the labels' DragMode properties are set to dmAutomatic. }
  29. procedure TForm1.Memo1DragOver(Sender, Source: TObject; X, Y: Integer;
  30.   State: TDragState; var Accept: Boolean);
  31. begin
  32.   Accept := Source is TLabel;
  33. end;
  34.  
  35. { Assign the label's font to the memo field. }
  36. procedure TForm1.Memo1DragDrop(Sender, Source: TObject; X, Y: Integer);
  37. begin
  38.   Memo1.Font := (Source as TLabel).Font;
  39. end;
  40.  
  41. end.
  42.