Click here to Skip to main content
15,887,027 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Need a best possible alternative?? Pin
Kiran Satish2-Oct-07 8:41
Kiran Satish2-Oct-07 8:41 
GeneralRe: Need a best possible alternative?? Pin
Mark Salsbery2-Oct-07 9:11
Mark Salsbery2-Oct-07 9:11 
GeneralRe: Need a best possible alternative?? Pin
Kiran Satish2-Oct-07 9:45
Kiran Satish2-Oct-07 9:45 
GeneralRe: Need a best possible alternative?? Pin
Kiran Satish3-Oct-07 10:46
Kiran Satish3-Oct-07 10:46 
GeneralRe: Need a best possible alternative?? Pin
Mark Salsbery3-Oct-07 11:18
Mark Salsbery3-Oct-07 11:18 
GeneralRe: Need a best possible alternative?? [modified] Pin
Kiran Satish3-Oct-07 12:13
Kiran Satish3-Oct-07 12:13 
GeneralRe: Need a best possible alternative?? Pin
Mark Salsbery3-Oct-07 12:49
Mark Salsbery3-Oct-07 12:49 
GeneralRe: Need a best possible alternative?? Pin
Kiran Satish8-Oct-07 15:17
Kiran Satish8-Oct-07 15:17 
Before I start changing the code to use DIBSection, I started referin at BitBlt on msdn and came accross PatBlt and thought of quickly trying it with the following arguments-
within the loop

CBrush *pcolor,tcolor;<br />
for(i=0; i < GRID; i++) //GRID=12<br />
{<br />
for(j=0; j < GRID; j++)<br />
{<br />
if( (j == 0 || j == (GRID-1)) && (i == 0 || i == (GRID-1)) )<br />
; // Do nothing, eliminating corners of 12x12 grid<br />
else<br />
{<br />
resval = (parent->calcfile)->FetchResData(i,j);<br />
ResRect.left = X_OFFSET + (i*(RES_BOX_SIZE+BOX_GAP));<br />
ResRect.right = ResRect.left + RES_BOX_SIZE;<br />
ResRect.top = Y_OFFSET + (j*(RES_BOX_SIZE+BOX_GAP));<br />
ResRect.bottom = ResRect.top + RES_BOX_SIZE;<br />
color = check_ColorLimits(resval); /*this is to find a new color <br />
corresponding to the data val*/<br />
tcolor = new CBrush(GetRVal(color),GetGVal(color),GetBVal(color));<br />
pcolor = ResCDC->SelectObject(&tcolor);<br />
PatBlt(ResCDC->m_hDC, ResRECT.left, ResRECT.top, (ResRECT.right-ResRECT.left),  (ResRECT.bottom-ResRECT.top), PATCOPY);<br />
}<br />
}<br />
}<br />
ResDisp->ReleaseDC(ResCDC);


The above loop is working fine for one grid location and draws one box filled with color, for the second time when it reaches selectobject statement, it is crashing with an error in wingdi.cpp. It seems like I am reselecting a new object without actually releasing the first color or soething like tht. How can I get rid of this error??

thanks,

PKNT

GeneralRe: Need a best possible alternative?? Pin
Mark Salsbery9-Oct-07 6:00
Mark Salsbery9-Oct-07 6:00 
GeneralRe: Need a best possible alternative?? [modified] Pin
Kiran Satish9-Oct-07 6:10
Kiran Satish9-Oct-07 6:10 
GeneralRe: Need a best possible alternative?? Pin
Mark Salsbery9-Oct-07 8:01
Mark Salsbery9-Oct-07 8:01 
GeneralRe: Need a best possible alternative?? Pin
Kiran Satish9-Oct-07 10:49
Kiran Satish9-Oct-07 10:49 
GeneralRe: Need a best possible alternative?? Pin
Mark Salsbery10-Oct-07 5:24
Mark Salsbery10-Oct-07 5:24 
GeneralRe: Need a best possible alternative?? Pin
Kiran Satish10-Oct-07 6:56
Kiran Satish10-Oct-07 6:56 
GeneralRe: Need a best possible alternative?? Pin
Kiran Satish11-Oct-07 5:14
Kiran Satish11-Oct-07 5:14 
GeneralRe: Need a best possible alternative?? Pin
Mark Salsbery11-Oct-07 5:30
Mark Salsbery11-Oct-07 5:30 
GeneralRe: Need a best possible alternative?? Pin
Kiran Satish11-Oct-07 12:53
Kiran Satish11-Oct-07 12:53 
GeneralRe: Need a best possible alternative?? Pin
Mark Salsbery11-Oct-07 13:06
Mark Salsbery11-Oct-07 13:06 
GeneralRe: Need a best possible alternative?? Pin
Kiran Satish11-Oct-07 13:31
Kiran Satish11-Oct-07 13:31 
GeneralRe: Need a best possible alternative?? Pin
Mark Salsbery11-Oct-07 13:41
Mark Salsbery11-Oct-07 13:41 
GeneralRe: Need a best possible alternative?? Pin
Kiran Satish11-Oct-07 13:46
Kiran Satish11-Oct-07 13:46 
GeneralRe: Need a best possible alternative?? Pin
Kiran Satish17-Oct-07 11:09
Kiran Satish17-Oct-07 11:09 
GeneralRe: Need a best possible alternative?? Pin
Mark Salsbery20-Oct-07 5:31
Mark Salsbery20-Oct-07 5:31 
GeneralRe: Need a best possible alternative?? Pin
Mark Salsbery2-Oct-07 8:40
Mark Salsbery2-Oct-07 8:40 
GeneralRe: Need a best possible alternative?? Pin
Mark Salsbery3-Oct-07 12:59
Mark Salsbery3-Oct-07 12:59 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.