Changeset 585 for DpiControls/Demo/UDpiFormMain.pas
- Timestamp:
- Jan 13, 2026, 4:12:03 PM (18 hours ago)
- Location:
- DpiControls/Demo
- Files:
-
- 2 edited
-
. (modified) (1 prop)
-
UDpiFormMain.pas (modified) (8 diffs)
Legend:
- Unmodified
- Added
- Removed
-
DpiControls/Demo
- Property svn:ignore
-
old new 3 3 DpiComponentsDemo.res 4 4 lib 5 heaptrclog.trc
-
- Property svn:ignore
-
DpiControls/Demo/UDpiFormMain.pas
r537 r585 6 6 7 7 uses 8 Classes, SysUtils, UDpiControls, Dialogs, Graphics; 8 Classes, SysUtils, Dpi.Controls, Dpi.ExtCtrls, Dialogs, Dpi.Graphics, Dpi.Forms, 9 Types; 9 10 10 11 type … … 12 13 { TDpiFormMain } 13 14 14 TDpiFormMain = class(T DpiForm)15 DpiPaintBox1: T DpiPaintBox;15 TDpiFormMain = class(TForm) 16 DpiPaintBox1: TPaintBox; 16 17 procedure DpiButton1Click(Sender: TObject); 17 18 procedure DpiFormMainCreate(Sender: TObject); … … 19 20 procedure DpiPaintBox1Paint(Sender: TObject); 20 21 private 21 Button: TDpiButton; 22 Image: TDpiImage; 23 ListBox: TDpiListBox; 24 PaintBox: TDpiPaintBox; 22 Button: TButton; 23 ButtonClose: TButton; 24 Image: TImage; 25 ListBox: TListBox; 26 PaintBox: TPaintBox; 27 Bitmap: TBitmap; 28 procedure ButtonCloseClick(Sender: TObject); 25 29 public 26 27 30 end; 28 31 … … 39 42 var 40 43 I: Integer; 44 X, Y: Integer; 41 45 begin 42 46 Button := TDpiButton.Create(DpiFormMain); … … 45 49 Button.Caption := 'Click me'; 46 50 Button.Visible := True; 51 Button.OnClick := @DpiButton1Click; 52 53 ButtonClose := TDpiButton.Create(DpiFormMain); 54 ButtonClose.Parent := Self; 55 ButtonClose.SetBounds(120, 10, 100, 30); 56 ButtonClose.Caption := 'Close'; 57 ButtonClose.Visible := True; 58 ButtonClose.OnClick := @ButtonCloseClick; 47 59 48 60 Image := TDpiImage.Create(DpiFormMain); … … 61 73 ListBox.Visible := True; 62 74 63 DpiPaintBox1.BoundsRect := Rect(0, 0, 100, 100); 64 DpiPaintBox1.VclPaintBox.Parent := VclForm; 65 DpiPaintBox1.Repaint; 75 PaintBox := TDpiPaintBox.Create(DpiFormMain); 76 PaintBox.Parent := Self; 77 PaintBox.BoundsRect := Bounds(0, 100, 200, 200); 78 PaintBox.OnPaint := @DpiPaintBox1Paint; 79 PaintBox.Visible := True; 80 81 Bitmap := TDpiBitmap.Create; 82 Bitmap.PixelFormat := pf24bit; 83 Bitmap.SetSize(120, 50); 84 for Y := 0 to Bitmap.Height - 1 do 85 for X := 0 to Bitmap.Width - 1 do 86 Bitmap.Canvas.Pixels[X, Y] := X mod 255; 87 Bitmap.LoadFromFile('dance.bmp'); 66 88 end; 67 89 … … 74 96 75 97 procedure TDpiFormMain.DpiPaintBox1Paint(Sender: TObject); 98 var 99 X, Y: Integer; 76 100 begin 77 with DpiPaintBox1.Canvas do begin101 with PaintBox.Canvas do begin 78 102 Brush.Color := clWhite; 79 103 Brush.Style := bsSolid; 80 FillRect( Rect(0, 0, 100, 100));104 FillRect(Bounds(0, 0, PaintBox.Width, PaintBox.Height)); 81 105 Caption := IntToStr(Width); 82 106 Pen.Color := clGreen; … … 85 109 LineTo(100, 100); 86 110 Font.Color := clRed; 87 TextOut(40, 10, 'Scaled text'); 111 Font.Size := 20; 112 TextOut(10, 10, 'Scaled text'); 113 114 Brush.Color := clBlue; 115 Rectangle(Bounds(20, 30, 60, 30)); 116 117 Bitmap.Dpi := DpiScreen.Dpi; 118 DpiBitBltCanvas(PaintBox.Canvas, 0, 0, Bitmap.Width, Bitmap.Height, Bitmap.Canvas, 0, 0); 88 119 end; 89 120 end; 90 121 122 procedure TDpiFormMain.ButtonCloseClick(Sender: TObject); 123 begin 124 ModalResult := mrOk; 125 end; 126 91 127 procedure TDpiFormMain.DpiButton1Click(Sender: TObject); 128 var 129 DpiForm: TDpiForm; 92 130 begin 93 ShowMessage('Hello'); 131 //ShowMessage('Hello'); 132 DpiForm := TDpiFormMain.CreateNew(Self); 133 DpiForm.Name := 'Form10'; 134 DpiForm.Caption := 'Modal form'; 135 DpiForm.SetBounds(200, 150, 400, 200); 136 DpiForm.ShowModal; 94 137 end; 95 138
Note:
See TracChangeset
for help on using the changeset viewer.
