Solved

PageControl and canvas

Posted on 1998-11-11
15
1,215 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
 
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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
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…
Windows 10 is mostly good. However the one thing that annoys me is how many clicks you have to do to dial a VPN connection. You have to go to settings from the start menu, (2 clicks), Network and Internet (1 click), Click VPN (another click) then fi…
Migrating to Microsoft Office 365 is becoming increasingly popular for organizations both large and small. If you have made the leap to Microsoft’s cloud platform, you know that you will need to create a corporate email signature for your Office 365…

912 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

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now