Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

PageControl and canvas

Posted on 1998-11-11
15
1,229 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
Networking for the Cloud Era

Join Microsoft and Riverbed for a discussion and demonstration of enhancements to SteelConnect:
-One-click orchestration and cloud connectivity in Azure environments
-Tight integration of SD-WAN and WAN optimization capabilities
-Scalability and resiliency equal to a data center

 
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 30 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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
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…
I've attached the XLSM Excel spreadsheet I used in the video and also text files containing the macros used below. https://filedb.experts-exchange.com/incoming/2017/03_w12/1151775/Permutations.txt https://filedb.experts-exchange.com/incoming/201…

791 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