🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: borland.public.cppbuilder.nativeapi
12 messages
12 total messages Started by Mark Jacobs Thu, 04 Oct 2007 15:03
Setting a window dimensions larger than the screen display
#1291
Author: Mark Jacobs
Date: Thu, 04 Oct 2007 15:03
10 lines
1583 bytes
I have a chart that is produced on a form. If I want the chart to be 800 by 
600 pixels, I set the form to be this size, draw the chart, and then use 
GetFormImage() to bung a bitmap of the chart into a file. The problem is that 
the chart size is limited to the screen resolution using this technique. Is 
there a flag or something, I can set for the Form which allows me to size it 
past the screen dimensions?
-- 
Mark Jacobs
DK Computing
http://www.dkcomputing.co.uk
Re: Setting a window dimensions larger than the screen display
#1292
Author: dhoke
Date: Thu, 04 Oct 2007 15:14
22 lines
2080 bytes
Sounds like your using VCL rather than native api...

Not clear _how_ you're putting your chart on the form...

But, if your using a TImage(->Picture->Bitmap), try putting a TScrollBox on 
the form, and then plop the TImage onto the ScrollBox.  I believe you will 
be able to generate a bitmap larger than either the scrollbox, or chart - 
subject, no doubt to available memory, and/or application address space.

"Mark Jacobs" <http://www.jacobsm.com/mjmsg.htm?BorlandNG> wrote in message 
news:470500be$1@newsgroups.borland.com...
>I have a chart that is produced on a form. If I want the chart to be 800 by 
>600 pixels, I set the form to be this size, draw the chart, and then use 
>GetFormImage() to bung a bitmap of the chart into a file. The problem is 
>that the chart size is limited to the screen resolution using this 
>technique. Is there a flag or something, I can set for the Form which 
>allows me to size it past the screen dimensions?
> -- 
> Mark Jacobs
> DK Computing
> http://www.dkcomputing.co.uk
> 
Re: Setting a window dimensions larger than the screen display
#1294
Author: Asger Jørgensen
Date: Thu, 04 Oct 2007 16:25
20 lines
1856 bytes
Hi Mark

In article <470500be$1@newsgroups.borland.com>, "Mark Jacobs" 
<http://www.jacobsm.com/mjmsg.htm?BorlandNG> says...
> I have a chart that is produced on a form. If I want the chart to be 800 by 
> 600 pixels, I set the form to be this size, draw the chart, and then use 
> GetFormImage() to bung a bitmap of the chart into a file. The problem is that 
> the chart size is limited to the screen resolution using this technique. Is 
> there a flag or something, I can set for the Form which allows me to size it 
> past the screen dimensions?
 
It is much faster to draw on a bitmap in memory 
and then when done use BitBlt to copy the bitmap to 
canvas.
But if You put a TImage on the form and then asign
the bitmap to the Image the bitmap wil automaticly resize.
Just remember to set autosize=true on the image.

Kind regards
Asger
Re: Setting a window dimensions larger than the screen display
#1293
Author: Bob Gonder
Date: Thu, 04 Oct 2007 16:36
17 lines
1440 bytes
"Mark Jacobs" <http://www.jacobsm.com/mjmsg.htm?BorlandNG> wrote:

>The problem is that the chart size is limited to the screen resolution

See  Compatible Device Contexts  in the help

The steps:
	hDC = CreateCompatibleDC
	hBM = CreateCompatibleBitmap
	tBM = SelectObject( hDC, hBM )

	Draw on the hDC
	Save the bitmap

	SelectObject( hDC, tBM )
	DeleteObject( hBM )
	DeleteDC( hDC )
Re: Setting a window dimensions larger than the screen display
#1296
Author: Mark Jacobs
Date: Thu, 04 Oct 2007 16:52
26 lines
2185 bytes
"dhoke" <dhoke.nojunk@east-shore.com> wrote in message 
news:4705035c@newsgroups.borland.com...
> Sounds like your using VCL rather than native api...

Yes, this is true. TForm is the component I am trying to resize. Perhaps the 
question would be more pertinent in cppbuilder.vcl.components.using instead 
of here.

> Not clear _how_ you're putting your chart on the form...

It is a TChart that is dropped onto the form and then aligned alClient, so 
that it naturally occupies the entire form canvas, whatever the size of the 
form is.

> But, if your using a TImage(->Picture->Bitmap), try putting a TScrollBox 
> on the form, and then plop the TImage onto the ScrollBox.  I believe you 
> will be able to generate a bitmap larger than either the scrollbox, or 
> chart - subject, no doubt to available memory, and/or application address 
> space.

