Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to use HTML/CSS/JS to build the. Net Winform application interface

2025-01-30 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/02 Report--

This article is about how to use HTML/CSS/JS to build. Net Winform application interface, the editor thinks it is very practical, so I share it with you. I hope you can get something after reading this article.

What is NanUI?

NanUI is developed based on the ChromiumFX project, which allows you to use web technologies such as HTML5/CSS3/Javascript to render the user interface (similar to Electron) in your Winform applications. At the same time, NanUI provides native windows and customized no title bar and no border windows, you can use all the web technology to design and render your application interface.

Open source mode

NanUI is based on the MIT protocol, so whether you use NanUI to develop commercial projects or open source or free projects will not be subject to any restrictions, just follow the agreement documents, declare the use of NanUI technology in your software.

Series of documents

Introduction to NanUI

Start using NanUI

Package and use embedded HTML/CSS/JS resources

Use web pages to design the entire window

How to implement the mutual interoperability between C# and Javascript (to be updated.)

How to handle the download process in NanUI-the use of DonwloadHandler (to be updated.)

How to handle the pop-up window process in NanUI-the use of LifeSpanHandler (to be updated.)

How to control the use of Javascript dialog box-JsDialogHandler (to be updated.)

Custom resource handler (to be updated.)

Source code and package

You can get the source code and sample code of NanUI through GitHub, and the stable version of NanUI package is distributed through Nuget. NanUI supports. Net 4.0 / 4.5 Windows 4.6 Universe 4.7 and newer versions of Web forms applications.

Get the source code

Git clone https://github.com/NetDimension/NanUI.git

Nuget package Manager

General version (CEF 3.2987.1601.gf035232 / Chromium 57.0.2987.133)

PM > Install-Package NetDimension.NanUI

WindowXP version (CEF 3.2526.1366.g8617e7c / Chromium 47.0.2526.80)

PM > Install-Package NetDimension.NanUI.XP

It is recommended that you use the Nuget package manager to install the NanUI assembly, which will automatically install the corresponding CEF dependencies, which is easy to use with one click.

How to compile source code and examples

Compiling the current version of NanUI requires a compiler that supports Category 7.0 syntax, and the recommended compiler has and only Visual Studio 2017.

How to use

Initialize NanUI

Namespace TestApplication {

Using NetDimension.NanUI

Static class Program {[STAThread] static void Main (string [] args) {Application.EnableVisualStyles (); Application.SetCompatibleTextRenderingDefault (false)

/ / initialize CEF: set the relevant Path of CEF / / if you want to use the fx folder structure downloaded automatically by Nuget You need to manually specify the path to each folder var result = Bootstrap.Load (PlatformArch.Auto, System.IO.Path.Combine (Application.StartupPath, "fx"), System.IO.Path.Combine (Application.StartupPath, "fx\\ Resources"), System.IO.Path.Combine (Application.StartupPath, "fx\\ Resources\\ locales")) If (result) {/ / Load embedded html/css resources in assembly. Bootstrap.RegisterAssemblyResources (System.Reflection.Assembly.GetExecutingAssembly ()); Application.Run (new Form1 ()); Application.Exit ();}

Use native window styles to use NanUI

Namespace TestApplication {

Public partial class Form1: Formium {public Form1 ()

/ / Load embedded resource index.html and not set form to no border style by the second parameter. : base ("http://res.app.local/index.html", false)

{InitializeComponent ();}

Use borderless mode to use NanUI

Namespace TestApplication {public partial class Form1: Formium {public Form1 () / / Load embedded resource index.html and set form to no border style by igrone the second parameter or set it to true. : base ("http://res.app.local/index.html") {InitializeComponent ();}

Please note: if you use Visual Studio 2015 or earlier to develop and debug NanUI applications, you need to turn off the enable VS hosting process option in the debugging tab of the project properties, otherwise the page will not load a white screen when debugging. As shown in the figure:

The above is how to use HTML/CSS/JS to build the. Net Winform application interface, the editor believes that there are some knowledge points that we may see or use in our daily work. I hope you can learn more from this article. For more details, please follow the industry information channel.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report