examples: Drawing: improve i18n and fix RandomColorSort
This commit is contained in:
parent
4d5cf06fae
commit
af356974f4
@ -52,7 +52,7 @@ Public Sub DrawClock()
|
||||
Paint.Font.Bold = True
|
||||
Paint.Font.Size = 60
|
||||
Paint.Brush = Paint.Color(Color.Black)
|
||||
Paint.Text(sTime, - W / 2, - H * 0.4, W, H * 0.1, Align.Top)
|
||||
Paint.Text(sTime, -W / 2, -H * 0.4, W, H * 0.1, Align.Top)
|
||||
Paint.Fill
|
||||
|
||||
' Draw seconds
|
||||
@ -69,8 +69,8 @@ Public Sub DrawClock()
|
||||
|
||||
Paint.Brush = Paint.Color(Color.SetAlpha(Color.Black, 128))
|
||||
Paint.MoveTo(Cos(angle) * W * 0.45, Sin(angle) * H * 0.45)
|
||||
Paint.LineTo(Sin(angle) * W * 0.05, - Cos(angle) * H * 0.05)
|
||||
Paint.LineTo(- Sin(angle) * W * 0.05, Cos(angle) * H * 0.05)
|
||||
Paint.LineTo(Sin(angle) * W * 0.05, -Cos(angle) * H * 0.05)
|
||||
Paint.LineTo(-Sin(angle) * W * 0.05, Cos(angle) * H * 0.05)
|
||||
Paint.Fill
|
||||
|
||||
' Draw hours
|
||||
@ -78,8 +78,8 @@ Public Sub DrawClock()
|
||||
|
||||
Paint.Brush = Paint.Color(Color.SetAlpha(Color.Black, 128))
|
||||
Paint.MoveTo(Cos(angle) * W * 0.35, Sin(angle) * H * 0.35)
|
||||
Paint.LineTo(Sin(angle) * W * 0.05, - Cos(angle) * H * 0.05)
|
||||
Paint.LineTo(- Sin(angle) * W * 0.05, Cos(angle) * H * 0.05)
|
||||
Paint.LineTo(Sin(angle) * W * 0.05, -Cos(angle) * H * 0.05)
|
||||
Paint.LineTo(-Sin(angle) * W * 0.05, Cos(angle) * H * 0.05)
|
||||
Paint.Fill
|
||||
|
||||
' Draw circle on the center of the clock to hide the arms intersection
|
||||
@ -119,7 +119,7 @@ End
|
||||
Public Sub MenuAbout_Click()
|
||||
|
||||
Dim AboutMessage As String
|
||||
AboutMessage = "Analog Clock Example Program for Gambas\nWritten by: Ahmad Kamal <eng_ak@Link.Net> and Benoît Minisini"
|
||||
AboutMessage = ("Analog Clock Example Program for Gambas\nWritten by: Ahmad Kamal <eng_ak@Link.Net> and Benoît Minisini")
|
||||
|
||||
Message.info(AboutMessage)
|
||||
|
||||
|
@ -63,24 +63,24 @@
|
||||
Border = Border.Sunken
|
||||
}
|
||||
{ HBox1 HBox
|
||||
MoveScaled(1,56,69,5)
|
||||
MoveScaled(1,56,104,5)
|
||||
Spacing = True
|
||||
{ btnRun Button
|
||||
MoveScaled(0,0,19,4)
|
||||
MoveScaled(0,0,25.1429,4)
|
||||
Text = ("&Refresh Barcode")
|
||||
Default = True
|
||||
}
|
||||
{ btnPrint Button
|
||||
MoveScaled(20,0,19,4)
|
||||
MoveScaled(26,0,25,4)
|
||||
Visible = False
|
||||
Text = ("&Print Barcode")
|
||||
}
|
||||
{ btnAbout Button
|
||||
MoveScaled(40,0,11,4)
|
||||
MoveScaled(52,0,25.1429,4)
|
||||
Text = ("About...")
|
||||
}
|
||||
{ btnExit Button
|
||||
MoveScaled(52,0,11,4)
|
||||
MoveScaled(78,0,25.1429,4)
|
||||
Text = ("E&xit")
|
||||
Cancel = True
|
||||
}
|
||||
|
@ -101,12 +101,12 @@ End
|
||||
Public Sub btnAbout_Click()
|
||||
|
||||
Dim i As String
|
||||
i = "<h2>Example to make bar chart</h2>\n"
|
||||
i = i & "This example has made by : " & Chr(10)
|
||||
i = ("<h2>Example to make bar chart</h2>\n")
|
||||
i = i & ("This example has made by : ") & Chr(10)
|
||||
i = i & " Yudi Astira" & Chr(10)
|
||||
i = i & " yudi@kecoak.or.id" & Chr(10)
|
||||
i = i & " necrose #hdteam on Dal.Net" & Chr(10)
|
||||
i = i & "Thank You"
|
||||
message.Info(i, "&Close")
|
||||
i = i & ("Thank You")
|
||||
message.Info(i, ("&Close"))
|
||||
|
||||
End
|
||||
|
@ -6,7 +6,7 @@
|
||||
Text = ("Example to make a Bar Chart")
|
||||
Resizable = False
|
||||
{ bg PictureBox
|
||||
MoveScaled(1,1,70.1667,43.1667)
|
||||
MoveScaled(1,1,70.1429,43.1429)
|
||||
Background = &HFFFFFF&
|
||||
Border = Border.Plain
|
||||
}
|
||||
@ -16,16 +16,16 @@
|
||||
Cached = True
|
||||
}
|
||||
{ btnClose Button
|
||||
MoveScaled(56,45,15,5)
|
||||
MoveScaled(50,45,21,5)
|
||||
Text = ("&Close")
|
||||
}
|
||||
{ btnAbout Button
|
||||
MoveScaled(39.6667,45,15,5)
|
||||
MoveScaled(1,45,21,5)
|
||||
Text = ("&About")
|
||||
Picture = Picture["graph.png"]
|
||||
}
|
||||
{ TextLabel1 TextLabel
|
||||
MoveScaled(2,2,4,3.5)
|
||||
MoveScaled(2,2,4,3.5714)
|
||||
Background = &HFFFFFF&
|
||||
Text = ("(%)")
|
||||
}
|
||||
|
@ -41,11 +41,11 @@ Public Sub DrawTime()
|
||||
|
||||
'Draw.Begin(hPict)
|
||||
'tmpImg = picHour.Rotate(- Hour(Now) * Pi(2 / 12))
|
||||
tmpImg = picHour.Rotate(- ((Hour(Now) * 60) + Minute(Now)) * Pi(1 / 360))
|
||||
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))
|
||||
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))
|
||||
tmpImg = picSecond.Rotate(-Second(Now) * Pi(2 / 60))
|
||||
hPict.PaintImage(tmpImg, WI / 2 - tmpImg.Width / 2, HE / 2 - tmpImg.Height / 2)
|
||||
'Draw.End
|
||||
|
||||
@ -134,7 +134,7 @@ 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.")
|
||||
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
|
||||
|
||||
|
@ -119,7 +119,7 @@ End
|
||||
|
||||
Public Sub btnAbout_Click()
|
||||
|
||||
Message.Info("<h2>Gnu Scientific Library example</h2>Made by <b>Juergen Zdero</b> (juergen@zdero.eu) and <b>Benoît Minisini</b> (gambas@users.sourceforge.net)")
|
||||
Message.Info(("<h2>Gnu Scientific Library example</h2>Made by <b>Juergen Zdero</b> (juergen@zdero.eu) and <b>Benoît Minisini</b> (gambas@users.sourceforge.net)"))
|
||||
|
||||
End
|
||||
|
||||
|
@ -17,12 +17,12 @@
|
||||
MoveScaled(2,41,87,6)
|
||||
Spacing = True
|
||||
{ btnCubicSpline Button
|
||||
MoveScaled(0,0,19,6)
|
||||
MoveScaled(0,0,21,6)
|
||||
Text = ("Cubic &spline")
|
||||
Picture = Picture["icon:/medium/pen"]
|
||||
}
|
||||
{ btnClear Button
|
||||
MoveScaled(20,0,18,6)
|
||||
MoveScaled(22,0,21,6)
|
||||
Text = ("&Clear")
|
||||
Picture = Picture["icon:/medium/erase"]
|
||||
}
|
||||
@ -31,12 +31,12 @@
|
||||
Expand = True
|
||||
}
|
||||
{ btnAbout Button
|
||||
MoveScaled(50,0,15,6)
|
||||
MoveScaled(44,0,21,6)
|
||||
Text = ("About...")
|
||||
Picture = Picture["icon:/medium/info"]
|
||||
}
|
||||
{ btnClose Button
|
||||
MoveScaled(66,0,15,6)
|
||||
MoveScaled(66,0,21,6)
|
||||
Text = ("Close")
|
||||
Picture = Picture["icon:/medium/close"]
|
||||
Cancel = True
|
||||
|
@ -6,7 +6,7 @@
|
||||
Const cFormWidth As Integer = 927 'Form size.
|
||||
Const cFormHeight As Integer = 800
|
||||
|
||||
Const cChartWidthHeight As Integer = 783 'Color chart size, width and height.
|
||||
Const cChartWidthHeight As Integer = 315 'Color chart size, width and height.
|
||||
Const cInset As Integer = 50 'Width of border around chart.
|
||||
Const cCircleRadius As Integer = 15 'Radius, in pixels, of color circles.
|
||||
|
||||
@ -38,8 +38,8 @@ Public Sub _new()
|
||||
.Height = cChartWidthHeight
|
||||
End With
|
||||
|
||||
pnlControls.X = cChartWidthHeight + 20 'Position panel 20 pixels to the right of the display area control.
|
||||
pnlControls.Y = (cChartWidthHeight - pnlControls.Height) \ 2 'Vertically center the panel on the form.
|
||||
'pnlControls.X = cChartWidthHeight + 20 'Position panel 20 pixels to the right of the display area control.
|
||||
'pnlControls.Y = (cChartWidthHeight - pnlControls.Height) \ 2 'Vertically center the panel on the form.
|
||||
|
||||
scrColorCount.Value = 9 'The initial number of colors to display is 2^9 = 512 colors.
|
||||
|
||||
@ -110,7 +110,7 @@ End
|
||||
|
||||
Private Function YY(bt As Single) As Integer 'Convert b color coordinate into vertical screen coordinate.
|
||||
|
||||
Return (- (cChartWidthHeight - 2 * cInset) * bt + cChartWidthHeight) * 0.5
|
||||
Return (-(cChartWidthHeight - 2 * cInset) * bt + cChartWidthHeight) * 0.5
|
||||
|
||||
End
|
||||
|
||||
@ -180,7 +180,7 @@ Private Function DrawChartAxes()
|
||||
'.Text("L", XX(T * Cos(Rad(120.0))), YY(T * Sin(Rad(120.0))), 1, 1, 3) 'Lime. Yellowish green. Not a standard hue.
|
||||
.Text("G", XX(T * Cos(Rad(150.0))), YY(T * Sin(Rad(150.0))), 1, 1, 3) 'Green
|
||||
.Text("C", XX(T * Cos(Rad(210.0))), YY(T * Sin(Rad(210.0))), 1, 1, 3) 'Cyan
|
||||
.Text("B", XX(0), YY(- T), 1, 1, 3) 'Blue. This is computer display blue, which is slightly violet.
|
||||
.Text("B", XX(0), YY(-T), 1, 1, 3) 'Blue. This is computer display blue, which is slightly violet.
|
||||
'.Text("BB", XX(T * Cos(Rad(240.0))), YY(T * Sin(Rad(240.0))), 1, 1, 3) 'Baby Blue, sky blue. This is what many people think of as blue.
|
||||
.Text("V", XX(T * Cos(Rad(300.0))), YY(T * Sin(Rad(300.0))), 1, 1, 3) 'Violet
|
||||
.Text("M", XX(T * Cos(Rad(330.0))), YY(T * Sin(Rad(330.0))), 1, 1, 3) 'Magenta
|
||||
@ -216,7 +216,7 @@ Public Sub btnSave_Click()
|
||||
picChart.Save(Dialog.Path) 'Save picture to file.
|
||||
|
||||
Catch
|
||||
Message.Warning("Could not save image\n\n\t" & Dialog.Path & "\n \n" & Error.Text & ". Be sure to end the filename with the .png extension!")
|
||||
Message.Warning(("Could not save image") & "\n\n\t" & Dialog.Path & "\n \n" & Error.Text & ". " & ("Be sure to end the filename with the .png extension!"))
|
||||
|
||||
End
|
||||
|
||||
|
@ -11,45 +11,45 @@
|
||||
Border = Border.Plain
|
||||
}
|
||||
{ pnlControls Panel
|
||||
MoveScaled(28,1,14,66)
|
||||
MoveScaled(47,1,26,83)
|
||||
Background = &HFFFFFF&
|
||||
Border = Border.Plain
|
||||
{ btnSave Button
|
||||
MoveScaled(2,55,10,4)
|
||||
MoveScaled(2,55,22,4)
|
||||
ToolTip = ("Create PNG File of Current Image")
|
||||
Text = ("Save")
|
||||
}
|
||||
{ chkAxes CheckBox
|
||||
MoveScaled(3,2,8,3)
|
||||
MoveScaled(3,2,22,3)
|
||||
Text = ("Hues")
|
||||
}
|
||||
{ btnQuit Button
|
||||
MoveScaled(2,60,10,4)
|
||||
MoveScaled(2,60,22,4)
|
||||
ToolTip = ("Esc Key Exits Too")
|
||||
Text = ("Exit")
|
||||
Cancel = True
|
||||
}
|
||||
{ btnReDo Button
|
||||
MoveScaled(2,50,10,4)
|
||||
MoveScaled(2,50,22,4)
|
||||
ToolTip = ("Redraw the Colors")
|
||||
Text = ("Repeat")
|
||||
}
|
||||
{ Label1 Label
|
||||
MoveScaled(4,10,6,3)
|
||||
MoveScaled(1,10,24,3)
|
||||
Text = ("Count")
|
||||
Alignment = Align.Center
|
||||
}
|
||||
{ lblColorCount Label
|
||||
MoveScaled(4,46,6,3)
|
||||
MoveScaled(10,46,6,3)
|
||||
Text = ("2")
|
||||
Alignment = Align.Center
|
||||
}
|
||||
{ chkDelay CheckBox
|
||||
MoveScaled(3,5,8,3)
|
||||
MoveScaled(3,5,22,3)
|
||||
Text = ("Slow")
|
||||
}
|
||||
{ scrColorCount Slider
|
||||
MoveScaled(5,13,4,33)
|
||||
MoveScaled(11,13,4,33)
|
||||
ToolTip = ("Change the Number of Colors")
|
||||
MinValue = 1
|
||||
MaxValue = 15
|
||||
|
@ -38,7 +38,7 @@ Private Sub PaintStroke(hDest As Picture)
|
||||
Paint.Begin(hTemp)
|
||||
Paint.LineCap = Paint.LineCapRound
|
||||
Paint.Brush = Paint.Color($iColor)
|
||||
Paint.Translate(- $hBound.X, - $hBound.Y)
|
||||
Paint.Translate(-$hBound.X, -$hBound.Y)
|
||||
|
||||
For I = 0 To $aCoord.Max - 3 Step 3
|
||||
|
||||
@ -66,7 +66,7 @@ Public Sub dwgDraw_Draw()
|
||||
hDraw = $hBuffer.Copy()
|
||||
PaintStroke(hDraw)
|
||||
|
||||
Draw.Picture(hDraw, - dwgDraw.ScrollX, - dwgDraw.ScrollY)
|
||||
Draw.Picture(hDraw, -dwgDraw.ScrollX, -dwgDraw.ScrollY)
|
||||
|
||||
End
|
||||
|
||||
@ -76,13 +76,13 @@ Private Sub UpdateInfo(Optional bUp As Boolean)
|
||||
|
||||
Select Case Pointer.Type
|
||||
Case Pointer.Cursor
|
||||
lblType.Text = "Cursor"
|
||||
lblType.Text = ("Cursor")
|
||||
Case Pointer.Eraser
|
||||
lblType.Text = "Eraser"
|
||||
lblType.Text = ("Eraser")
|
||||
Case Pointer.Mouse
|
||||
lblType.Text = "Mouse"
|
||||
lblType.Text = ("Mouse")
|
||||
Case Pointer.Pen
|
||||
lblType.Text = "Pen"
|
||||
lblType.Text = ("Pen")
|
||||
End Select
|
||||
|
||||
lblX.Text = Format($X, "0.000")
|
||||
|
Loading…
x
Reference in New Issue
Block a user