Solved

PageControl and canvas

Posted on 1998-11-11
15
1,209 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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
Hi,
just place TPaintBox on your tabsheet and then draw on TPaintBox.Canvas.

A.
0
 
LVL 10

Expert Comment

by:viktornet
Comment Utility
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
Comment Utility
what is it?
explain what does what
0
 
LVL 4

Author Comment

by:jack_p50
Comment Utility
In Delphi 4 pagecontrol has canvas, but for what if it doesn't draw on pages.
0
Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

 
LVL 4

Author Comment

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

Expert Comment

by:333
Comment Utility
Doesn't TImage deal with big image?

A.
0
 
LVL 10

Expert Comment

by:viktornet
Comment Utility
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
Comment Utility
333, post your comment as answer, i want to give you pts. Sorry, viktornet. What is hDC?
0
 
LVL 10

Expert Comment

by:viktornet
Comment Utility
(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
Comment Utility
Hi,
       just place TPaintBox on your tabsheet and then draw on TPaintBox.Canvas.

       A.
0
 
LVL 4

Author Comment

by:jack_p50
Comment Utility
I want to know more about HDC
0
 
LVL 10

Expert Comment

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

Cheers,
Viktor
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're looking for how to monitor bandwidth using netflow or packet s…
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.

771 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

10 Experts available now in Live!

Get 1:1 Help Now