1

enter image description here

sry i couldn't draw any better with paint. what i am trying to do here is create a tree structure (like the one in the picture) using TFrames. and basically when i press the + buttons, a new TFrame would be added to the tree. I am using C++ Builder, and I know how to do the adding of the TFrame, my problem is i don't know how to draw the green lines of the tree.

thanks in advanced.

livelaughlove
  • 376
  • 3
  • 9
  • 21
  • 1
    Assuming you are placing the `TFrame` instances directly onto a `TForm`, have you looked at using the `TForm::OnPaint` event to draw the lines between the `TFrame` instances? All you need is the coordinates of their top-left corners, and that is easy to determine via their `Left` and `Top` properties. – Remy Lebeau Feb 09 '12 at 20:38
  • hello again. it's actually going to be TFrame added into a ScrollBox. that way when the tree gets too big, you can scroll around to see more. – livelaughlove Feb 10 '12 at 16:54
  • Then try subclassing the `TScrollBox` to intercept `WM_PAINT` messages directly. – Remy Lebeau Feb 10 '12 at 19:45
  • i've been fiddling with this wm_paint for a few days. but mb i don't have much experience with subclassing, so i can't seem to get it to work. if you don't mind could u please give me a code snippet to help me. thank you very much – livelaughlove Feb 15 '12 at 19:34
  • 1
    `TWndMethod PrevWndProc; PrevWndProc = ScrollBox1->WindowProc; ScrollBox1->WndProc = &ScrollBoxWndProc; void __fastcall TMyForm::ScrollBoxWndProc(TMessage &Message) { PrevWndProc(Message); if (Message.Msg == WM_PAINT) {...} }` – Remy Lebeau Feb 15 '12 at 20:18
  • Solved? Provide us your way if so... – kokbira Sep 11 '12 at 19:42

0 Answers0