请看下,我想填充三角形的颜色,Private Declare Sub FloodFill Lib "GDI32" (ByVal hDC As Long,ByVal x As Long,ByVal y As Long,ByVal crColor As Long)Public pi,xb As SinglePrivate Sub Form_Load()pi = 3.14159265358979t.Scale (-t.Width / 2,t.Heig
来源:学生作业帮助网 编辑:六六作业网 时间:2024/12/26 03:38:31
请看下,我想填充三角形的颜色,Private Declare Sub FloodFill Lib "GDI32" (ByVal hDC As Long,ByVal x As Long,ByVal y As Long,ByVal crColor As Long)Public pi,xb As SinglePrivate Sub Form_Load()pi = 3.14159265358979t.Scale (-t.Width / 2,t.Heig
请看下,我想填充三角形的颜色,
Private Declare Sub FloodFill Lib "GDI32" (ByVal hDC As Long,ByVal x As Long,ByVal y As Long,ByVal crColor As Long)
Public pi,xb As Single
Private Sub Form_Load()
pi = 3.14159265358979
t.Scale (-t.Width / 2,t.Height / 2)-(t.Width / 2,-t.Height / 2)
End Sub
Public Function dx(ddmc,ddx,xzjd) '顶点名称,顶点x,旋转角度
If ddmc = "a" Then
dx = ddx + xb * Cos((xzjd - 15) * pi / 180)
Else
dx = ddx + xb * Cos((xzjd + 15) * pi / 180)
End If
End Function
Public Function dy(ddmc,ddy,xzjd) '顶点名称,顶点y,旋转角度
If ddmc = "a" Then
dy = ddy + xb * Sin((xzjd - 15) * pi / 180)
Else
dy = ddy + xb * Sin((xzjd + 15) * pi / 180)
End If
End Function
Private Sub t_Click()
wr = 25
lr = 20
wrk = 20
bh = 5
bs = 70
xb = 900
wr1 = wr * bs
lr1 = lr * bs
wrk1 = wrk * bs
lrk1 = lrk * bs
l1 = l * bs
gg1 = gg * bs
bh1 = bh * bs
wrqdj = (180 - wrj / 2) / 180 * pi
wrzdj = (180 + wrj / 2) / 180 * pi
lrqdj = (180 - lrj / 2) / 180 * pi
lrzdj = (180 + lrj / 2) / 180 * pi
If bh + lr < wr Then
ox = -t.Width / 4 + wr1 / 2
Else
ox = -t.Width / 4 - (bh1 + lr1) / 2 + wr1
End If
oy = 0
px = ox + bh1 - (wr1 - lr1)
py = 0
ex = t.Width / 4
ey = 0
Dim wrddx,wrddy,lrddx,lrddy '外R和内R的注示箭头顶点的坐标
wrddx = ox + wr1 * Cos((180 - wrj / 4) * pi / 180)
wrddy = oy + wr1 * Sin((180 - wrj / 4) * pi / 180)
lrddx = px + lr1 * Cos((180 + lrj / 4) * pi / 180)
lrddy = py + lr1 * Sin((180 + lrj / 4) * pi / 180)
t.Line (wrddx,wrddy)-(dx("a",wrddx,180 - wrj / 4),dy("a",wrddy,180 - wrj / 4))
t.Line -(dx("b",wrddx,180 - wrj / 4),dy("b",wrddy,180 - wrj / 4))
t.Line -(wrddx,wrddy)
Dim x As Long,y As Long
x = t.ScaleX(wrddx + xb / 4 * 3 * Cos((180 - wrj / 4) * pi / 180),vbUser,vbPixels)
y = t.ScaleY(wrddy + xb / 4 * 3 * Sin((180 - wrj / 4) * pi / 180),vbUser,vbPixels)
t.FillColor = vbBlack
t.FillStyle = 0
FloodFill t.hDC,x,y,0
End Sub
这是我的程序一部份,三角形的颜色填充不好,请指教
请看下,我想填充三角形的颜色,Private Declare Sub FloodFill Lib "GDI32" (ByVal hDC As Long,ByVal x As Long,ByVal y As Long,ByVal crColor As Long)Public pi,xb As SinglePrivate Sub Form_Load()pi = 3.14159265358979t.Scale (-t.Width / 2,t.Heig
你的(x,y)根本不在三角形当中!
x = t.ScaleX(wrddx + xb / 4 * 3 * Cos((180 - wrj / 4) * pi / 180),vbUser,vbPixels)
y = t.ScaleY(wrddy + xb / 4 * 3 * Sin((180 - wrj / 4) * pi / 180),vbUser,vbPixels)
t.PSet (X,Y),vbRed '加这句仔细看小红点的位置!