CustomUI
This class is a graphics engine to help a user
generate custom UI form (window).
Visual Gene Developer provides 5 instances of
the class 'CustomUI': 'CustomUI', 'CustomUI2', 'CustomUI3',
'CustomUI4', 'CustomUI5'.
Each instance can operate a single
independent 'active Custom UI window'. Thus, a user can handle maximum
five 'active Custom UI windows' at the same time. For more details,
check
'Module development' section
o Canvas &
form
Module |
Description |
Sub
Define_Canvas (Width
As Integer,
Height
As Integer, Optional
ShowToolStrip
As Boolean) |
Open and define canvas
*ShowToolStrip:
If true, toolstrip menu will be shown (default value is true) |
Property
Form_Caption ()
As String |
Set form title |
Property
Form_Left ()
As Integer |
Set left |
Property
Form_Top ()
As Integer |
Set top |
Sub
Update_Canvas () |
Update canvas |
Sub
Make_Clone () |
Make duplicate clone and
active drawing form |
Sub
Form_BringToFront () |
Bring to front |
Sub
Show_Form () |
Show |
Sub
Hide_Form () |
Hide |
Property
RawData ()
As String |
Store text raw data for data
export |
o Color
Module |
Description |
Sub
Set_ForeColor_byRGB (Red_Value As Integer,
Green_Value As Integer, Blue_Value
As Integer,
Optional Alpha_Value As Integer) |
Set fore color. Given by RGB
as well as alpha value.
* Each
color channel can have value from 0 to 255
*
Alpha_value: Opacity |
Sub
Set_FillColor_byRGB (Red_Value As Integer,
Green_Value As Integer, Blue_Value
As Integer,
Optional Alpha_Value As Integer) |
Set fill color. Given by RGB
as well as alpha value.
* Each
color channel can have value from 0 to 255
*Alpha_value:
Opacity |
Sub
Set_ForeColor_byName (ColorName As String,
Optional Alpha_Value
As Integer) |
Set fore color. Given by
color name like "Black", "Yellow", "Red" Check
'System defined color' |
Sub
Set_FillColor_byName (ColorName As String,
Optional Alpha_Value
As Integer) |
Set fill color. Given by
color name like "Black", "Yellow", "Red" Check
'System defined color' |
o Text & Font
Module |
Description |
Sub
Set_Font (FontSize As Single,
Optional FontName
As String,
Optional Italic As Boolean,
Optional Bold
As Boolean, Optional
Underline As Boolean,
Optional Strikeout
As Boolean) |
Set font for text
*
FontName: Default name is "Microsoft Sans Serif"
*
Italic, Bold, Underline, Strikeout: Can be set to be True or
False |
Sub
DrawString (X As Integer, Y
As Integer, TextStr
As String,
Optional ForeColor_byName As String) |
Draw text string |
Sub
DrawOutlinedString (X As Integer, Y
As Integer, TextStr
As String,
Optional ForeColor_byName As String,
Optional OutlineColor_byName
As String) |
Draw outlined text string |
o Drawing
Module |
Description |
Sub
Clear_Canvas (Optional Color_byName
As String) |
Clear canvas
*
Color_byName: Given by string like "Black", "Yellow",
"Red" Check
'System defined color' |
Sub
DrawLine (X1 As Integer, Y1
As Integer, X2
As Integer, Y2
As Integer,
Optional ForeColor_byName As String) |
Draw single line
*
Forecolor_byName: Given by string like "Black", "Yellow", "Red"
Check 'System defined
color' |
Sub
DrawArc (X As Integer, Y
As Integer, Width
As Integer, Height
As Integer, StartAngle
As Single, SweepAngle
As Single,
Optional ByVal ForeColor_byName As
String) |
Draw arc |
Sub
DrawBezier(X1 As Integer, Y1
As Integer, X2
As Integer, Y2
As Integer, X3
As Integer, Y3
As Integer, X4
As Integer, Y4
As Integer,
Optional ForeColor_byName As String) |
Draw Bezier curve |
Sub
DrawPie (X As Integer, Y
As Integer, Width
As Integer, Height
As Integer, StartAngle
As Single, SweepAngle As Single,
Optional ForeColor_byName
As String) |
Draw pie |
Sub
DrawRectangle (X As Integer, Y
As Integer, Width
As Integer, Height
As Integer,
Optional ForeColor_byName As String) |
Draw rectable |
Sub
DrawEllipse (X As Integer, Y
As Integer, Width
As Integer, Height
As Integer,
Optional ForeColor_byName As String) |
Draw ellipse |
Sub
FillPie (X As Integer, Y
As Integer, Width
As Integer, Height
As Integer, StartAngle
As Single, SweepAngle
As Single,
Optional FillColor_byName As String) |
Draw filled pie
*
Fillcolor_byName: Given by string like "Black", "Yellow", "Red"
Check 'System defined
color' |
Sub
FillRectangle (X As Integer, Y
As Integer, Width
As Integer, Height
As Integer,
Optional FillColor_byName As String) |
Draw filled rectangle |
Sub
FillEllipse (X As Integer, Y
As Integer, Width
As Integer, Height
As Integer,
Optional FillColor_byName As String) |
Draw filled ellipse |
o System defined color
AliceBlue |
DarkBlue |
Firebrick |
LightBlue |
MediumPurple |
PaleVioletRed |
Snow |
AntiqueWhite |
DarkCyan |
FloralWhite |
LightCoral |
MediumSeaGreen |
PapayaWhip |
SpringGreen |
Aqua |
DarkGoldenrod |
ForestGreen |
LightCyan |
MediumSlateBlue |
PeachPuff |
SteelBlue |
Aquamarine |
DarkGray |
Fuchsia |
LightGoldenrodYellow |
MediumSpringGreen |
Peru |
Tan |
Azure |
DarkGreen |
Gainsboro |
LightGray |
MediumTurquoise |
Pink |
Teal |
Beige |
DarkKhaki |
GhostWhite |
LightGreen |
MediumVioletRed |
Plum |
Thistle |
Bisque |
DarkMagenta |
Gold |
LightPink |
MidnightBlue |
PowderBlue |
Tomato |
Black |
DarkOliveGreen |
Goldenrod |
LightSalmon |
MintCream |
Purple |
Turquoise |
BlanchedAlmond |
DarkOrange |
Gray |
LightSeaGreen |
MistyRose |
Red |
Violet |
Blue |
DarkOrchid |
Green |
LightSkyBlue |
Moccasin |
RosyBrown |
Wheat |
BlueViolet |
DarkRed |
GreenYellow |
LightSlateGray |
NavajoWhite |
RoyalBlue |
White |
Brown |
DarkSalmon |
Honeydew |
LightSteelBlue |
Navy |
SaddleBrown |
WhiteSmoke |
BurlyWood |
DarkSeaGreen |
HotPink |
LightYellow |
OldLace |
Salmon |
Yellow |
CadetBlue |
DarkSlateBlue |
IndianRed |
Lime |
Olive |
SandyBrown |
YellowGreen |
Chartreuse |
DarkSlateGray |
Indigo |
LimeGreen |
OliveDrab |
SeaGreen |
|
Chocolate |
DarkTurquoise |
Ivory |
Linen |
Orange |
SeaShell |
|
Coral |
DarkViolet |
Khaki |
Magenta |
OrangeRed |
Sienna |
|
CornflowerBlue |
DeepPink |
Lavender |
Maroon |
Orchid |
Silver |
|
Cornsilk |
DeepSkyBlue |
LavenderBlush |
MediumAquamarine |
PaleGoldenrod |
SkyBlue |
|
Crimson |
DimGray |
LawnGreen |
MediumBlue |
PaleGreen |
SlateBlue |
|
Cyan |
DodgerBlue |
LemonChiffon |
MediumOrchid |
PaleTurquoise |
SlateGray |
|
o Example 1
Function
Main()
'---- Define Canvas ------------------------
Call
CustomUI.Define_Canvas(420,55,False)
Call
CustomUI2.Define_Canvas(600,300)
Call
CustomUI.Clear_Canvas
Call
CustomUI2.Clear_Canvas
CustomUI2.Form_BringToFront
CustomUI.Form_BringToFront
CustomUI.Form_Caption="Status"
CustomUI2.Form_Caption="my
Graphics"
'Optional
CustomUI.Form_Left=CustomUI2.Form_Left
+ 60
CustomUI.Form_Top=CustomUI2.Form_Top
+ 100
'---- Demo: Basic drawing ------------------------
Call
CustomUI2.FillRectangle(30,30,100,100,"Red")
Call
CustomUI2.FillEllipse(130,130,100,150,"Blue")
Call
CustomUI2.DrawArc(100,100,100,100,0,180,"Red")
Call
CustomUI2.DrawPie(250,100,100,100,0,180,"Red")
Call
CustomUI2.FillPie(400,100,100,100,0,180,"Blue")
Call
CustomUI2.DrawBezier(100,100,100,200,300,300,500,100,"Magenta")
'----- Demo: Random drawing of lines
-----------------------------------------------------------------
For
q=1 to 400
Randomize
Call
CustomUI.Drawline(q+10,10,q+10,40,"Blue")
Call
CustomUI2.Set_ForeColor_ByRGB(Rnd(1)*255,Rnd(1)*255,Rnd(1)*255)
Call
CustomUI2.Drawline(Rnd(1)*450,Rnd(1)*400,Rnd(1)*450,Rnd(1)*400)
Call
CustomUI.Update_Canvas
Call
CustomUI2.Update_Canvas
Next
'---- Demo: Text --------------------------------------
Call
CustomUI2.Set_Font(15)
Call
CustomUI2.DrawString(430,100,"Visual
Gene Developer","Magenta")
Call
CustomUI2.Set_Font(25,,,True)
Call
CustomUI2.DrawOutlinedString(250,120,"Integrated
graphic system","Yellow","Black")
Call
CustomUI.Update_Canvas
Call
CustomUI2.Update_Canvas
'---- Store
RawData --------------------------
CustomUI2.RawData="This
is test......" + Chr(13)+Chr(10)+"Visual Gene Developer"
'---- Finalize and Close --------------------------
CustomUI.Hide_Form
CustomUI2.Make_Clone
End Function
|
|