gambas-source-code/app/examples/Image/PhotoTouch/.src/FResize.class
Benoît Minisini c6a9cd69c2 [EXAMPLES]
* NEW: Add examples again. I hope correctly this time.


git-svn-id: svn://localhost/gambas/trunk@6726 867c0c6c-44f3-4631-809d-bfa615b0a4ec
2014-12-12 19:58:52 +00:00

57 lines
1,011 B
Text

' Gambas class file
Private $aSize As Float[] = [1 / 4, 1 / 3, 1 / 2, 2 / 3, 3 / 4, 1]
Private btnApply As CButton
Public Sub sldResize_Change()
Dim W, H As Integer
With FMain.GetCurrentImage()
W = .W * $aSize[sldResize.Value]
H = .H * $aSize[sldResize.Value]
End With
lblSize.Text = Format($aSize[sldResize.Value], "0%") & " - " & W & " x " & H
End
Public Sub _new()
btnApply = New CButton(Me) As "btnApply"
btnApply.Move(Me.W - 48 - Desktop.Scale * 2, Desktop.Scale * 2, 48, 48)
btnApply.Image = Image.Load("ok.png")
End
Public Sub Form_Open()
Me.Center
sldResize.SetFocus
sldResize_Change
End
Public Sub btnApply_Click()
Dim W, H As Integer
With FMain.GetCurrentImage()
W = .W * $aSize[sldResize.Value]
H = .H * $aSize[sldResize.Value]
End With
FMain.Stretch(W, H)
End
Public Sub Form_KeyPress()
If Key.Code = Key.Enter Or If Key.Code = Key.Return Then
btnApply_Click
Stop Event
Return
Endif
FMain.Form_KeyPress
End