' Gambas class file Private picHour As Image Private picMinute As Image Private picSecond As Image Private Clock As Image Private Buffer As Picture Private HE As Integer Private WI As Integer 'PRIVATE BackPicture AS String Private $MX As Integer Private $MY As Integer Private $hMenu As Menu Public Sub DrawTime() Dim tmpImg As Image 'Dim hPict As Picture Dim hPict As Image Dim I As Integer WI = Clock.Width HE = Clock.Height ' hPict = Clock.Picture ' Draw.Begin(hPict) ' tmpImg = picHour.Rotate(- Hour(Now) * Pi(2 / 12)) ' Draw.Image(tmpImg, WI / 2 - tmpImg.Width / 2, HE / 2 - tmpImg.Height / 2) ' tmpImg = picMinute.Rotate(- Minute(Now) * Pi(2 / 60)) ' Draw.Image(tmpImg, WI / 2 - tmpImg.Width / 2, HE / 2 - tmpImg.Height / 2) ' tmpImg = picSecond.Rotate(- Second(Now) * Pi(2 / 60)) ' Draw.Image(tmpImg, WI / 2 - tmpImg.Width / 2, HE / 2 - tmpImg.Height / 2) ' Draw.End ' ' Me.Picture = hPict 'hPict = New Image(Clock.W, Clock.H, Color.Transparent) 'hPict.Draw(Clock, 0, 0) hPict = Clock.Copy() 'Draw.Begin(hPict) 'tmpImg = picHour.Rotate(- Hour(Now) * Pi(2 / 12)) tmpImg = picHour.Rotate(- ((Hour(Now) * 60) + Minute(Now)) * Pi(1 / 360)) hPict.PaintImage(tmpImg, WI / 2 - tmpImg.Width / 2, HE / 2 - tmpImg.Height / 2) tmpImg = picMinute.Rotate(- Minute(Now) * Pi(2 / 60)) hPict.PaintImage(tmpImg, WI / 2 - tmpImg.Width / 2, HE / 2 - tmpImg.Height / 2) tmpImg = picSecond.Rotate(- Second(Now) * Pi(2 / 60)) hPict.PaintImage(tmpImg, WI / 2 - tmpImg.Width / 2, HE / 2 - tmpImg.Height / 2) 'Draw.End Me.Picture = hPict.Picture 'Me.Mask = Not mnuShowWindow.Value End Private Sub SetClock(iClock As Integer) Dim hImage As Image Dim hBuffer As Image Dim hMenu As Menu Dim X, Y As Integer Dim iColor As Integer Dim iGray As Integer hImage = Image.Load("img/clock_bg_big" & iClock & ".png") ' hBuffer = NEW Image(hImage.Width + 2, hImage.Height + 2, TRUE) ' hBuffer.Draw(hImage, 1, 0) ' hBuffer.Draw(hImage, 1, 2) ' hBuffer.Draw(hImage, 0, 1) ' hBuffer.Draw(hImage, 2, 1) ' ' FOR X = 0 TO hImage.Width - 1 ' FOR Y = 0 TO hImage.Height - 1 ' iColor = hBuffer[X, Y] ' iGray = &H80 'Color[iColor].Value ' iColor = Color.RGB(iGray, iGray, iGray, Color[iColor].Alpha) ' hBuffer[X, Y] = iColor ' NEXT ' NEXT ' ' hBuffer.Draw(hImage, 1, 1) ' hImage = hBuffer Clock = hImage '.Picture DrawTime For Each hMenu In mnuPopup.Children If hMenu.Tag Then hMenu.Checked = Val(hMenu.Tag) = iClock Endif Next End Public Sub Form_Open() picMinute = Image.Load("img/arrow_min.png") picHour = Image.Load("img/arrow_hour.png") picSecond = Image.Load("img/arrow_sec.png") SetClock(3) Timer1.Enabled = True End Public Sub Timer1_Timer() DrawTime() End Public Sub Form_Menu() mnuPopup.Popup End Public Sub mnuClock_Click() SetClock(Val(Last.Tag)) End Public Sub mnuQuit_Click() Me.Close End Public Sub mnuAbout_Click() Message("This exemple was made by Fabien BODARD\nand was optimized by BenoƮt MINISINI\n\nNote that the 3rd clock is Microsoft copyrighted.\nYou will find it on the future version of windows.") End Public Sub Form_MouseDown() $MX = Mouse.ScreenX - Me.X $MY = Mouse.ScreenY - Me.Y End ' Public Sub Form_MouseMove() If Mouse.Left Then Me.Move(Mouse.ScreenX - $MX, Mouse.ScreenY - $MY) End Public Sub mnuOntop_Click() 'mnuOnTop.Checked = Not mnuOntop.Checked Me.TopOnly = Not Me.TopOnly End Public Sub mnuShowWindow_Click() 'mnuShowWindow.Checked = Not mnuShowWindow.Checked 'ME.Border = If(mnuShowWindow.Checked, Window.Fixed, Window.None) Me.Mask = Not mnuShowWindow.Value Me.SkipTaskbar = Not mnuShowWindow.Value Me.Border = mnuShowWindow.Value End