Technical feasibility report of WRITEABLEBITMAP in Silverlight game

Source: Internet
Author: User

The directory settings are as follows:

Scenario 1: Set the PNG file to Resource,do not copy.

Specify the source code for Image:

Spirit. Source = new BitmapImage (The new Uri (@ "player/" + Count + ". png", urikind.relative));

Note that the relative path is used, the position of the current MainPage.xaml relative to the picture, and the server path cannot be used.

If we specify the source of image in spirit, which means that the relative path is changed, then the code is written as:

Body.source = new BitmapImage (The new Uri (@). /player/2.png ", urikind.relative));

In this case, all the pictures are embedded as resources into the DLL, observing the organizational structure in the XAP, can confirm our conclusion:

Scenario 2: Set the PNG file to content,copy if newer.

Specify the source code for Image:

Spirit. Source = new BitmapImage (The new Uri (@ "/player/" + Count + ". png", urikind.relative));

Note that the server path is used instead of the relative path.

One advantage of using the server path is that, regardless of where the XAML resides in that directory, it can be ignored, such as the Spirit control above:

Body.source = new BitmapImage (The new Uri (@ "/player/2.png", urikind.relative));

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.