EasyUI:基于 EasyX 的 UI 界面库(by 祝融)
EasyUI 类构成指南
EasyUI 将 UI 拆分成了两个部分--绘制单元和事件触发器。
使用者可以使用绘制单元来控制 UI 的风格,同时选择一定的事件触发器来使 UI 具备响应事件的功能。
绘制单元:
-CDrawCell:所有绘制单元的基类
-CSimpleShape:继承自 CDrawCell,集成了通过 EasyX 图形绘制函数绘制的图形属性
-CHaveSize:所有拥有大小的类的基类
-CRect:继承自 CSimpleShape,绘制一个矩形
-CRoundRect:继承自 CSimpleShape,绘制一个圆角矩形
-CCircle:继承自 CSimpleShape,绘制一个圆形,并以绘制位置为中心(所有绘制单元都从左上角画起,除了圆)
-CEllipse:继承自 CSimpleShap,绘制一个椭圆(通过外接矩形)
-CText:继承自 CDrawCell,输出一串字符串
-CUIImage:继承自 CDrawCell,绘制一张图片
触发器:
-CTrigger:所有触发器的基类
-CRectTrigger:矩形触发器
-CCircleTrigger:圆形触发器(同样是特殊的,以圆心为位置中心)
-CMaskTrigger:遮罩图触发器,通过像素级的判断,实现精准的位置判断(对 png 支持并不好)
控件:
-CGUIElement:所有 UI 的基类
-CStaticUI:静态 UI,拥有 1 个风格,不存在事件响应
-CButton:按钮组件,拥有 3 种状态下的风格,以及 1 个触发器,通过回调函数执行点击事件,绘制器的位置不随按钮位置改变(考虑到按钮的风格定制)
-CInputTextBox:输入框组件,拥有 1 个输入框背景的风格定制,以及 1 个触发器,可以设置 1 个当值改变时执行的函数和 1 个当退出焦点时执行的函数
-CDragBar:拖动条组件,拥有拖动块和背景条 2 个风格定制,以及同样的 2 个触发器,支持值改变时和松开时执行的函数,值范围 0-1
-CPreBar:进度条组件,拥有覆盖条和背景框 2 个风格定制,不支持事件响应,值范围 0-1
-CCheckBox:选项框组件,拥有选择后显示的内容和背景框 2 个风格定制,支持值改变的时候执行的函数
Tips:
-如何构建一个复杂的绘制单元(如矩形内包含圆形再包含图片,文字)? 通过 CDrawCell 的 SetChildCell,添加子单元,子单元将在覆盖再父单元上绘制,理论上可以设置无数层子单元。
-如何扩展绘制单元风格? 继承 CDrawCell 即可,需要注意的是,必须根据单元的位置进行绘制,并且写好子单元绘制来支持子单元。
-示例中没用到的功能:CreateMask(CSimpleShape*,bool): 使用图形简单的抠图,并可以实现反向剪裁,需要注意的是,传入的绘制单元的位置是相对于图片左上角的位置。
范例程序的执行效果如下:

