Coder Social home page Coder Social logo

Comments (3)

nmgwddj avatar nmgwddj commented on May 18, 2024

对于 XML 来说,设置属性例如下代码

<Button width="100" height="30" margin="10,10,10,10" text="TestButton" normaltextcolor="darkcolor" />

对于 CSS 来说

Button {
	width: 100px;
	height: 30px;
	margin: 10px;
	color: #222;
}

除了 Button text 的定义可能不一样以外,其他基本都是类似的,XML 中控件支持的属性远没有 CSS2 的特性支持要多,CSS3 就更加多种多样了。如果您还认为 XML 的属性太多,或者您更倾向于使用 CSS 方式来定义控件的样式,也欢迎您开启一个分支提交一些基础结构代码,来一起完善类似功能。

from nim_duilib_framework.

01haike avatar 01haike commented on May 18, 2024

<RichEdit class="te_simple_edit te_simple_edit_color" name="password" prompttext="Password" promptcolor="dark_gray" password="true" font="1" width="stretch" height="25" bordersize="1" bordercolor="te_border_color" margin="0,5,0,0" borderround="6,6"></RichEdit>

比如这样的 xml 就有点多。xml 还容易出错,不易读,如果界面复杂一些的话,会有很多嵌套。并且改的时候把tag 不小心删掉会导致加载失败。不容易排错。
当然了,xml这种方式比自绘控件强太多了。

from nim_duilib_framework.

nmgwddj avatar nmgwddj commented on May 18, 2024

从使用上您可以用一些功能丰富的 XML 编辑器,比如 notepad++、VisualStudio 的文本编辑器都是很好的 XML 文件编辑工具。这些编辑器在出现缺少关键字或者语法错误的时候都会有相应的界面提示。
另外您也可以在定义自定义全局 class 属性放到 global.xml 中,这样就不会产生大量重复的样式代码了。这类似 LESS 语法中的全局变量,方法都是可以变通的。

from nim_duilib_framework.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.