Solved

PageControl and canvas

Posted on 1998-11-11
15
1,249 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
[X]
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
  • 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
Industry Leaders: 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 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

Enroll in July's Course of the Month

July's Course of the Month is now available! Enroll to learn HTML5 and prepare for certification. It's free for Premium Members, Team Accounts, and Qualified Experts.

Question has a verified solution.

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

Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
Monitoring a network: why having a policy is the best policy? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the enormous benefits of having a policy-based approach when monitoring medium and large networks. Software utilized in this v…
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…
Suggested Courses
Course of the Month11 days, left to enroll

628 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