way to use image/bitmap as brush?

  • Thread starter Thread starter climax!
  • Start date Start date
C

climax!

I need to fill a rectangle with a bitmap, is this possible using the
graphics class?

thanx
 
Would it work for you if you created a new picturebox the size of
your rectangle and the put the bitmap into it? You can create the new
bitmap based on the demensions of the rectangle and it will
stretch/morph as required, or if you pass in a fixed size it will
truncate the viewable area.

I need to fill a rectangle with a bitmap, is this possible using the
graphics class?

thanx
--
Norman Rericha

Applied Data Systems
www.applieddata.net
An ISO 9001:2000 Registered Company
Microsoft WEP Gold-level Member
 
Somethings like this:

private void TileImage(Graphics graphics, Image image, Rectangle rect)
{
if ((image.Width < rect.Width) && (image.Height < rect.Height))
{
int horizCount = rect.Width / image.Width;
int vertCount = rect.Height / image.Height;
int x = 0;
int y = 0;

for (int i = 0; i < horizCount; i++)
{
for (int j = 0; j < vertCount; j++)
{
graphics.DrawImage(image, x, y);
y += image.Height;
}
y = 0;
x += image.Width;
}
}
}
 
Back
Top