i'm back at it agian, and now i am using your exapmle from btest2 to draw a plot into a form. i simply imported your example into my code and remmed my code, now i get the bitmap in the picture box but i also get Jr opening up and showing the plot at the same time.
maybe you can spot the problem?
my code to send the plot along with what i rem'ed:
Code: Select all
'send the plot to screen
d.Version = DPLOT_DDE_VERSION
d.DataFormat = DATA_3DR
d.MaxCurves = 1
d.MaxPoints = i
d.NumCurves = 1
d.ScaleCode = SCALE_LINEARX_LINEARY
d.Title1 = plotname
d.Title2 = mydate
d.Title3 = ""
d.XAxis = "Latitude"
d.YAxis = "Longitude"
cmds = "[Caption(" & Chr$(34) & "Preview Plot" & Chr$(34) & ")]"
cmds = cmds & "[ContourAxes(1)][ContourGrid(0)][ContourLevels(" & spacing & "," & shallow & "," & deep & ")]"
cmds = cmds & "[FontPoints(1,10)][FontPoints(6,10)][DocMaximize()]"
'put the test stuff in here:
ret = GetClientRect(Picture1.hwnd, rcPic)
If (hBitmap <> 0) Then
ret = DeleteObject(hBitmap)
hBitmap = 0
End If
If DocNum <> 0 Then
ret = DPlot_Command(DocNum, "[FileClose()]")
End If
DocNum = DPlot_Plot(d, 0&, Node(0, 0), cmds)
If (DocNum > 0) Then
DPM.SIZE = Len(DPM)
hBitmap = DPlot_GetBitmapEx(DocNum, rcPic.Right - rcPic.Left, rcPic.Bottom - rcPic.Top, DPM)
' NOTE: If we want to get Z values from the document (HasMetrics=3), we CANNOT close it.
' ret = DPlot_Command(DocNum, "[FileClose()]")
HasMetrics = 3 ' NOTE: This won't work for 3D, since we can't get X and Y from mouse position
End If
Call Picture1_Paint
'>>end of test stuff here
' ret = DPlot_Plot(d, 0&, Node(0, 0), cmds)
'send the plot to bitmap
' d.Version = DPLOT_DDE_VERSION
' d.DataFormat = DATA_3DR
' d.MaxCurves = 1
' d.MaxPoints = i
' d.NumCurves = 1
' d.ScaleCode = SCALE_LINEARX_LINEARY
' d.Title1 = plotname
' d.Title2 = mydate
' d.Title3 = ""
' d.XAxis = "Latitude"
' d.YAxis = "Longitude"
'
' cmds = "[Caption(" & Chr$(34) & "Contour Stylist Preview Plot" & Chr$(34) & ")]"
' cmds = cmds & "[ContourAxes(1)][ContourGrid(0)][ContourLevels(" & spacing & "," & shallow & "," & deep & ")]"
' cmds = cmds & "[FontPoints(1,10)][FontPoints(6,10)][DocMaximize()]"
' ret = DPlot_Plot(d, 0&, Node(0, 0), cmds)
but that does not create a problem in your example??
also later i pasted in :
Code: Select all
Private Sub Picture1_Paint()
Dim bm As BITMAP
Dim hbmpOld As Long
Dim hdc As Long
Dim hdcMem As Long
Dim ret As Long
If hBitmap <> 0 Then
hdc = GetDC(Picture1.hwnd)
hdcMem = CreateCompatibleDC(hdc)
If (hdcMem <> 0) Then
hbmpOld = SelectObject(hdcMem, hBitmap)
ret = GetObject(hBitmap, Len(bm), bm)
'ret = SetBkMode(hdc, 1)
'ret = SetBkColor(hdc, RGB(255, 255, 255))
ret = BitBlt(hdc, rcPic.Left, rcPic.Top, bm.bmWidth, bm.bmHeight, hdcMem, 0, 0, SRCCOPY)
ret = SelectObject(hdcMem, hbmpOld)
ret = DeleteDC(hdcMem)
End If
ret = ReleaseDC(Picture1.hwnd, hdc)
End If
End Sub
thanks again,
jerry