Prabhu S Guest
|
Posted: Thu Dec 22, 2005 9:18 am Post subject: Diagram Studio with Borland C++ Builder 6.0 |
|
|
Hi,
I have installed Diagram Studio for Borland C++ Builder 6.0 from TMS Software.
Diagram Studio gives an Object called atDiagram1 where we can draw flow chart Blocks, Electric Blocks, Lines, Arrow Blocks etc...
We can also load a Bitmap Image as a Background Image for atDiagram1.
The Code which I used to Load the Bitmap is as follows,
CODE1:
======
Graphics::TBitmap *BrushBmp = new Graphics::TBitmap;
//Creation of Canvas Over the atDiagram1 Display area
TCanvas *BackgroundCanvas = CfrmNCD->atDiagram1->Background->Bitmap->Canvas;
// Load the Image as Background Image for NCD Window
try
{
BrushBmp->LoadFromFile(astrPathName);
CfrmNCD->atDiagram1->Background->Visible = true;
CfrmNCD->atDiagram1->Background->Bitmap->Width = Screen->DesktopWidth;
CfrmNCD->atDiagram1->Background->Bitmap->Height = Screen->DesktopHeight;
BackgroundCanvas->Brush->Bitmap = BrushBmp;
TRect DrawRect;
DrawRect = Screen->DesktopRect;
DrawRect.Bottom = DrawRect.Bottom - 90;
BackgroundCanvas->StretchDraw(DrawRect,BrushBmp);
}
catch(EInOutError & e)
{
delete BrushBmp;
return false;
}
catch (Exception &exception)
{
delete BrushBmp;
return false;
}
delete BrushBmp;
I can also use the following code to Load the Image as Background for atDiagram1,
CODE 2:
=======
atDiagram1->Background->Visible = true;
atDiagram1->Background->Bitmap->LoadFromFile(astrPathName);
But there is no property to set for Stretching the Image.
There is a Property where we can choose only one the following Options,
a. Tiled
b. Fixed
There is no option like Stretch for Stretching the Image.
I asked TMS Software. They Replied that there is no such Option.
So I Used CODE 1 where it creates a canvas and draws the Image on canvas after stretching it.
The Problem is,
If I Use CODE1:
===============
When Backgound Image is not Present and If I move the Blocks displayed over the atDiagram1, there is NO Memory Leak.
When I Load the Background Image, and If I move the Blocks displayed over the atDiagram1, there is a huge Memory Leak.
If I use CODE 2:
===============
When I Load the Background Image and If I Move the Blocks displayed on atDiagram1, there is no huge Memory Leak.
Why It happens ?
Is there any way to stretch the Image before loading ?
Thank you.
Regards,
Prabhu S
|
|