BorlandTalk.com Forum Index BorlandTalk.com
Borland discussion newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Form Paint

 
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> C++ Builder (Graphics)
View previous topic :: View next topic  
Author Message
bar
Guest





PostPosted: Sat May 19, 2007 11:04 pm    Post subject: Form Paint Reply with quote



Hello all

I have a TImage control.having a .bmp file.

How can i paint this picture to my form so that it will like a tile image.

Thanks
SA
Back to top
Remy Lebeau (TeamB)
Guest





PostPosted: Sun May 20, 2007 12:48 am    Post subject: Re: Form Paint Reply with quote



"bar" <shaikakbar250281 (AT) yahoo (DOT) co.in> wrote in message
news:464f3c30 (AT) newsgroups (DOT) borland.com...

Quote:
I have a TImage control.having a .bmp file.

How can i paint this picture to my form so that it will like a tile
image.


TImage does not have any tiling option. You should get rid of the
TImage altogether and draw the .bmp directly onto the TForm's Canvas
in its OnPaint event. Then you can draw it any way you wish. For
example:

private:
Graphics::TBitmap *FBmp;

__fastcall TForm1::TForm1(TComponent *Owner)
{
FBmp = new Graphics::TBitmap;
FBmp->LoadFromFile("myimage.bmp");
}

void __fastcall TForm1::FormPaint(TObject *Sender)
{
for(int y = 0; y < ClientHeight; y += FBmp->Height)
{
for(int x = 0; x < ClientWidth; x += FBmp->Width)
Canvas->Draw(x, y, FBmp);
}
}


Gambit
Back to top
bar
Guest





PostPosted: Sun May 20, 2007 1:30 pm    Post subject: Re: Form Paint Reply with quote



But how can i paint a jpg image.

Thanks
SA
"Remy Lebeau (TeamB)" <no.spam (AT) no (DOT) spam.com> wrote in message
news:464f54d0$1 (AT) newsgroups (DOT) borland.com...
Quote:

"bar" <shaikakbar250281 (AT) yahoo (DOT) co.in> wrote in message
news:464f3c30 (AT) newsgroups (DOT) borland.com...

I have a TImage control.having a .bmp file.

How can i paint this picture to my form so that it will like a tile
image.

TImage does not have any tiling option. You should get rid of the
TImage altogether and draw the .bmp directly onto the TForm's Canvas
in its OnPaint event. Then you can draw it any way you wish. For
example:

private:
Graphics::TBitmap *FBmp;

__fastcall TForm1::TForm1(TComponent *Owner)
{
FBmp = new Graphics::TBitmap;
FBmp->LoadFromFile("myimage.bmp");
}

void __fastcall TForm1::FormPaint(TObject *Sender)
{
for(int y = 0; y < ClientHeight; y += FBmp->Height)
{
for(int x = 0; x < ClientWidth; x += FBmp->Width)
Canvas->Draw(x, y, FBmp);
}
}


Gambit

Back to top
Remy Lebeau (TeamB)
Guest





PostPosted: Mon May 21, 2007 5:49 am    Post subject: Re: Form Paint Reply with quote

"bar" <shaikakbar250281 (AT) yahoo (DOT) co.in> wrote in message
news:46500729 (AT) newsgroups (DOT) borland.com...

Quote:
But how can i paint a jpg image.

The same way as I showed you earlier. Just use a TJPEGImage instead
of a TBitmap. They both derive from TGraphic, which is what
TCanvas::Draw() takes as an input parameter.


Gambit
Back to top
Display posts from previous:   
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> C++ Builder (Graphics) All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.