Start a Windows desktop application using the D language--Dgui library compilation and use

Source: Internet
Author: User

There are many tools for developing desktop applications on Windows, such as early vb,vc+mfc and so on. NET, it is easier to develop desktop applications using C #, and C # 's object-oriented packaging of Windows makes program development updates easy and reusability much better, but always with. NET a huge environment. The use of Dgui can not only remove the huge environment of. NET, but the Dgui class package structure and C # form structure are similar, making the program development is very convenient.

First, download Dgui library

Dgui Library is open source project, Project address: Https://bitbucket.org/dgui/dgui, the last update date for 2015-02-02, it seems like a long time has not been updated, do not know is not the author has not maintained. Also cannot use the latest DMD compile, only use dmd2.066.1 version compile, Source: Https://bitbucket.org/dgui/dgui/get/d024c84e98ff.zip

There are several examples of compiled programs in the project: https://bitbucket.org/dgui/dgui/downloads/DGui%20samples.7z

Second, take a look at the operation results of the example program

Unzip the downloaded Dgui samples.7z file, such as:

There are 11 example programs, where Resources.exe is compiled with a resource file, and the icons are displayed differently. Run a few tries.

Events.exe diagram (only one button)

Gradient_rect.exe using GID-drawn interface


Grid.exe table layout Multi-control display

Splitter.exe using the splitter bar control layout

Toolbar_32_x_32.exe using the tool box to display the tool buttons

See a few examples of the program run the interface, the effect is very good, the direct use of Windows to bring the style, a bit like the C # written out of the program to run the effect, more than from Linux to move the value of the GUI display effect is better, more Windows interface taste. It is also worthwhile for Windows programmers to develop projects to use.

Third, compiling Dgui

Dgui because of a long time not updated reason, can only use the dmd2.066.1 version compiler compiler, which needs to be set in Vasuald. Began:

Using more than 2.067 of the version is not compiled.

Dgui after extracting the directory as follows

Dgui tools using VS2008 built project, I have tested, using vs2013 Open is also possible, using vs2013 open only need to do one conversion:

After conversion, it can be used directly and compiled successfully, such as:

Release version is also directly compiled successfully.

Dgui's compilation is mainly to pay attention to the version of DMD must be 2.066.1, the future version has not been compiled by now.

Iv. Use of Dgui

Dgui has been compiled, we built a project to use it, this is a very good experience.

Create a new USR directory in the dmd.2.066.1.windows directory, and then build src,lib two directories in the USR directory, such as:

C:\D\DMD.2.066.1.WINDOWS\USR Directory

Copy the Dgui source directory to the SRC directory, as shown in:

The compiled Dgui.lib file is copied to the Lib directory, as shown in the debug version to re-name Dgui_debug.lib

Open the settings for the visual-d of vs2013 and set it as follows:

Add C:\D\DMD.2.066.1.WINDOWS\USR\SRC to the import paths entry, which allows the compiler to search for the directory import symbol in the compilation.

Add C:\D\dmd.2.066.1.windows\usr\lib to library paths, this setting allows the compiler to automatically search the directory for connection libraries when connected.

When set up, create a new Windwos project, such as:

After you create a new project, open the project's property page to add a connection to the Dgui.lib library, as follows:

After emptying the WINMAIN.D code, write our own code, as follows:

Import Dgui.all;

int main (string[] args)
{
Form f = new form ();
f.size = size (300,200);
F.startposition = Formstartposition.centerscreen;

Label LBL = new label ();
Lbl.text = "Hello!" Test ";
Lbl.dock = DockStyle.Fill;
Lbl.alignment = Textalignment.center | Textalignment.middle;
Lbl.parent = f;

Application.Run (f);
return 0;
}

After compiling the program, debug runs such as:

Done. ~~~~

Wan Hong Nan

Start a Windows desktop application using the D language--Dgui library compilation and use

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.