CS2008如何制作as3 rectanglee阵列

ISSUU - dissecting MFC 2e part1 by dan febird
dissecting MFC 2e part1
dissecting MFC 2e part1
《深入淺出 MFC》3/e 沒有如期完成的原因是,MFC 本體架構並沒有什麼大改 由於《深入淺出 MFC》2/e 並無簡體版,因此我時時收到大陸讀者來信詢問購 體版之授權,直接等 3/e 出版後再動作。沒想到?拖經年,我的 3/e 寫作計劃 我已在構思 3/e,預判 3/e 繁體版出版時,2/e 簡體版恐怕還未能完成。老是讓 並沒有如期完成,致使大陸讀者反而沒有《深入淺出 MFC》2/e 簡體版可看。 1 因此,此書雖已出版兩年,鑑於仍具閱讀與技術?的價值,鑑於繁簡轉譯製作 我所做的這份電子書是繁體版,我沒有精力與時間將它轉為簡體。這已是我能 告訴我,大陸某些書籍明顯對本書侵權(詳細情況我不清楚)。這種不尊重作 者的行為,我雖感遺憾,並沒有太大的震驚或難過。?個社會的進化,終究是 告訴我您閱讀成功與否,以及網?討論區(如有的話)在哪裡。 2Controlling z-order using the ZIndex Property - Windows Presentation Foundation User Education - Site Home - MSDN Blogs
Powered by
Controlling z-order using the ZIndex Property
Controlling z-order using the ZIndex Property
posting showed how you could layer multiple drawing objects in an XAML file. The sample XAML file in that posting used the default
behavior of objects in a collection. One of the changes made in WPF Beta 2 is the introduction of the ZIndex attached property, which allows you to explicitly set the z-order of objects in the child collection of Panel-derived objects, such as Canvas, Grid, and StackPanel objects.
Using the ZIndex PropertyTry running the following code in XAMLPad:
&Canvas Background="Ivory"xmlns="/winfx/2006/xaml/presentation"&& &Canvas&&&& &Rectangle Height="60" Width="60" Fill="Gold"/&&&& &Rectangle Height="50" Width="70" Fill="Coral"/&&&& &Rectangle Height="40" Width="80" Fill="Teal"/&&&& &Rectangle Height="30" Width="90" Fill="Black"/&& &/Canvas&
& &Canvas Canvas.Left="120"&&&& &Rectangle Canvas.ZIndex="99" Height="60" Width="60" Fill="Gold"/&&&& &Rectangle Canvas.ZIndex="98" Height="50" Width="70" Fill="Coral"/&&&& &Rectangle Canvas.ZIndex="97" Height="40" Width="80" Fill="Teal"/&&&& &Rectangle Canvas.ZIndex="96" Height="30" Width="90" Fill="Black"/&& &/Canvas&
Notice how the second set of Rectangle objects is layered in reverse z-order from the first set of Rectangle objects:
The first set of Rectangle objects uses the default z-ordering rendering of objects, which is based on the position of the child object in the Canvas collection -- the first object in the collection is rendered first, then the second object, and so forth. The second set of Rectangle objects uses the ZIndex property to override the default z-ordering of objects in the collection.
In the second set of Rectangle objects, I want to ensure that the first object (the Gold-colored one) is the highest in the z-order, or closest to the foreground.& I have defined its ZIndex value as "99" -- a purely arbitrary value. What is more important is that the value must be greater than any other child object ZIndex value in the Canvas collection. If you do not explicitly set the ZIndex value, it defaults to 0.
You can also set the ZIndex value to a negative value, such as "-99", which places the object even farther from the foreground.&ZIndex values are aligned along the z-axis -- higher values are closer lower values are farther from the foreground.
Relationship of z-order to z-axis
Accessing the ZIndex Value at Run TimeTo retrieve the value of the ZIndex property, use the GetZIndex method of the Panel-derived object:
int zOrder = Canvas.GetZIndex(object);
Likewise, to set the value of the ZIndex property, use the SetZIndex method:
Canvas.SetZIndex(object, (int)99);
A key performance issue is&that changing the ZIndex property of a child object does not change its position within the collection. The ordering within the collection remains the same.
Prior to the introduction of the ZIndex property, you would have had to do the following to change the z-order of objects in a collection:
& 1) Remove the child object from the collection.& 2) Re-insert the child object into the collection&&&&& at the desired position.
In short, the addition of the ZIndex property is a much easier and more efficient way to change z-order!
Enjoy,Lorin
We are the Windows Presentation Foundation SDK writers and editors.
Leave a Comment
An error occurred while posting! Please retry posting your comment.}

我要回帖

更多关于 rectangle函数 的文章

更多推荐

版权声明:文章内容来源于网络,版权归原作者所有,如有侵权请点击这里与我们联系,我们将及时删除。

点击添加站长微信