Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

PageControl and canvas

Posted on 1998-11-11
15
Medium Priority
?
1,279 Views
Last Modified: 2010-04-04
 I use pagecontrol(3 pages) and i draw 256 color boxes
on 1 page (using pagecontrol's canvas). And it doesn't draws
on page itself, it seems that page is redrawing it.
  I tried to do this on pagecontrol.drawtab event but same
result. Any ideas?
  Also, how can i use memory in Delphi to store big image
(really big).
0
Comment
Question by:jack_p50
  • 6
  • 4
  • 3
  • +1
15 Comments
 
LVL 27

Expert Comment

by:kretzschmar
ID: 1346544
hi for jack_p50,

i think pagecontrol is a container for tabsheets, and so you must draw on tabsheet.canvas.

meikl
0
 
LVL 4

Author Comment

by:jack_p50
ID: 1346545
tabsheet doesn't have canvas, i also tried palettepage.pagecontrol.canvas -it doesn't work
                                                        this is my tabsheet

0
 
LVL 27

Expert Comment

by:kretzschmar
ID: 1346546
hi jack_p50,

you've right tabsheet has no canavs, sorry (first look at before comment), but pagecontrol also have no canvas in my delphiversion (D3). how do you paint to pagecontrols canvas, when there is none?

meikl


0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 2

Expert Comment

by:333
ID: 1346547
Hi,
just place TPaintBox on your tabsheet and then draw on TPaintBox.Canvas.

A.
0
 
LVL 10

Expert Comment

by:viktornet
ID: 1346548
Hello guys :)

Here is how...

             DC := GetDC(RichEdit1.Handle);
             BitBlt(Image1.Canvas.Handle,0,0,Width, Height, DC,0,0, SRCCOPY);
             ReleaseDC(RichEdit1.Handle, DC);

var
  DC : hDC;
begin
  DC := GetDC(TAbSheetName.Handle);
  BitBlt(DC, 0, 0, TabSheetName.Width, TabSheetName.Height,
    Bitmap.Canvas.Handle, 0, 0, SRCCOPY);
  ReleaseDC(TabSheetName.Handle, DC);
end;

This should do the job... If you need more help just say so :)

Cheers,
Viktor
0
 
LVL 4

Author Comment

by:jack_p50
ID: 1346549
what is it?
explain what does what
0
 
LVL 4

Author Comment

by:jack_p50
ID: 1346550
In Delphi 4 pagecontrol has canvas, but for what if it doesn't draw on pages.
0
 
LVL 4

Author Comment

by:jack_p50
ID: 1346551
Thanx, 333. Paintbox really helped. And how to store big image in mem and deal with it?
0
 
LVL 2

Expert Comment

by:333
ID: 1346552
Doesn't TImage deal with big image?

A.
0
 
LVL 10

Expert Comment

by:viktornet
ID: 1346553
You actually need to use only this code...

var
     DC : hDC;
   begin
     DC := GetDC(TAbSheetName.Handle);
     BitBlt(DC, 0, 0, TabSheetName.Width, TabSheetName.Height,
       Bitmap.Canvas.Handle, 0, 0, SRCCOPY);
     ReleaseDC(TabSheetName.Handle, DC);
   end;

You can put it for example in OnClick() of a button or something....try it out....

TabSheetName - This is the name of the Tabsheet you want to draw on...e.g. TabSheet1

Bitmap - This is the bitmap you want to draw on the tabsheet.. YOu may also use Image1 instead of Bitmap and then it would be Image1.Bitmap instead of Bitmap...

Hope this helps...

Cheers,
Viktor
0
 
LVL 4

Author Comment

by:jack_p50
ID: 1346554
333, post your comment as answer, i want to give you pts. Sorry, viktornet. What is hDC?
0
 
LVL 10

Expert Comment

by:viktornet
ID: 1346555
(Edited by Computer101)...

Tha answer I gave you is more elegant than putting a PaintBox in the TAbsheet,,,

If you don't know what hDC is better find a place to learn it,,,,       DC(Device Context) hDC is simply the TYPE that Delphi uses to declare a DC...

Vik
0
 
LVL 2

Accepted Solution

by:
333 earned 60 total points
ID: 1346556
Hi,
       just place TPaintBox on your tabsheet and then draw on TPaintBox.Canvas.

       A.
0
 
LVL 4

Author Comment

by:jack_p50
ID: 1346557
I want to know more about HDC
0
 
LVL 10

Expert Comment

by:viktornet
ID: 1346558
Go find some DOCs that talk about it.. It's complicated....

Cheers,
Viktor
0

Featured Post

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
this video summaries big data hadoop online training demo (http://onlineitguru.com/big-data-hadoop-online-training-placement.html) , and covers basics in big data hadoop .
Please read the paragraph below before following the instructions in the video — there are important caveats in the paragraph that I did not mention in the video. If your PaperPort 12 or PaperPort 14 is failing to start, or crashing, or hanging, …
Suggested Courses

916 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question