Paint.NET Learning Notes--first, start

Source: Internet
Author: User

Download from the http://www.afterdawn.com/software/source_codes/paint.net.cfm to the PDN3.05 source download down, unzip the SRC directory is the PDN solution directory, You can use VS2005 or VS2008 to open the solution.

In all projects, the core of the project is Data\effects\paintdotnet\pdnlib\systemlayer. And where Paintdotnet is the startup project, the program starts from Startup.cs.

Now let's see what the mystery is about PDN's launch.

The startup constructor accepts a string[] as the startup parameter.

The application starts with the main method, and we take a step-by-step look at how PDN started.

Constructs a new startup object using the startup parameters of the main method and calls the Start method.

The Start method registers an exception event in the application domain as soon as it comes in, which prevents the user from being overwhelmed by any unexpected pop-up. NET Exception dialog window in the application domain.

Next Check system dpi compatibility, where we trace the definition, into the SafeNativeMethods class, found that this class is not simple, here in addition to the method definition, there is no method of implementation, are exclusively [DllImport]. The younger brother is in a frog, and at first I don't understand what this attribute means, so I check MSDN:

The method described by [DllImport] is called unmanaged code of Windows itself and must be added to the Extend keyword and must all be static methods.

And the setprocessdpiaware in this call is illustrated here: http://msdn.microsoft.com/zh-cn/library/aa970067.aspx

Next, if the startup parameter does not contain "/skiprepairattempt", enter the StartPart2.

How does PDN correspond to a variety of language systems and can load different language resources?

Tracing into the settings class, at the top of the class, defines two read-only variables:

public static readonly Settings SystemWide = new Settings (Microsoft.Win32.Registry.LocalMachine);
public static readonly Settings CurrentUser = new Settings (Microsoft.Win32.Registry.CurrentUser);

These two variables get all the values of the localmachine and CurrentUser keys in the registry, and back in startup, the first sentence in StartPart2 is the value of the query CurrentUser "LanguageName", This key is written when the PDN is installed, in the registry path "Hkey_current_user\software\paint.net\". On my machine The value is "ZH-CN", which constructs the CultureInfo and sets it to the current process:

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.