Author |
Topic  |
|
TonyGrayDSI
14 Posts |
Posted - 18 Sep 2005 : 17:29:00
|
I'm drawing multiple graphs in a grid on a single page. That page is nested in a VB picturebox in a way similar to what's done in the MDIDemo example project.
I'm finding that I often get a Msgbox with the title "SERIOUS ERROR" and the message "Cannot create pen. Would you like to continue?" followed by program exit if I click on the 'No' button, or the same message again if I select 'Yes'. I thought it was associated with the window resize, but it happens during repainting even if no resizing of the window is attempted.
I haven't been able to learn much about this message. Any info anyone has on what it means and why it might be coming up would be greatly appreciated.
Many thanks, Tony Gray |
Edited by - TonyGrayDSI on 18 Sep 2005 22:20:27 |
|
TonyGrayDSI
14 Posts |
Posted - 18 Sep 2005 : 20:13:09
|
After more investigation, it turns out that this is exclusively associated with my use of WGSetMultiColors(), which I can avoid. I'll have a closer look at the parameters I'm suppling to see if that's the problem. Tony |
 |
|
TonyGrayDSI
14 Posts |
Posted - 20 Sep 2005 : 12:37:08
|
I have confirmed this is a problem by adding a call to SetMultiColors to the BIGDEMO example program and getting the same error as follows:
1) Change the page type of pPageDesc2 to MM_PROPORT so the graph resizes with the window 2) Create a form level array for colours with NUMP2 entries. In the MakeData routine, dimension it and populate it with colour values: ColourArray(i) = WGGetRGBColor(C_BLACK + i Mod (C_OFFWHITE - C_BLACK)) 3) add the call to SetMultiColors right after the creation of the scatter plot in DrawP2G1: ' Scatter Plot - data set 2 hObj = WGScatterPlot(pGrDesc, hdc, hDataSet2, MK_ASTERISK, C_LIGHTBLUE, 7, MKS_EMPTY, False) WGSetMultiColors pGrDesc, hObj, True, ColourArray(0)
To get the error, you need to trigger lots of redraws (hundreds of them). The best way to do this is to turn on 'Show window contents while dragging' in your screen properties, grab the bottom corner of the window frame, then drag it around in circles until it blows up. Moving the mouse quickly, it takes me about four seconds.
It looks like something is being allocated inside the paint routine that isn't being released if the multicolour feature is in use. I've already rewritten my code to avoid using this routine, so I don't need a workaround - just posting in case it helps you guys. |
Edited by - TonyGrayDSI on 20 Sep 2005 12:49:26 |
 |
|
quinncurtis
1164 Posts |
Posted - 20 Sep 2005 : 15:03:45
|
If you have the example, zip it and send it to support@quinn-curtis.com and we will take a look at it.
|
 |
|
TonyGrayDSI
14 Posts |
Posted - 20 Sep 2005 : 18:48:08
|
It's on its way. BTW, use the 'START PAGE 2' button to launch the problem graph. If you use 'START ALL PAGES' then it will launch without the MM_PROPORT flag and so won't redraw continuously when dragging the window frame to resize.
All the best, Tony Gray |
Edited by - TonyGrayDSI on 20 Sep 2005 18:48:50 |
 |
|
|
Topic  |
|
|
|