| |

VerySource

 Forgot password?
 Register
Search
View: 707|Reply: 2

How to fill a rectangular area with a bitmap?

[Copy link]

3

Threads

3

Posts

4.00

Credits

Newbie

Rank: 1

Credits
4.00

 China

Post time: 2020-2-22 17:30:02
| Show all posts |Read mode
I have a bitmap, but how do I fill a rectangular area?
Reply

Use magic Report

1

Threads

11

Posts

11.00

Credits

Newbie

Rank: 1

Credits
11.00

 China

Post time: 2020-5-5 10:45:01
| Show all posts
// Create a hatched bit pattern.
WORD HatchBits [8] = {0x11, 0x22, 0x44, 0x88, 0x11,
    0x22, 0x44, 0x88};

// Use the bit pattern to create a bitmap.
CBitmap bm;
bm.CreateBitmap (8,8,1,1, HatchBits);

// Create a pattern brush from the bitmap.
CBrush brush;
brush.CreatePatternBrush (&bm);

// Select the brush into a device context, and draw.
CBrush * pOldBrush = (CBrush *) pDC-> SelectObject (&brush);
pDC-> RoundRect (CRect (50, 50, 200, 200), CPoint (10,10));

// Restore the original brush.
pDC-> SelectObject (pOldBrush);
Reply

Use magic Report

0

Threads

1

Posts

2.00

Credits

Newbie

Rank: 1

Credits
2.00

 China

Post time: 2020-5-9 12:15:01
| Show all posts
Use the BitBlt function to copy the picture to the rectangle
Reply

Use magic Report

You have to log in before you can reply Login | Register

Points Rules

Contact us|Archive|Mobile|CopyRight © 2008-2023|verysource.com ( 京ICP备17048824号-1 )

Quick Reply To Top Return to the list