
授人以渔,不授人以鱼。
程序代码:Clear All
Set Talk Off
Set Decimals To 4
Public bdr_Width as Integer
bdr_width = 2
Public btn_array[4]
btn_array[1] = CreateObject("C_Struct", "V", "V-y图", "X Scale = ")
btn_array[2] = CreateObject("C_Struct", "U", "U-y图", "Y Scale = ")
btn_array[3] = CreateObject("C_Struct", "E", "E-y图", "Increase = ")
btn_array[4] = CreateObject("C_Struct", "q", "退出", "")
Main()
Clear All
Return
Define Class C_Struct as Custom
ID = ""
cpn_button = ""
cpn_label = ""
Procedure Init(tc_ID, tc_cpn_button , tc_cpn_label )
With This
.ID = tc_ID
.cpn_button = tc_cpn_button
.cpn_label = tc_cpn_label
EndWith
EndProc
EndDefine
Define Class C_Button as CommandButton
Width = 59
Height = 25
Key = ""
Procedure Init(Key_t)
With This
.Key = Key_t
.Caption = .Key.cpn_button
EndWith
EndProc
Procedure Click
With this
Do Case
Case .key.ID == "q"
Clear Events
EndCase
EndWith
EndProc
EndDefine
Define Class C_Label as Label
Width = 70
Height = 25
Key = ""
Procedure Init(Key_t)
With This
.Key = Key_t
.Caption = .Key.cpn_label
EndWith
EndProc
EndDefine
Procedure Main()
Local loMainForm
loMainForm = CreateObject("C_Form")
loMainForm.Show
Read EVENTS
Return
EndProc
Define Class C_Form as Form
movable = .T.
TitleBar = 0
BackColor = RGB(107, 173, 246)
Add Object Title1 as Label with ;
Caption = "函数图像",;
Top = 8, Left = 8,;
AutoSize = .T.,;
FontBold = 1, FontSize = 12,;
FontName = "楷体", BackStyle = 0
Add Object Body as Container with ;
Top = 30, left = bdr_width, Width = 600, ;
Height = 410, BackStyle = 0
Add Object image1 as Image with ;
Top = 38,;
Left = 400,;
Height = 78,;
Width = 198,;
Picture = "c:\documents and settings" + ;
"\administrator\my documents\my pictures\0.jpg"
Procedure Body.Init
For i = 1 to Alen(btn_array, 1)
lo_name = "button" + Transform(i)
This.AddObject(lo_name, "C_Button", btn_array[i])
With this.&lo_name
.Top = 370
.Left = 330 + (i - 1) * 60
EndWith
If i # 4
lo_name = "label" + Transform(i)
This.AddObject(lo_name, "C_Label", btn_array[i])
With THis.&lo_name
.Top = 3 + (i - 1) * 20
.Left = 5
EndWith
lo_name = "Text" + Transform(i)
This.AddObject(lo_name, "TextBox")
With THis.&lo_name
.Top = 3 + (i - 1) * 20
.Left = 75
.Height = 20
.Width = 60
EndWith
endif
This.Setall("Visible", .T.)
This.SetAll("BackStyle", 0)
Next
This.AddObject("Y", "Line")
With This.Y
.Top = 300
.Width = 600
.Height = 0
.Visible = .T.
EndWith
This.AddObject("V", "Line")
With This. V
.Top = 0
.Left = 200
.Width = 0
.Height = 410
.Visible = .T.
EndWith
This.AddObject("V1", "Line")
With This. V1
.Top = 0
.Left = 200
.Width = 10
.Height =10
.Visible = .T.
EndWith
This.AddObject("V2", "Line")
With This. V2
.Top = 0
.Left = 190
.Width = 10
.Height = 10
.LineSlant = '/'
.Visible = .T.
EndWith
This.AddObject("Y1", "Line")
With This. Y1
.Top = 290
.Left = 590
.Width = 10
.Height =10
.Visible = .T.
EndWith
This.AddObject("Y2", "Line")
With This. Y2
.Top = 300
.Left = 590
.Width = 10
.Height = 10
.LineSlant = '/'
.Visible = .T.
EndWith
This.AddObject("原点", "Label")
With This.原点
.Top = 305
.Left = 180
.Caption = "0"
.BackStyle = 0
.FontSize = 14
.AutoSize = .T.
.Visible = .T.
EndWith
This.AddObject("V轴", "Label")
With This.V轴
.Top = 15
.Left = 180
.Caption = "v"
.BackStyle = 0
.FontSize = 14
.AutoSize = .T.
.Visible = .T.
EndWith
This.AddObject("Y轴", "Label")
With This.Y轴
.Top = 305
.Left = 580
.Caption = "y"
.BackStyle = 0
.FontSize = 14
.AutoSize = .T.
.Visible = .T.
EndWith
EndProc
Procedure Init
With this
.Width = .Body.Width + bdr_width * 2
.Height = .Body.Height + .Body.Top + bdr_width
.Top = 50
.Left = 100
EndWith
EndProc
EndDefine 