Diverse and interactive winform UI design and development ideas (flash, HTML, etc)

Source: Internet
Author: User
Tags windows visual
Most We have been working on winform-related systems for the past year. We have some ideas for winform's uidesign (mainly busy, so many of them are just ideas and there are no development instances yet)

As for winui, the ideal situation should be cool appearance, which gives users a good user experience and impression, while taking into account both powerful functions and easy development. However, based on the traditional. Net windowsforms, except for the ease of development, other indicators are common. For the sake of interfaces and functions, the complexity will be improved a lot. Using a large number of GDI + and API operations will give a headache to many people.

The following are some ideas:

Custom Control WriteCodeCustom Controls
Shell Style Use shell style tools
Flash Control Use flash controls
HTML Control Use HTML controls

Programming to Implement various style controls. This is a common and familiar method and also mentioned above. Let's focus on the three following methods.

Windows Shell Style

I don't know if you have used some software to change the appearance of windows after getting tired of Windows Default forms and menus. For example, many Stardock products (Do you know windowblinds) and tgtsoft stylexp.

Easily change windowsProgramAppearance

In fact, Microsoft introduced the visual style concept in Win2000, XP, and 2003 systems, that is, the system exterior theme. It provides APIs to conveniently modify the overall appearance of Windows Forms and controls. So after we change the theme of windows, the buttons and shapes of most programs will change (in. NET may need to set the flatstyle of the control to system and enablevisualstyles () to be valid)

Here we will mention the tgtsoft stylexp tool, which is based on the Windows visual style architecture and has its own APIs. In addition, it has other advantages, such as its various appearance styles, all are packaged in a DLL file, and there are also corresponding tools (stylebuilder) to create these style DLL.

After stylexp is installed, find the DLL file for the topic in the "C: \ WINDOWS \ resources \ themes \ topic name \ shell" directory.

Stylebuilder allows you to customize your own windows appearance

With these foundations, we can use the shellstyle API in our program to apply these styles. By loading different resource DLL, we can easily change the appearance of the software. Of course, in this way, the controls you use are still traditional Windows controls, so there are still some limitations.

As for how to use the shellstyle API, there is a good example in codeproject: themed Windows XP style explorer bar

Flash Control

We know that the emergence and popularity of Flash are due to the Web environment. However, with the development of flash, its functions are not limited to web. One idea I proposed here is to apply Flash as a control in winform. The wallop of Microsoft Research Institute is fully used in flash.

First, let's take a look at the technical prerequisites for this implementation:

1 Macromedia provides ActiveX controls for Flash Player, which can be directly embedded into winform.
2 Flash itself provides Form Controls like Web environments (Textbox, button ..)
3 Flash provides a data exchange function with the outside world to send events through fscommand.
4 Flash can use ActionScript (a javascript-like script) to control its internal behavior.
5 Flash has good support for HTTP and XML
6 Flash supports WebService

If you do not know or are familiar with flash before, when you see so many exciting features, the spark of various ideas in your brain has been emerging? Flash not only helps us implement various powerful interaction functions in winform, but also supports rich clients similar to smartclient through WebService (smartclient is neither fat nor thin client) ^

Let's take a look at the above points. Flash really attracts us to solve them.ArticleSome features of the problem mentioned above:

1 Flash is based on stream transmission, which is very small and embedded into browsers
2 Pure flash can achieve cross-platform
3 Powerful expressiveness of flash in animation effects and user interaction
4 Easy Implementation of Flash Dynamic Interaction Effect (compared with winform programming)

Flash appearance

HTML Control

since flash can be used in an application, what about HTML pages? Of course you can. In fact, this is not a new method. For example, Microsoft has used this technology widely in its software for a long time, such as MSN. Nested HTML in an application, the advantage is that the application can be made as the web, the degree to which a webpage looks, your controls, and forms can also be done. On a webpage, we use HTML code, table tables, form forms, various images, and CSS to create beautiful interfaces. In winform, it is a great project to achieve the same effect by code. The adjustment of these interfaces may be very convenient to modify one piece of CSS in HTML, and may be equivalent to rewriting the control in winform. These are the important reasons for us to use flash control or HTML control: It is very convenient to develop and modify its content and style.

Nested HTML in winform. Currently, we can only use the COM component webbrowser, which is not very convenient to use in. net.

The key issue is that the webbrowser and HTML control discussed here are the control or part of the software system, rather than simply the browser. That is to say, the first thing we care about is its interface, and then its interactivity. That is, these HTML control containers must be able to access and control the HTML content and behavior.

It is easier to obtain control attributes in HTML in winform, but have you ever thought that HTML nested in your winform can still access objects in winform? Let's take a look at lostinet's article:

Use mshtml and webbrowser to generate beautiful and practical winform applications.



Because webbrowser uses the navigate () method to access a specified HTML page, the location of this page is nothing more than the following:

1. remote Web servers such as http://www.tempuri.org/somepage.htm or http://www.tempuri.org/somepage.aspx

2. Local Web server, such as http: // localhost/somepage.htm or http: // localhost/somepage. aspx

3. Local file system, such as D: \ mysoft \ welcome.htm (static page only)

The problem is that when you publish your software, these HTML needs to be released together and completely exposed to users. Is there a way to pack HTML together?

Webbrowser needs to browse a URL. That's right. But can this web server be created by virtual machines when our software is started? In fact, we can use

The system. Web. Hosting. applicationhost. createapplicationhost () method creates our own web host environment.

It uses a local directory as the root virtual directory, and then opens a new applicationdomain in the memory to act as the web host. In this appdomain, we can use httpruntime. processrequest (New simpleworkerrequest (page, query, writer) to process a request. The web host environment can run both static html and ASP. net :) that is to say we can use ASP. net to develop our winform control, and our software is embedded with a small ASP.. NET Server.

Here we can embed all the pages into your software as resources, and then release them to a temporary directory during running, then let webbrowser directly access this directory, or start your web host to access the virtual path provided by it.

Is there a better way? I want to write a complex web host that can read HTML directly from resource files, rather than through virtual directories. In this way, we can package all the pages used and even the whole website into a DLL :)

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.