58 lines
1,011 B
Text
58 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
|