C # How to Use Image File resources in project code

Source: Internet
Author: User

First, double-click the Resource under the project. resx, the view appears, click "Add resource" -- select "add existing file", find the image you want to add, and click "save". Then, open resource. designer. cs will find several more lines of code as follows: internal static System. drawing. bitmap ABC {get {object obj = ResourceManager. getObject ("ABC", resourceCulture); return (System. drawing. bitmap) (obj);} ABC indicates the image name. After adding the image, you can use the resource image switch (LeiBie) in the project code) {case "hot economic evaluation": pic. backgroundImage = Evaluation. properties. resources. economic Evaluation of hot harvest; break; case "Economic Evaluation of Water Flooding": pic. backgroundImage = Evaluation. properties. resources. economic Evaluation of water flooding; break; case "three-way economic evaluation": pic. backgroundImage = Evaluation. properties. resources. three-way economic evaluation; myLable7.Visible = false; myLable14.Location = myLable7.Location; break ;}

Related Article

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.