But, GetFormImage() won't yield a large bitmap, it will be just what of the 
form is visible on screen. I need to get the form to be bigger than the 
screen, and GetFormImage() to yield a bitmap that exceeds screen dimensions.
-- 
Mark Jacobs
www.jacobsm.com 
Re: Setting a window dimensions larger than the screen display
#1295
Author: Mark Jacobs
Date: Thu, 04 Oct 2007 17:00
5 lines
1052 bytes
Please see my other reply - I have no control over the drawing - it is a 
TChart.
-- 
Mark Jacobs
www.jacobsm.com 
Re: Setting a window dimensions larger than the screen display
#1297
Author: Asger Jørgensen
Date: Thu, 04 Oct 2007 17:44
30 lines
1675 bytes
Hi Mark

In article <47051a6f@newsgroups.borland.com>, mark@jacobsm.com 
says...
> 
> But, GetFormImage() won't yield a large bitmap, it will be just what of the 
> form is visible on screen. I need to get the form to be bigger than the 
> screen, and GetFormImage() to yield a bitmap that exceeds screen dimensions.
 
Have You tryed something like this ?

TBitmap* Bmp = new TBitmap();
Bmp->Width = Chart->Width;
Bmp->Height = Chart->Height;

BitBlt(
    Bmp->Canvas->Handle,	 
    0,0,Chart->Width,
    Chart->Height,	
    Chart->TeCanvas->Canvas->Handle,
    0,0,SRCCOPY
);

Bmp->SaveToFile(FileName);
delete Bmp;

**********  NOT TESTED  **********

Kind regards
Asger
Re: Setting a window dimensions larger than the screen display
#1198
Author: JD
Date: Fri, 05 Oct 2007 11:48
20 lines
1342 bytes
=?utf-8?Q?Asger_J=C3=B8rgensen?= <junk@Asger-P.dk> wrote:
>
>
>BitBlt(
>    Bmp->Canvas->Handle,	 
>    0,0,Chart->Width,
>    Chart->Height,	
>    Chart->TeCanvas->Canvas->Handle,

Shouldn't that be (?) :

    Chart->Canvas->Handle,

>    0,0,SRCCOPY
>);

Another option would be to use TCanvas::PaintTo.

~ JD
Re: Setting a window dimensions larger than the screen display
#1202
Author: Asger Jørgensen
Date: Fri, 05 Oct 2007 21:34
19 lines
1374 bytes
Hi JD

In article <4706249b$1@newsgroups.borland.com>, 
nospam@nospam.com says...
> 
> Shouldn't that be (?) :
> 
>     Chart->Canvas->Handle,

It should probably be:
 
Chart->Canvas->Canvas->Handle

since the first canvas is a special 3d canvas
acording to the help files. But I never used the
TChart

Kind regards
Asger
Re: Setting a window dimensions larger than the screen display
#1203
Author: Mark Jacobs
Date: Sat, 06 Oct 2007 15:27
27 lines
1971 bytes
"Asger J�rgensen" <junk@Asger-P.dk> wrote in message 
news:MPG.2170cc41e12c533989837@newsgroups.borland.com...
> It should probably be:
>
> Chart->Canvas->Canvas->Handle
>
> since the first canvas is a special 3d canvas
> acording to the help files.

The help files are incorrect. The only real TCanvas type of canvas I can 
access on a TChart is something called ReferenceCanvas. However, if I have 
Chart3 with width and height beyond the screen dimensions, and then do :-
Graphics::TBitmap *mjbmp=new Graphics::TBitmap();

TRect rc=Rect(0,0,Chart3->Width-1,Chart3->Height-1);

mjbmp->HandleType=bmDIB;

mjbmp->Height=Chart3->Height; mjbmp->Width=Chart3->Width;

mjbmp->Canvas->CopyRect(rc,Chart3->Canvas->ReferenceCanvas,rc);

to copy the chart picture to my bitmap, anything off-screen is chopped off! 
I am still stumped.
-- 
Mark Jacobs
www.jacobsm.com 
Re: Setting a window dimensions larger than the screen display
#1204
Author: JD
Date: Sat, 06 Oct 2007 18:14
18 lines
1500 bytes
"Mark Jacobs" <mark@jacobsm.com> wrote:
>
>
> [...] anything off-screen is chopped off!

Makes sense because windows would clip that drawing in the
first place.

> I am still stumped.

Try using TWinControl::PaintTo method. Something like:

    Bmp->Canvas->Lock();
    Chart->PaintTo( Bmp->Canvas->Handle, 0, 0 );
    Bmp->Canvas->Unlock();

~ JD
Re: Setting a window dimensions larger than the screen display
#1207
Author: Mark Jacobs
Date: Mon, 08 Oct 2007 12:09
14 lines
1684 bytes
"JD" <nospam@nospam.com> wrote in message 
news:4707d08e$1@newsgroups.borland.com...
> Try using TWinControl::PaintTo method. Something like:
>
>    Bmp->Canvas->Lock();
>    Chart->PaintTo( Bmp->Canvas->Handle, 0, 0 );
>    Bmp->Canvas->Unlock();
>

That works a treat! Thanks ever so muchly. :-)
-- 
Mark Jacobs
DK Computing
http://www.dkcomputing.co.uk
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads