Re: BITMAP & grid
- From: "William" <port@xxxxxxxxxxxxxxxxxx>
- Date: Sat, 16 Apr 2005 13:19:47 +0900
Thanks Severian,
I just tried. With Rectangle(), I can draw the gird but the interior of the
rectangle also is painted.
If I use FrameRect(), it doesn't work. The following is my source.
void CMyView::OnDraw(CDC* pDC)
{
CBitmap bm;
bm.LoadBitmap(IDB_BITMAP8); //8 pixcel * 8 pixcel as attached.
// Create a pattern brush from the bitmap.
CBrush cBrPattern;
cBrPattern.CreatePatternBrush(&bm);
// Select the brush into a device context, and draw.
CBrush* pOldBrush = (CBrush*)pDC->SelectObject(&cBrPattern);
CPen* pOldPen;
pOldPen = (CPen*)pDC->SelectStockObject(NULL_PEN);
// pDC->Rectangle(CRect(50, 50, 200, 200));
pDC->FrameRect(CRect(50, 50, 200, 200), &cBrPattern);
//Restore the original brush.
pDC->SelectObject(pOldBrush);
pDC->SelectObject(pOldPen);
}
Please help
William
> LineDDA calls back to your code for every point on the line (and
> you're calling SetPixel), which is making it slow.
>
> I would try FrameRect() with a patterned brush.
Attachment:bitmap1.bmp
Description: Windows bitmap
- Follow-Ups:
- Re: BITMAP & grid
- From: Severian [MVP]
- Re: BITMAP & grid
- References:
- BITMAP & grid
- From: William
- Re: BITMAP & grid
- From: Severian [MVP]
- BITMAP & grid
- Prev by Date: Re: Scaling an Image
- Next by Date: Re: Add a printer programmatically or using command line
- Previous by thread: Re: BITMAP & grid
- Next by thread: Re: BITMAP & grid
- Index(es):
Relevant Pages
|