Board index » cppbuilder » Z-Order
JD
![]() CBuilder Developer |
JD
![]() CBuilder Developer |
Z-Order2005-06-13 08:41:47 AM cppbuilder46 Can some one please confirm that Screen::Forms preserves the z-order? Alternatively, can you confirm that Scr{*word*249}::Forms does *not* preserve the Z-order? Ultimately, can you tell me how, at any given moment, to be able to detect the z-order for any given control? ~ JD |
JD
![]() CBuilder Developer |
2005-06-13 08:23:40 PM
Re:Z-Order
"JD" < XXXX@XXXXX.COM >wrote:
Quote
~ JD |
JD
![]() CBuilder Developer |
2005-06-14 10:52:04 AM
Re:Z-Order
"JD" < XXXX@XXXXX.COM >wrote:
Quote
{smallsort} |
UO
![]() CBuilder Developer |
2007-10-25 04:21:03 PM
Re:Z-Order
Hi,
I've been developing a kind of drawing utility. The objects are linked to each other through a linked-list. Each object has a member of (TBitmap *). struct Node { int X, Y; Graphics::TBitmap() *pBitmap; Node *next; }; Assume 100 objects are displayed on the form and they are displayed throug a loop, for example: for(i = 0; i < 100; i++, n=n->next) Canvas->Draw(n->X, n->Y, n->pBitmap); I'd like to exchange the display order of 6th end 7th objects. I can do it simply by modifying the linked list(exchanging 6th and 7th objects) and execute another for(i = 0; i < 100; i++, n=n->next) Canvas->Draw(n->X, n->Y, n->pBitmap); I guess, this is time-consuming and I'm planning to replace the (TBitmap *) member with (TImage *). So, instead of drawing 100 objects every time, it may be better to create the (TImage *) members once: n->pImage = new TImage(this); n->pImage->Left = 0; n->pImage->Top = 0; and let Windows handle displaying them. Again, I'd like to exchange the display order of 6th and 7th objects. I know how to use TControl::BringToFront() and TControl::SendToBack() methods. So, exchanging the display order is: 7->SendToBack(); 5->SendToBack(); 4->SendToBack(); 3->SendToBack(); 2->SendToBack(); 1->SendToBack(); Using SendToBack() is quite fast: TImage *im, im2; ... for(int i = 0; i < 100000; i++) { im->SendToBack(); im2->SendToBack(); } is executed only in ~850msec on my computer. Is it the recommended way or is there a better way(Exchange(6, 7) ?, or a low-level Win API function) Thanks... |
=?utf-8?Q?Asger_J=C3=B8rgensen?=
![]() CBuilder Developer |
2007-10-25 05:24:43 PM
Re:Z-Order
Hi UO
You should realy have a look at the STL containers They will make Your life a lot easier, not to mention safer. either std::vector or std::list in this case Kind regards Asger |