在Picture1里画图的坐标求教高手,谢谢!!!
我在Picture1里用Drawtpk华了一个表图,我想把用DrawKLine再画的图画在前一个表中,但总是无法画准确,还请求大家帮助,谢谢!!!
我感觉是picBroad.Scale (CurJL - 4, maxhigh )-(CurJL + ts + 1, minlow )这句不符合要求
Private Sub Drawtpk()
Picture1.Cls
For i = 0 To 12
Picture1.DrawStyle = 2
Picture1.Line (Picture1.ScaleWidth * 0.03, (Picture1.ScaleHeight / 13) * (i + 1))-(Picture1.ScaleWidth * 0.97, (Picture1.ScaleHeight / 13) * (i + 1)), vbRed
Picture1.CurrentX = Picture1.ScaleWidth * 0.0001
Picture1.CurrentY = (Picture1.ScaleHeight / 13) * (i)
Picture1.ForeColor = &H80000009
If i = 1 Then
Picture1.Print hqs.maxhigh / 1000
End If
If i > 1 And i < 12 Then
Picture1.Print Round((hqs.maxhigh / 1000 - (hqs.minlow / 1000 - 5)) / 11 * (12 - i) + (hqs.minlow / 1000 - 5), 1)
End If
If i = 12 Then
Picture1.Print hqs.minlow / 1000 - 5
End If
Next i
Picture1.Line (Picture1.ScaleWidth * 0.03, (Picture1.ScaleHeight / 14))-(Picture1.ScaleWidth * 0.03, (Picture1.ScaleHeight)), vbRed
End SubPrivate Sub DrawKLine(picBroad As PictureBox, CurJL As Long, ts As Long, maxhigh As Double, minlow As Double)
'画线
Dim DrawColor As Long
Dim i As Long
Dim MaxJL As LongpicBroad.Cls
DrawtpkPicture1.DrawStyle = 1
picBroad.ScaleIf CurJL + ts > UBound(hq) Then
    MaxJL = UBound(hq)
Else
    MaxJL = CurJL + ts
End If
picBroad.Scale (CurJL - 4, maxhigh )-(CurJL + ts + 1, minlow )
For i = CurJL To MaxJL
    If q(i).spj > q(i).kp Then
        DrawColor = QBColor(12)
    ElseIf q(i).sp < q(i).kp Then
        DrawColor = QBColor(10)
    Else
        DrawColor = QBColor(15)
    End If
    Picture1.DrawWidth = 1.5
    picBroad.Line (i + 0.2, q(i).kp)-(i + 0.8, q(i).sp), DrawColor, BF
    picBroad.Line (i + 0.5, q(i).zg)-(i + 0.5, q(i).zd), DrawColorNextEnd Sub

解决方案 »

  1.   

    谢谢!!!小刀剜心:
    我在Picture1里面用(Drawtpk)先画了一个表格如:
    --------------------------------------------------------
    |
    --------------------------------------------------------
    |
    --------------------------------------------------------
    |
    --------------------------------------------------------
    我想在这个格子上面再画一个图(用DrawKLine),但最高为先画图的第一条线,最低点为先画图的最后一条线
    我想问题出在picBroad.Scale   (CurJL   -   4,   maxhigh   )-(CurJL   +   ts   +   1,   minlow   )
    但不知如何解决
    还请各位帮助,谢谢!!!
      

  2.   

    用了这句之后 
    picBroad.Scale       (CurJL       -       4,       maxhigh       )-(CurJL       +       ts       +       1,minlow       )
    picBroad 的 坐标系 范围就是
    X: CurJL-1 TO CurJL+TS+1
    Y: maxhigh to minlow
    q(i)数组你数据怎么来的?你没交待
      

  3.   

    谢谢!!!
    kp As Long 
    zP As Long
    zd As Long 
    sp As Long 
      

  4.   

    For   i   =   CurJL   To   MaxJL 
    ==>
    For   i   =   CurJL-4   To   MaxJL+1 
      

  5.   

    坐标系范围变了 
    q(i) 结构体相应的范围也要变更下上面有句打错了
    For i=CurJL-4 To MaxJL 
      

  6.   

    我以前作图也喜欢用自定义单位,现在都是用的像素单位,可以用很多有效率的API函数