View previous topic :: View next topic |
Author |
Message |
walleye3313
Joined: 04 Jun 2005 Posts: 28
|
Posted: Mon Mar 06, 2006 12:22 pm Post subject: problem in VB6 |
|
|
David,
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: | '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)
|
i'm suspicious of the line that reads " DocNum = DPlot_Plot(d, 0&, Node(0, 0), cmds)"
but that does not create a problem in your example??
also later i pasted in :
Code: |
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 |
which is working fine after i rem'ed out those two lines. i am happy with what i see on the screen, just don't want the Jr screen to open, any ideas?
thanks again,
jerry |
|
Back to top |
|
|
walleye3313
Joined: 04 Jun 2005 Posts: 28
|
Posted: Mon Mar 06, 2006 12:58 pm Post subject: |
|
|
after all of that, i think i found the problem, i need to delete docMaximize() from the cmds string don't I?
cheers
jerry |
|
Back to top |
|
|
DPlotAdmin Site Admin
Joined: 24 Jun 2003 Posts: 2310 Location: Vicksburg, Mississippi
|
Posted: Mon Mar 06, 2006 5:57 pm Post subject: |
|
|
Jerry,
Take another look at the example. In the Form_Load event, it is starting DPlot (or DPlot Jr) in a hidden state. That's what the initial 1 does in the call to DPlot_Start. I'm starting it there so that it only needs to be started once, and it stays open (though hidden). If you don't call DPlot_Start with the hidden parameter then any other calls will start DPlot (or DPlot Jr), and it won't be hidden.
You'll also want to duplicate what is done in the Form_Terminate event, shutting down DPlot Jr if it was your application that started it. _________________ Visualize Your Data
support@dplot.com |
|
Back to top |
|
|
walleye3313
Joined: 04 Jun 2005 Posts: 28
|
Posted: Tue Mar 07, 2006 9:39 am Post subject: |
|
|
Thanks David that did it.
I now have the plot down to almost exactly what i need. i have three more changes to make, or figure out how to work around.
can I:
1. change all of the colors of the contours to black? once before you posted that i should use [Color(-1,0,0,0)] to make all contours black. but when i tried that i got no change. when i read the help for the color command it appears that it applies to curves and not contours? anyway i found [ContourColorScheme(method)] which would allow for a custom color scheme using [ContourCustomColors(color1,color2,...,color[n-1],color[n])] can i use those in combination to make all my contours black? how would i set up the color1,color2, etc to make that happen? and what wwould happen if there are more than 16 contours which could happen. if this is not do-able then i have a work around in mind that i will try.
2. get rid of the axes scale values?
3. get rid of the black line around the plot?
thanks again for all your help.
jerry |
|
Back to top |
|
|
DPlotAdmin Site Admin
Joined: 24 Jun 2003 Posts: 2310 Location: Vicksburg, Mississippi
|
Posted: Tue Mar 07, 2006 3:43 pm Post subject: |
|
|
Quote: | 1. change all of the colors of the contours to black? |
Think of the colors specified with ContourCustomColors as a palette that each interval's color will be interpolated from, rather than color assignments for each interval. If you only specify 2 colors (say red and blue) and have 3 intervals, for example, then the first line will be red, the second will be magenta, and the third will be blue.
In your case you only want 1 color, so that's all you need to specify:
[ContourColorScheme(2)][ContourCustomColors(0)]
Quote: | 2. get rid of the axes scale values? |
If you just want to eliminate the numbers, right-click on numbers along the axis and select 'None' for the number format. If you don't want to draw the axes at all, under Contour Plot Options uncheck the "Axes" box (and in this case there's no need to set the number format, numbers won't be drawn.)
Quote: | 3. get rid of the black line around the plot? |
Got ahead of myself _________________ Visualize Your Data
support@dplot.com |
|
Back to top |
|
|
walleye3313
Joined: 04 Jun 2005 Posts: 28
|
Posted: Tue Mar 07, 2006 6:44 pm Post subject: |
|
|
David,
thanks a bunch, i got 1. and 2. squared away.
3 however, hmmmm....
i can turn off the axes in DplotJr using the menu, i could not find an equivalent command to do the same, does one exsist? if not, now worries because i found where i can set the axes color to white which will be an acceptable workaround for what i am trying to do. my strategy is to determine which bits in the bitmap are black and if i turn the axes white they won't show up when i go looking for black! so i can get it done from here if that command is not available.
thanks,
jerry |
|
Back to top |
|
|
DPlotAdmin Site Admin
Joined: 24 Jun 2003 Posts: 2310 Location: Vicksburg, Mississippi
|
Posted: Tue Mar 07, 2006 7:03 pm Post subject: |
|
|
ContourAxes(0) _________________ Visualize Your Data
support@dplot.com |
|
Back to top |
|
|
walleye3313
Joined: 04 Jun 2005 Posts: 28
|
Posted: Tue Mar 07, 2006 7:10 pm Post subject: |
|
|
OH YEAH!!!!
I finally got it,
well OK: YOU finally got it for me, now lets see if i can get the rest of this thing done this week.
Thanks again,
Jerry |
|
Back to top |
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|