完整的 EasyUI 源代码及范例程序【请点击这里下载】。
作者:祝融
QQ:211103376
邮箱:211103376@qq.com
https://yuanzhuo.bnu.edu.cn/user/041e82095a5ab8111d90b5c3568db616d26b49a6/about
https://yuanzhuo.bnu.edu.cn/user/e9109529f4563633a2fdfa3c830329bff2254eca/about
https://yuanzhuo.bnu.edu.cn/user/bd8e6fee46e936d1cf5626b1daa96a56786493aa/about
https://yuanzhuo.bnu.edu.cn/user/36c773a219f7a4c34f61c9a9a9b7e732b6a61191/about
https://yuanzhuo.bnu.edu.cn/user/91017ea2bf2c1c20414dc7aee66877f48d663359/about
https://yuanzhuo.bnu.edu.cn/user/7554ac3f60c841698dfc80c99946c8d45b846367/about
https://yuanzhuo.bnu.edu.cn/user/53f12fac424eafbfefbbc9ccf35bc1c9c0b54b01/about
https://yuanzhuo.bnu.edu.cn/user/9f47e71df3729349afb0fec7c6363a4aa3aa770f/about
https://yuanzhuo.bnu.edu.cn/user/5b810c02a7708a95b20008b7714d7ea629a05d57/about
https://yuanzhuo.bnu.edu.cn/user/6fab4ce075d09bdeb98eee4baf0436db7defbe88/about
https://yuanzhuo.bnu.edu.cn/user/a25f221cee213a7c47e2a4b866bc836b045cc251/about
https://yuanzhuo.bnu.edu.cn/user/710723ae3f0d9a08eb118d280d0d5a146d7d4ea3/about
https://yuanzhuo.bnu.edu.cn/user/c2c8a7151bb926218c82fc93f3de8c58401000c2/about
https://yuanzhuo.bnu.edu.cn/user/d2042ae2911972806ebe5513ae8b783f7581762a/about
https://yuanzhuo.bnu.edu.cn/user/d5130ea957f5787745d73fe107b81fc2c7821902/about
https://yuanzhuo.bnu.edu.cn/user/5d9a39816794a129111c1beb4a0920a121cdd5f5/about
https://yuanzhuo.bnu.edu.cn/user/83b1906d95ec13cc8d91f02910dedbb6c79984cb/about
https://yuanzhuo.bnu.edu.cn/user/b4386f43b1830bf2651f2933908d281753e904f8/about
https://yuanzhuo.bnu.edu.cn/user/b49c00c6119add9803c163f8704263944df6abcd/about
https://yuanzhuo.bnu.edu.cn/user/8db0d36436fc3802ca0fd828306edaef8fca053f/about
https://yuanzhuo.bnu.edu.cn/user/1f5315f7d67abe39db2cbf65d1fe0ab61e53e216/about
https://yuanzhuo.bnu.edu.cn/user/476b85b9bf9de6f84fc6b8961e6f28dd3143b3ae/about
https://yuanzhuo.bnu.edu.cn/user/fff5d3fc42938cdf844fefd7974d96343e4ac4a3/about
https://yuanzhuo.bnu.edu.cn/user/9111c615fb023dd562a5a7e893d103e9a321d658/about
https://yuanzhuo.bnu.edu.cn/user/2d71d9a174d4d2643b290faf83963b9ad7880d36/about
https://yuanzhuo.bnu.edu.cn/user/7a1164ff25ceb02fbccf6c1ac6356ff2d08a2b0a/about
https://yuanzhuo.bnu.edu.cn/user/2ebf6283d4e435fb706c0989a0915fae9ec4b3ca/about
https://yuanzhuo.bnu.edu.cn/user/d712e40ae1e077402d24be7f76780914539b1099/about
https://yuanzhuo.bnu.edu.cn/user/ce7491e0d33589770c7e17b07aa8dd036a95da5d/about
https://yuanzhuo.bnu.edu.cn/user/ce7c71b0de1cd8426a4daaaa411e54848984f4e7/about
https://yuanzhuo.bnu.edu.cn/user/c573c17002dac9d8b857635db8463ada561d1351/about
https://yuanzhuo.bnu.edu.cn/user/962dbef7f6bfc5806350ea524af5a7b8baa31b01/about
https://yuanzhuo.bnu.edu.cn/user/39f554cb8a95c54221bba46277761347a5fc2877/about
https://yuanzhuo.bnu.edu.cn/user/a5101893409c8ced23ae86cd41c0b288cdbee8f3/about
https://yuanzhuo.bnu.edu.cn/user/da8aba508240daeb087860216991ae7bd4cac07b/about
https://yuanzhuo.bnu.edu.cn/user/19283f6b216dddac4a23f8b0a19a19d66a846139/about
https://yuanzhuo.bnu.edu.cn/user/64d135363e46fe2e35f622877273c4f6c4e8523a/about
https://yuanzhuo.bnu.edu.cn/user/cf9868cb6e9e388654a0e87ce73f3b6757403b52/about
https://yuanzhuo.bnu.edu.cn/user/121dbece6c4e4062f6afe02bd62cf3a1c5f5ca70/about
https://yuanzhuo.bnu.edu.cn/user/64c5e468a0b6002a251dfaf64d8856e59264fa01/about
https://yuanzhuo.bnu.edu.cn/user/87e85e3153017d738ced23788da73e7e0e3aeeaa/about
https://yuanzhuo.bnu.edu.cn/user/9ca001e41dacb3f00594e8ed87bac4f5c297448e/about
https://yuanzhuo.bnu.edu.cn/user/1225cfa19cb2ce44d497a62d44c8b7f36a6a2246/about
https://yuanzhuo.bnu.edu.cn/user/52b15870a9ce94e37df32e0e9b68108fb1074b59/about
https://yuanzhuo.bnu.edu.cn/user/352478899c4d5f498775644a22f2ef3bfad0dca8/about
https://yuanzhuo.bnu.edu.cn/user/646c6b12de53ced4b4534495b86a346666764346/about
https://yuanzhuo.bnu.edu.cn/user/9954518d329496df5240920813e113a22ce676a9/about
https://yuanzhuo.bnu.edu.cn/user/7105867624ad67fcd8fb9447cc1ec5112f6b5ea5/about
https://infogram.com/docx-1hxj48m08o5r52v
https://infogram.com/docx-1h1749w08ol0l2z
https://infogram.com/docx-1h9j6q7owpvr54g
https://infogram.com/docx-1hnq41oy13kzk23
https://infogram.com/docx-1hxj48m08o59q2v
https://infogram.com/docx-1h1749w08ovvq2z
https://infogram.com/docx-1h9j6q7owpgyv4g
https://infogram.com/docx-1h984wvw8qo8z2p
https://infogram.com/docx-1h0r6rzokepgw4e
https://infogram.com/docx-1h0n25o093ovz4p
https://infogram.com/docx-1hnq41oy13odk23
https://infogram.com/docx-1h0n25o093kml4p
https://infogram.com/docx-1hnp27e0pok1y4g
https://infogram.com/docx-1hxj48m08o3w52v
https://infogram.com/docx-1h0r6rzoke0ow4e
https://infogram.com/docx-1hmr6g8m91e3z2n
https://infogram.com/docx-1h0n25o093kqz4p
https://infogram.com/docx-1h7v4pdvkp3784k
https://infogram.com/docx-1hnq41oy135gk23
https://infogram.com/docx-1h0r6rzoke3zl4e
https://infogram.com/docx-1hmr6g8m91weo2n
https://infogram.com/docx-1h9j6q7owpyxv4g
https://infogram.com/docx-1hxj48m08o7q52v
https://infogram.com/docx-1h984wvw8q0wz2p
https://infogram.com/docx-1h0n25o093mlz4p
https://infogram.com/docx-1h984wvw8qqod2p
https://infogram.com/docx-1h1749w08oooq2z
https://infogram.com/docx-1h7v4pdvkppej4k
https://infogram.com/docx-1hxj48m08oo052v
https://infogram.com/docx-1hnp27e0pon3n4g
https://infogram.com/docx-1h984wvw8qzvd2p
https://infogram.com/docx-1h9j6q7owpj8v4g
https://infogram.com/docx-1hnp27e0ponqy4g
https://infogram.com/docx-1hxj48m08ovj52v
https://infogram.com/docx-1hmr6g8m91oxz2n
https://infogram.com/docx-1h0n25o093znz4p
https://infogram.com/docx-1hnq41oy13qkk23
https://infogram.com/docx-1h984wvw8qpjd2p
https://infogram.com/docx-1h0r6rzokexel4e
https://infogram.com/docx-1hxj48m08dkvq2v
https://infogram.com/docx-1h0r6rzokmn1w4e
https://infogram.com/docx-1hnq41oy1e73k23
https://infogram.com/docx-1h0r6rzokmjnw4e
https://infogram.com/docx-1hnp27e0pd3zn4g
https://infogram.com/docx-1h0r6rzokylgl4e
https://infogram.com/docx-1h7v4pdvklnlj4k
https://infogram.com/docx-1hnp27e0pd37y4g
https://infogram.com/docx-1h9j6q7ow9gy54g
https://infogram.com/docx-1hnp27e0pdmly4g
https://infogram.com/docx-1h0r6rzokyzlw4e
https://infogram.com/docx-1h1749w08zwkl2z
https://infogram.com/docx-1hnp27e0pde1n4g
https://infogram.com/docx-1h984wvw85vld2p
https://infogram.com/docx-1hmr6g8m9x83o2n
https://infogram.com/docx-1h7v4pdvkld7j4k
https://infogram.com/docx-1hxj48m08gmx52v
https://infogram.com/docx-1h984wvw85j3z2p
https://infogram.com/docx-1h1749w08zkxl2z
https://infogram.com/docx-1h984wvw85j1d2p
https://infogram.com/docx-1hmr6g8m9xeno2n
https://infogram.com/docx-1h7v4pdvkl31j4k
https://infogram.com/docx-1hxj48m08g7552v
https://infogram.com/docx-1h984wvw850oz2p
https://infogram.com/docx-1h1749w08zxol2z
https://infogram.com/docx-1h9j6q7ow9yx54g
https://infogram.com/docx-1h7v4pdvkl9m84k
https://infogram.com/docx-1hnp27e0pd5vn4g
https://infogram.com/docx-1h984wvw850wd2p
https://yb.tencent.com/s/zH0EnPVdM03E
https://yb.tencent.com/s/dsR9JELkf1Ku
https://yb.tencent.com/s/901XeR0zlSOG
https://yuanzhuo.bnu.edu.cn/user/d0de8de9a7c4302b000f2c42795669908538c06f/about
https://yuanzhuo.bnu.edu.cn/user/baac83b7d9ec8116ff4267790df249ed52a874cd/about
https://yuanzhuo.bnu.edu.cn/user/718efc2b04f8b2333de2936ce62af68f1d3144d4/about
https://yuanzhuo.bnu.edu.cn/user/027ae46790f5715482a48cd46852fdd7993d8355/about
https://yuanzhuo.bnu.edu.cn/user/45f007ed6458a8c0e592fd5c08bfdf88e882d178/about
https://yuanzhuo.bnu.edu.cn/user/8dcd79b79480470ebb6503e141bd0606ca5e992a/about
https://yuanzhuo.bnu.edu.cn/user/9d68cfd1a2c0c01dae4a09164d531107d7d7593e/about
https://yuanzhuo.bnu.edu.cn/user/79d5a7f6c2d2f318a150f21fdc0af054db373917/about
https://yuanzhuo.bnu.edu.cn/user/e71158978ecc54cf41e3c7d8523f38479d3d7ae6/about
https://yuanzhuo.bnu.edu.cn/user/50addd2daab802841cf03ab6c945e5ca4c9a1145/about
https://yuanzhuo.bnu.edu.cn/user/7d71e7fc1fce465743f22c333be84bb71d8278b6/about
https://yuanzhuo.bnu.edu.cn/user/64a9528ab51c9e64aa84f267448c6b69dd8d9f15/about
https://yuanzhuo.bnu.edu.cn/user/a34e535a942ede1359603856c908600b0b4e2e05/about
https://www.coze.cn/s/lowsPieS8tI/
https://www.coze.cn/s/mSi_CcZIEvM/
https://www.coze.cn/s/gVqS4cAiDOs/
https://hydro.ac/user/125210
http://www.code-fans.cn/user/3648
http://www.marsoj.com/user/803
https://020.my.canvasite.cn/
https://010.my.canvasite.cn/
https://022.my.canvasite.cn/
https://021.my.canvasite.cn/
https://023.my.canvasite.cn/
https://0755.my.canvasite.cn/
https://029.my.canvasite.cn/
https://028.my.canvasite.cn/
https://0531.my.canvasite.cn/
https://0351.my.canvasite.cn/
https://0311.my.canvasite.cn/
https://0471.my.canvasite.cn/
https://024.my.canvasite.cn/
https://0431.my.canvasite.cn/
https://0451.my.canvasite.cn/
https://025.my.canvasite.cn/
https://0512.my.canvasite.cn/
https://0571.my.canvasite.cn/
https://0551.my.canvasite.cn/
https://0592.my.canvasite.cn/
https://0591.my.canvasite.cn/
https://0791.my.canvasite.cn/
https://0898.my.canvasite.cn/
d:\360movedata\users\lenovo\desktop\test1\easyui.h(8) : error C2018: unknown character '0xb6'
d:\360movedata\users\lenovo\desktop\test1\easyui.h(8) : error C2018: unknown character '0xbe'
d:\360movedata\users\lenovo\desktop\test1\easyui.h(8) : error C2018: unknown character '0xd9'
d:\360movedata\users\lenovo\desktop\test1\easyui.h(8) : warning C4068: unknown pragma
d:\360movedata\users\lenovo\desktop\test1\easyui.h(40) : error C2018: unknown character '0xc3'
d:\360movedata\users\lenovo\desktop\test1\easyui.h(40) : error C2018: unknown character '0xb6'
d:\360movedata\users\lenovo\desktop\test1\easyui.h(40) : error C2018: unknown character '0xbe'
d:\360movedata\users\lenovo\desktop\test1\easyui.h(40) : error C2018: unknown character '0xd9'
d:\360movedata\users\lenovo\desktop\test1\easyui.h(40) : warning C4068: unknown pragma
d:\360movedata\users\lenovo\desktop\test1\easyui.h(43) : error C2018: unknown character '0xbb'
d:\360movedata\users\lenovo\desktop\test1\easyui.h(43) : error C2018: unknown character '0xe6'