C # Practical Method for dynamically setting and canceling the form skin

Source: Internet
Author: User

These two days are being written. NET final project. If you want to do an artist, you will use the IrisSkin control to start loading the skin. If you replace several models, you will be able to run it correctly. This has been a game for N times, but this time I want to add an option to change back to the default topic, that is, do not load the skin at startup, start the program, and then click a button to dynamically load the skin. Loading is okay. What hurts is that when we cancel (and finally get to the point), we load the skin implementation code

SkinEngine1.SkinFile = "skin file path ";

So let's think about how to cancel the skin. The theoretically implemented code is:

SkinEngine1.SkinFile = "";

Or

SkinEngine1.SkinFile = null;

In this way, the wood has skin, so the theoretical reasoning is based. When we load the skin, if we cannot find the skin file

SkinEngine1.SkinFile = null;

Is an effect. In practice, let's get a button and click write code.

SkinEngine1.SkinFile = null;

This is not the case when running the command. I have been searching for Baidu for a long time. I also went to the blog and CSDN to ask Daniel, and someone provided a specific implementation Code, later. in the NETQQ group, I found a teacher and gave him some research and finally got it done. Specifically, we added the third-party control IrisSkin. dll contains an attribute for activating and disabling skin controls.

SkinEngine1.Active = false;

It's that simple... whether we need to load the skin again

SkinEngine1.Active = true;

Activate it. Otherwise, the skin control is disabled. Naturally, the skin cannot be used...

Original small article, from

Seay's blog

Http://seay.sinaapp.com/

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.