Board index » cppbuilder » Attach more bitmaps inside the Timage component ...

Attach more bitmaps inside the Timage component ...


2007-01-23 07:51:34 PM
cppbuilder51
is it possible?
I've tried to do this using the canvas' method "draw" belong to directly
Image1 and then to Picture but nothing!! I don't see anything
someone can help me ... i'm trying from two/three hours!!
Many thanks in advance!
Below is the code that don't work
// START "UNIT1.CPP"
#include <vcl.h>
#pragma hdrstop
#include "Unit1.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource "*.dfm"
TForm1 *Form1;
//---------------------------------------------------------------------------
__fastcall TForm1::TForm1(TComponent* Owner)
: TForm(Owner)
{
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Button1Click(TObject *Sender)
{
Graphics::TBitmap *Bitmap;
if (Clipboard()->HasFormat(CF_BITMAP))
{
Image1->Picture->Bitmap->Assign(Clipboard());
Bitmap = Image1->Picture->Bitmap;
Image2->Picture->Bitmap->Assign(Clipboard());
// the follow instruction don't make anything!!! Why???
Image2->Picture->Bitmap->Canvas->Draw(150,0,Bitmap);
}
}
//---------------------------------------------------------------------------
/---------------------------------------------------------------------------
// END "UNIT.CPP"
// START "UNIT1.H"
//---------------------------------------------------------------------------
#ifndef Unit1H
#define Unit1H
//---------------------------------------------------------------------------
#include <Classes.hpp>
#include <Controls.hpp>
#include <StdCtrls.hpp>
#include <Forms.hpp>
#include <vcl\Clipbrd.hpp>
#include <ExtCtrls.hpp>
//---------------------------------------------------------------------------
class TForm1 : public TForm
{
__published: // IDE-managed Components
TButton *Button1;
TImage *Image1;
TImage *Image2;
void __fastcall Button1Click(TObject *Sender);
private: // User declarations
public: // User declarations
__fastcall TForm1(TComponent* Owner);
};
//---------------------------------------------------------------------------
extern PACKAGE TForm1 *Form1;
//---------------------------------------------------------------------------
#endif
// END "UNIT.H"
 
 

Re:Attach more bitmaps inside the Timage component ...

kronos wrote:
Quote
is it possible?
Please do not refer to your subject. Put all text in the body.
Quote
Below is the code that don't work
Image2->Picture->Bitmap->Canvas->Draw(150,0,Bitmap);
The code is ok. (I tested).
Is the width of the TImage more than 150?
Hans.
 

Re:Attach more bitmaps inside the Timage component ...

Hans Galema ha scritto:
Quote
kronos wrote:
>is it possible?

Please do not refer to your subject. Put all text in the body.
OK . Thanks for tip.
Quote

>Below is the code that don't work
>Image2->Picture->Bitmap->Canvas->Draw(150,0,Bitmap);

The code is ok. (I tested).
Be careful that there have to be two bitmap images inside Image2 one at
(0,0) and the other at (150,0)
I tried again and i confirm: i see only one image inside Image2 ...
many thanks anyway for the collaboration!
Quote

Is the width of the TImage more than 150?
Yes
Quote

Hans.
 

{smallsort}

Re:Attach more bitmaps inside the Timage component ...

kronos ha scritto:
Quote
Hans Galema ha scritto:
>kronos wrote:
>>is it possible?
>
>Please do not refer to your subject. Put all text in the body.

OK . Thanks for tip.

>
>>Below is the code that don't work
>>Image2->Picture->Bitmap->Canvas->Draw(150,0,Bitmap);
>
>The code is ok. (I tested).

Be careful that there have to be two bitmap images inside Image2 one at
(0,0) and the other at (150,0)

I tried again and i confirm: i see only one image inside Image2 ...
I don't know what happen but now i see two bitmap images inside Image2!!!!
I'll try to investigate!!
Quote

many thanks anyway for the collaboration!

>
>Is the width of the TImage more than 150?

Yes

>
>Hans.
 

Re:Attach more bitmaps inside the Timage component ...

Hi,
Depending on what do you really want to accomplish, you may
want to see how multiple TImage objects can be used to behave
like one.
The sample project Moving Map.zip
www.antivari.com/MovingMap.zip
(I tried to post the sample is in attachments group, but the project
length is 2MB because of losts of images, so I had to use my private domain)
(Belgrade is on the screen ;)
--
Best Regards,
Vladimir Stefanovic
 

Re:Attach more bitmaps inside the Timage component ...

Vladimir Stefanovic ha scritto:
Quote
Hi,


Depending on what do you really want to accomplish, you may
want to see how multiple TImage objects can be used to behave
like one.

The sample project Moving Map.zip
www.antivari.com/MovingMap.zip

(I tried to post the sample is in attachments group, but the project
length is 2MB because of losts of images, so I had to use my private domain)

(Belgrade is on the screen ;)
It's fantastic!!! ... Belgrado too, but your prog a bit more!!
Anyway i didn't think to this application, but this one will can useful
in the future!!
Quote