天天看點

Windows Phone 實用開發技巧(27):建立透明Tile

What do you see in this image shown below ?

<a href="http://images.cnblogs.com/cnblogs_com/alexis/201111/201111012044093380.png"></a>

Do you see the same tile with different background called accent color in windows phone . So how can we create such tile . One simplest way is we replace ApplicationIcon.png with a transparent png file. But as we know it is just main tile of our app. Can we create own tile since we can pin what we want to start ?

Yes, we can do that. All we need to do is to create a transparent png file and save it to Isolated.

Maybe you have already know, we can save jpg file to Iso with following code:

or

Here is CreateBackground method looks like:

And as we run it we can see what shown below:

<a href="http://images.cnblogs.com/cnblogs_com/alexis/201111/201111012044111545.png"></a>

Another way is just render it within ImageOpened event:

I have a test on it(Conculsion is prefer to use second way as it’s faster and more stable! )

Tranditonal took 239 ms, Image size 6.11kb 

Render took 10 ms, Image size 5.24kb.

     本文轉自xshf12345 51CTO部落格,原文連結:http://blog.51cto.com/alexis/706532,如需轉載請自行聯系原作者

繼續閱讀