Board index » delphi » Help with TPanel's

Help with TPanel's

Hello,

I'm pretty new to Delphi and am having some problems with panels.  I'm
developing a CADD program for surveyors.  I'm stuck at a point where I'd
like to display multiple views of an object in the same window.  I thought I
could put a couple of panels on my form, with two scroll bars and a paint
box on each panel.  The Scroll bars would be used to pan up/down, and pan
left/right.  The Paint Box would have the canvas that I could draw either
view fo the object on.

I can display the object in a window by itself, but when I try to use the
panels all I can see are the panels.  I could really use some help.  Thanks
in advance.

Scott Hoggarth

 

Re:Help with TPanel's


Hello again,

I thought I might not have given anyone enough to work with so here is my
form paint, at this point I only have one panel on the form.  When this
procedure is called, I can see the things drawn for a second, but then the
panel comes back.

procedure TfrmCross.CrossPaint(Sender: TObject);
begin

  {Send panel to the back??}
  pnlSideView.sendtoback;

  {Draw the Road}
  m_road.connect(pbSideView.Canvas);
  {Draw the Points}
  DrawPoints;
  {Draw the Cursor}
  m_cursor.DrawCursor;

  {Bring the Drawing to the front}
  pbSideView.BringToFront;

end;

Thanks for the help.

Scott Hoggarth

Re:Help with TPanel's


I can't tell exactly what you are trying to do here, but it seems to me that
if you are drawing into a tpaintbox which is a child of a tpanel which is a
child of a tform...that you should be using the OnPaint method of the
Paintbox rather than the form.

I can't tell from your code which canvas you are drawing to.  From what you
describe, though, it sounds like you are drawing to one canvas and then
immediately covering it up with the BringToFront call...

--Partap Davis

In article <6mu96h$sg...@node2.nodak.edu>,
  "Scott Hoggarth" <shogg...@badlands.nodak.edu> wrote:

Quote

> Hello again,

> I thought I might not have given anyone enough to work with so here is my
> form paint, at this point I only have one panel on the form.  When this
> procedure is called, I can see the things drawn for a second, but then the
> panel comes back.

> procedure TfrmCross.CrossPaint(Sender: TObject);
> begin

>   {Send panel to the back??}
>   pnlSideView.sendtoback;

>   {Draw the Road}
>   m_road.connect(pbSideView.Canvas);
>   {Draw the Points}
>   DrawPoints;
>   {Draw the Cursor}
>   m_cursor.DrawCursor;

>   {Bring the Drawing to the front}
>   pbSideView.BringToFront;

> end;

> Thanks for the help.

> Scott Hoggarth

-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/   Now offering spam-free web-based newsreading

Re:Help with TPanel's


Quote
Scott Hoggarth wrote:

> Hello again,

> I thought I might not have given anyone enough to work with so here is my
> form paint, at this point I only have one panel on the form.  When this
> procedure is called, I can see the things drawn for a second, but then the
> panel comes back.

> procedure TfrmCross.CrossPaint(Sender: TObject);
> begin

>   {Send panel to the back??}
>   pnlSideView.sendtoback;

>   {Draw the Road}
>   m_road.connect(pbSideView.Canvas);
>   {Draw the Points}
>   DrawPoints;
>   {Draw the Cursor}
>   m_cursor.DrawCursor;

>   {Bring the Drawing to the front}
>   pbSideView.BringToFront;

> end;

> Thanks for the help.

> Scott Hoggarth

i think the problem is the canvas you're using.
If you're using a form or a panel canvas your painting is not in statik
memory.
First place a TPaintBox or a TImage component on your form and use the
canvas of these objects instead.

Other Threads