Nov
15
|
Le code :
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 | unit uMain; interface uses System.SysUtils, System.Types, System.UITypes, System.Classes, System.Variants, FMX.Types, FMX.Controls, FMX.Forms, FMX.Graphics, FMX.Dialogs, FMX.Layouts, FMX.Objects; type TfrmClockMain = class(TForm) sclytClock: TScaledLayout; cClock: TCircle; rrecHours: TRoundRect; lytHours: TLayout; lytMinutes: TLayout; rrecMinutes: TRoundRect; crectMinute: TCalloutRectangle; lytMinute: TLayout; lytHour: TLayout; crectHour: TCalloutRectangle; lytSecond: TLayout; crecSecond: TCalloutRectangle; tmrSeconds: TTimer; cMiddle: TCircle; procedure FormCreate(Sender: TObject); procedure tmrSecondsTimer(Sender: TObject); private { Private declarations } public { Public declarations } end; var frmClockMain: TfrmClockMain; implementation {$R *.fmx} procedure TfrmClockMain.FormCreate(Sender: TObject); var iLoop: Integer; lyt : TLayout; rrec : TRoundRect; begin for iLoop := 1 to 59 do begin lyt := TLayout.Create(cClock); with lyt do begin Parent := cClock; Align := TAlignLayout.alClient; RotationAngle := iLoop * 6; with TRoundRect.Create(lyt) do begin if iLoop mod 5 = 0 then rrec := rrecHours else rrec := rrecMinutes; Parent := lyt; Width := rrec.Width; Height := rrec.Height; Fill.Color := rrec.Fill.Color; Stroke.Color := rrec.Stroke.Color; Position.X := rrec.Position.X; Position.Y := rrec.Position.Y; end; end end; lytMinute.BringToFront; lytHour.BringToFront; lytSecond.BringToFront; cMiddle.BringToFront; end; procedure TfrmClockMain.tmrSecondsTimer(Sender: TObject); var iH, iMn, iSec, iMSec: Word; begin DecodeTime(Now, iH, iMn, iSec, iMSec); lytHour.RotationAngle := iH * 30 + iMn/2; lytMinute.RotationAngle := iMn * 6 + iSec/10; lytSecond.RotationAngle := iSec * 6; end; end. |
La conception :
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 | object frmClockMain: TfrmClockMain Left = 0 Top = 0 Caption = 'Delphi Clock' ClientHeight = 567 ClientWidth = 384 FormFactor.Width = 320 FormFactor.Height = 480 FormFactor.Devices = [dkDesktop] OnCreate = FormCreate DesignerMobile = True DesignerWidth = 384 DesignerHeight = 592 DesignerDeviceName = 'Google Nexus 4' DesignerOrientation = 0 DesignerOSVersion = '' object sclytClock: TScaledLayout Align = alFit Height = 567.000000000000000000 OriginalWidth = 383.999969482421900000 OriginalHeight = 566.999938964843800000 Width = 384.000000000000000000 object cClock: TCircle Align = alFit Height = 383.999969482421900000 Stroke.Color = claSienna Stroke.Thickness = 20.000000000000000000 Width = 383.999938964843800000 object lytSecond: TLayout Align = alClient Height = 383.999969482421900000 RotationAngle = 60.000000000000000000 Width = 383.999938964843800000 object crecSecond: TCalloutRectangle Fill.Color = claFirebrick Height = 161.000000000000000000 Position.X = 188.000000000000000000 Position.Y = 32.000000000000000000 Stroke.Color = claNull Width = 8.000000000000000000 CalloutWidth = 12.000000000000000000 CalloutLength = 5.000000000000000000 end end object lytHour: TLayout Align = alClient Height = 383.999969482421900000 Width = 383.999938964843800000 object crectHour: TCalloutRectangle Fill.Color = claGoldenrod Height = 113.000000000000000000 Position.X = 188.000000000000000000 Position.Y = 80.000000000000000000 Stroke.Color = claNull Width = 8.000000000000000000 CalloutWidth = 12.000000000000000000 CalloutLength = 5.000000000000000000 end end object lytMinute: TLayout Align = alClient Height = 383.999969482421900000 RotationAngle = 30.000000000000000000 Width = 383.999938964843800000 object crectMinute: TCalloutRectangle Fill.Color = claGold Height = 161.000000000000000000 Position.X = 188.000000000000000000 Position.Y = 32.000000000000000000 Stroke.Color = claNull Width = 8.000000000000000000 CalloutWidth = 12.000000000000000000 CalloutLength = 5.000000000000000000 end end object lytHours: TLayout Align = alClient Height = 383.999969482421900000 Width = 383.999938964843800000 object rrecHours: TRoundRect Fill.Color = claBlack Height = 32.000000000000000000 Position.X = 187.000000000000000000 Position.Y = 25.000000000000000000 Width = 10.000000000000000000 end end object lytMinutes: TLayout Align = alClient Height = 383.999969482421900000 RotationAngle = 6.000000000000000000 Width = 383.999938964843800000 object rrecMinutes: TRoundRect Fill.Color = claPeru Height = 24.000000000000000000 Position.X = 188.000000000000000000 Position.Y = 25.000000000000000000 Stroke.Color = claNull Width = 8.000000000000000000 end end object cMiddle: TCircle Align = alCenter Fill.Color = claSienna Height = 50.000000000000000000 Stroke.Color = claNull Width = 24.000000000000000000 end end end object tmrSeconds: TTimer OnTimer = tmrSecondsTimer Left = 24 Top = 504 end end |
Pages : 1 2
Pings: Liens de l’épisode 4 de la saison 3 | Le Dev du Jeudi
Pings: Liens de l’épisode 2 de la saison 3 | Le Dev du Jeudi