Private Declare Function OSWinHelp% Lib "user32" Alias "WinHelpA" (ByVal hwnd&, ByVal HelpFile$, ByVal wCommand%, dwData As Any)
请知道的讲解一下它的功能是什么 每个参数都是什么意思。。。。。谢谢
winDOWS的帮助API吧。在百度上搜一下吧。。
[此贴子已经被作者于2006-8-8 11:53:33编辑过]
恩 我给一个例子,自己看吧。。
Private Declare Function OSWinHelp% Lib"user32"Alias"WinHelpA"(ByVal hωnd&,ByVal HelpFile$, ByVal wCommand%, dwData As Any)
Private Sub Command1_Click()
Dim b(), bi(),bs(), BT(), m(4, 4), mt(), vt(), ω(4, 4), ωb(4, 4), ωbt(), ωt(), uo(), u(1, 4),PB(), pbb(), pp(), Tzdc(4, 4)
Dim ωi As Integer
‘从文本框中读取参数,多边形顶点坐标值到相应的数组.
u1 = Val(Text1)
u2 = Val(Text2)
N = Val(Text3)
ReDim uo(1, N)
For i = 0 To N
uo(1, i) = u1 + ((u2 - u1) * i) / N
Next i
If WBLN = False Then
ReDim bi(4, 4, 1), p(2, N, 1), b(4, 4)
For i = 0 To 3
bi(1, i + 1, 1) = Val(Tbx(i))
bi(2, i + 1, 1) = Val(Tby(i))
Next i
End If
If YLBLN = False Then
wi = 1
Else
If WBLN = False Then
'//////非有理
ReDim w(1, 4)
For i = 0 To 3
w(1, i + 1) = Val(tw(i))
Next i
End If
End If
'/////////
For i = 1 To 4
For j = 1 To 4
Tzdc(i, j) = 0
Next j
Next i
Tzdc(1,1)=0.7071:Tzdc(1,2)=0.4082:Tzdc(2,2)=0.8165
Tzdc(3,1)=0.7071:Tzdc(3,2)=-0.4082:Tzdc(4,4)=1
Rem设定M矩阵.
Select Case selectN
‘在曲线菜单上选择Bezier有理或非有理子菜单,对应执行CASE O或CASE 1.
Case 0:'//曲线——Bezier_有理
'/////////////////
‘首先设定绘图参数.
k1 = bi(1, 1, 1)
k2 = bi(2, 1, 1)
For k = 1 To 4
If bi(1,k, 1) > k1 Then k1 = bi(1, k, 1)
If bi(2,k, 1) > k2 Then k2 = bi(2, k, 1)
Next k
x2=1.2*k1
y2=1.2*k2
Pic.Scale(-x2/5,-y2/5)-(x2,y2)
Pic.Line(0,0)-(0,y2*0.9)
Pic.Line(0,y2*0.9)-(x2*0.8,y2*0.9)
Pic.DrawWidth=4
For i=1 To 4
Pic.PSet(bi(1,i,1),y2-bi(2,i,1)),vbRed
Next i
Pic.DrawWidth=1
Pic.CurrentX=bi(1,1,1)
Pic.CurrentY=y2-bi(2,1,1)
For i=2 To 4
Pic.Line-(bi(1,i,1),y2-bi(2,i,1)),vbBlack
Next I
'b/////////////
‘由读取的参数,多边形顶点坐标值,权因子值等计算模拟曲线上点的坐标值.
For IB = 1 To 2
For IA = 0 To N
ua = uo(1, IA)
For ii = 1 To 4
u(1, ii) = ua ^ (4 - ii)
Next ii
Call ZZ(w, 1, 4, wt)
For i = 1 To 4
b(1, i) = bi(IB, i, 1)
Next i
For i = 1 To 4
wb(1, i) = w(1, i) * b(1, i)
Next i
Call ZZ(wb, 1, 4, wbt)
Call JZji(u, 1, 4, m, 4, 4, nj)
Call JZji(nj, 1, 4, wbt, 4, 1, pp)
Call JZji(nj, 1, 4, wt, 4, 1, PB)
If PB(1, 1) = 0 Then p(IB, IA, 1) = 0
Else
p(IB, IA, 1) = pp(1, 1) / PB(1, 1)
End If
Next IA
Next IB
‘由绘图命令画出多边形和模拟的曲线.
Pic.DrawWidth = 1
For i = 0 To N - 1
Pic.CurrentX = p(1, i, 1)
Pic.CurrentY = y2 - p(2, i, 1)
Pic.Line -(p(1, i + 1, 1), y2 - p(2, i + 1, 1)), vbBlue
Next I
‘把模拟曲线上点的坐标值存入文本中,便于管理.
Open "T21.TXT" For Output As #1
For k = 0 To N
Print #1, p(1, k, 1); " "; p(2, k, 1)
Print #1,".............................."
Next k
Close #1
Case 1: '//曲线——Bezier_非有理.
‘首先设定绘图参数.
For IB = 1 To 2
For IA = 0 To N
ua = uo(1, IA)
For ii = 1 To 4
u(1, ii) = ua ^ (4 - ii)
Next ii
For i = 1 To 4
b(1, i) = bi(IB, i, 1)
Next i
Call ZZ(b, 1, 4, wbt)
Call JZji(u, 1, 4, m, 4, 4, nj)
Call JZji(nj, 1, 4, wbt, 4, 1, pp)
p(IB, IA, 1) = pp(1, 1)
Next IA
Next IB
Pic.DrawWidth = 1
For i = 0 To N - 1
Pic.CurrentX = p(1, i, 1)
Pic.CurrentY = y2 - p(2, i, 1)
Pic.Line -(p(1, i + 1, 1), y2 - p(2, i + 1, 1)), vbYellow
Next i
Open "T12.TXT" For Output As #1
For k = 0 To N
Print #1, p(1, k, 1); " "; p(2, k, 1)
Print #1,"..............................."
Next k
Close #1
End Select
End Sub
‘对Bezier非有理进行参数设置.
Private Sub NYL1_Click()
WBLN = False
YLBLN = False
selectN = 1
Fra.Visible = True
lx = frmMain.Width
ly = frmMain.Height
Pic.Move 0.5 * lx, 0.06 * ly, 0.45 * lx, 0.8 * ly
For i = 0 To 4
'Frl(i).Enabled = False
Next i
For i = 0 To 3
Tbz(i).Enabled = False
Next i
For i = 1 To 3
Frame4(i).Enabled = False
Next i
For i = 0 To 3
Tbx(i).Enabled = True
Tby(i).Enabled = True
Next
End Sub
'对Bezier有理进行参数设置.
Private Sub YL1_Click()
WBLN = False
YLBLN = True
selectN = 0
Fra.Visible = True
lx = frmMain.Width
ly = frmMain.Height
Pic.Move 0.5 * lx, 0.06 * ly, 0.45 * lx, 0.8 * ly
For i = 0 To 3
'Frl(i).Enabled = False
Next i
For i = 0 To 3
Tbz(i).Enabled = False
Next i
For i = 1 To 3
Frame4(i).Enabled = False
Next i
For i = 0 To 3
tw(i).Enabled = True
Tbx(i).Enabled = True
Tby(i).Enabled = True
Tbz(i).Enabled = False
Next
End Sub
'以下是矩阵运算子模块.
Public fMainForm As frmMain
Public N, NV, selectN As Integer
Public WBLN, YLBLN As Boolean
Public j3(), p2()
Public Sub JZji(j1, x1, y1, j2, x2, y2, j3)
ReDim j3(x1, y2)
Dim jk As Integer
If y1 <= x2 Then
jk = y1
Else
jk = x2
End If
For i = 1 To x1
For j = 1 To y2
na = 0
For jj = 1 To jk
na = na + j1(i, jj) * j2(jj, j)
Next jj
j3(i, j) = na
Next j
Next i
End Sub
Public Sub RALIZE()
End Sub
Public Sub ZZ(p1, x1, y1, p2)
ReDim p2(y1, x1)
For i = 1 To y1
For j = 1 To x1
p2(i, j) = p1(j, i)
Next j
Next i
End Sub
Public Sub palizeline()
w_x = frmMain.Pic.Width
w_y = frmMain.Pic.Height
frmMain.Pic.Cls
frmMain.Pic.DrawWidth = 1
frmMain.Pic.CurrentX = w_x * 0.05
frmMain.Pic.CurrentY = w_y * 0.9
frmMain.Pic.Line -(0.05 * w_x, 0.05 * w_y), vbBlack
'/////////////
frmMain.Pic.CurrentX = w_x * 0.05
frmMain.Pic.CurrentY = w_y * 0.9
frmMain.Pic.Line -(0.95 * w_x, 0.9 * w_y), vbBlack
End