Page 1 of 1

Canvas BackGround color when zoomed

Posted: Fri Nov 12, 2004 1:38 pm
by 9082539
Hello,

I can't display the canvas background color when the object is zoomed. In that case, the rectangle background isn't opaque as it is when no zoom is applying.

Here is the code to display the canvas text into a rectangle:
// --------------
// Maximum width
int nWidthMax = 0;
for (int k = 0; k < NB_TOOLTIP_STR; k++) {
int nWidth = cCanvas.TextWidth( cs[k]);
if (nWidth > nWidthMax) nWidthMax = nWidth;
}

CPen1 cPen = cCanvas.GetPen();
cCanvas.SetBackMode( cbmOpaque);
cPen.SetColor( COL_BLACK);
cCanvas.SetBackColor( COL_WHITE);
cCanvas.Rectangle( X+5, Y-5, X+15+nWidthMax, Y + 10 + (NB_TOOLTIP_STR*nLineHeight));

for (k = 0; k < NB_TOOLTIP_STR; k++) {
cCanvas.TextOut( X+10, Y, cs[k]);
Y += nLineHeight;
}

Is something missing ?

Posted: Fri Nov 12, 2004 2:01 pm
by 9082539
Hello,

I assume I get the answer:

CBrush1 cBrush = cCanvas.GetBrush();
cBrush.SetColor(COL_WHITE);
cBrush.SetStyle( bsSolid);


CPen1 cPen = cCanvas.GetPen();
cPen.SetColor( COL_BLACK);

cCanvas.SetBackColor( COL_WHITE);
cCanvas.SetBackMode( cbmOpaque);
...