Changeset 535 for DpiControls/Demo/UDpiFormMain.pas
- Timestamp:
- May 27, 2019, 12:06:17 AM (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
DpiControls/Demo/UDpiFormMain.pas
r534 r535 6 6 7 7 uses 8 Classes, SysUtils, UDpiControls, Dialogs ;8 Classes, SysUtils, UDpiControls, Dialogs, Graphics; 9 9 10 10 type … … 13 13 14 14 TDpiFormMain = class(TDpiForm) 15 Dpi Button1: TDpiButton;15 DpiPaintBox1: TDpiPaintBox; 16 16 procedure DpiButton1Click(Sender: TObject); 17 17 procedure DpiFormMainCreate(Sender: TObject); 18 procedure DpiPaintBox1Paint(Sender: TObject); 18 19 private 19 20 20 public 21 21 … … 33 33 procedure TDpiFormMain.DpiFormMainCreate(Sender: TObject); 34 34 var 35 DpiButton: TDpiButton; 36 DpiImage: TDpiImage; 35 Button: TDpiButton; 36 Image: TDpiImage; 37 ListBox: TDpiListBox; 38 I: Integer; 39 PaintBox: TDpiPaintBox; 37 40 begin 38 DpiButton := TDpiButton.Create(DpiFormMain); 39 DpiButton.Parent := Self; 40 DpiButton.SetBounds(10, 10, 100, 30); 41 DpiButton.Caption := 'Click me'; 42 DpiButton.Visible := True; 43 DpiButton1.Parent := Self; 41 Button := TDpiButton.Create(DpiFormMain); 42 Button.Parent := Self; 43 Button.SetBounds(10, 10, 100, 30); 44 Button.Caption := 'Click me'; 45 Button.Visible := True; 44 46 45 DpiImage := TDpiImage.Create(DpiFormMain); 46 DpiImage.Parent := Self; 47 DpiImage.SetBounds(150, 10, 100, 100); 48 DpiImage.Visible := True; 49 DpiImage.Stretch := True; 50 DpiImage.VclImage.Picture.LoadFromFile('dance.jpg'); 47 Image := TDpiImage.Create(DpiFormMain); 48 Image.Parent := Self; 49 Image.SetBounds(150, 10, 100, 100); 50 Image.Visible := True; 51 Image.Stretch := True; 52 Image.VclImage.Picture.LoadFromFile('dance.jpg'); 53 //Image.Picture.LoadFromFile('dance.jpg'); 54 55 ListBox := TDpiListBox.Create(DpiFormMain); 56 for I := 0 to 10 do 57 ListBox.VclListBox.Items.Add('Item ' + IntToStr(I)); 58 ListBox.Parent := Self; 59 ListBox.SetBounds(250, 10, 100, 100); 60 ListBox.Visible := True; 61 62 DpiPaintBox1.BoundsRect := Rect(0, 0, 100, 100); 63 DpiPaintBox1.VclPaintBox.Parent := VclForm; 64 DpiPaintBox1.Repaint; 65 end; 66 67 procedure TDpiFormMain.DpiPaintBox1Paint(Sender: TObject); 68 begin 69 with DpiPaintBox1.Canvas do begin 70 Brush.Color := clWhite; 71 Brush.Style := bsSolid; 72 FillRect(Rect(0, 0, 100, 100)); 73 Caption := IntToStr(Width); 74 Pen.Color := clGreen; 75 Pen.Style := psSolid; 76 MoveTo(0, 0); 77 LineTo(100, 100); 78 Font.Color := clRed; 79 TextOut(40, 10, 'Scaled text'); 80 end; 51 81 end; 52 82
Note:
See TracChangeset
for help on using the changeset viewer.