{"id":44662,"date":"2025-06-20T07:32:19","date_gmt":"2025-06-19T23:32:19","guid":{"rendered":"https:\/\/www.wsisp.com\/helps\/44662.html"},"modified":"2025-06-20T07:32:19","modified_gmt":"2025-06-19T23:32:19","slug":"%e5%a4%9a%e5%88%86%e8%be%a8%e7%8e%87-lcd-%e7%9a%84-gui-%e6%9e%b6%e6%9e%84%e8%ae%be%e8%ae%a1%e4%b8%8e%e5%ae%9e%e7%8e%b0","status":"publish","type":"post","link":"https:\/\/www.wsisp.com\/helps\/44662.html","title":{"rendered":"\u591a\u5206\u8fa8\u7387 LCD \u7684 GUI \u67b6\u6784\u8bbe\u8ba1\u4e0e\u5b9e\u73b0"},"content":{"rendered":"<\/p>\n<p>1.1\u591a\u5206\u8fa8\u7387\u663e\u793a\u7cfb\u7edf\u7684\u6311\u6218\u4e0e\u89e3\u51b3\u65b9\u6848<\/p>\n<p>1.1.1 \u5206\u8fa8\u7387\u9002\u914d\u7684\u6838\u5fc3\u95ee\u9898<\/p>\n<p>\u5728\u5d4c\u5165\u5f0f\u7cfb\u7edf\u4e2d\uff0c\u540c\u65f6\u652f\u6301\u4e0d\u540c\u5206\u8fa8\u7387\u7684 LCD\uff08\u5982 240\u00d7160\u3001320\u00d7480 \u7b49\uff09\u9762\u4e34\u4ee5\u4e0b\u6311\u6218\uff1a<\/p>\n<\/p>\n<p>\u5e03\u5c40\u9002\u914d\uff1a\u540c\u4e00\u754c\u9762\u5143\u7d20\u5728\u4e0d\u540c\u5206\u8fa8\u7387\u4e0b\u9700\u8981\u8c03\u6574\u5927\u5c0f\u548c\u4f4d\u7f6e<\/p>\n<p>\u5b57\u4f53\u663e\u793a\uff1a\u5c0f\u5206\u8fa8\u7387\u5c4f\u5e55\u9700\u8981\u66f4\u5c0f\u7684\u5b57\u4f53\uff0c\u800c\u5927\u5206\u8fa8\u7387\u9700\u8981\u66f4\u6e05\u6670\u7684\u5b57\u4f53<\/p>\n<p>\u5185\u5b58\u5360\u7528\uff1a\u9ad8\u5206\u8fa8\u7387\u5c4f\u5e55\u9700\u8981\u66f4\u591a\u663e\u5b58\uff0c\u800c\u4f4e\u5206\u8fa8\u7387\u9700\u8981\u4f18\u5316\u5185\u5b58\u4f7f\u7528<\/p>\n<p>\u6e32\u67d3\u6027\u80fd\uff1a\u9ad8\u5206\u8fa8\u7387\u5c4f\u5e55\u6e32\u67d3\u538b\u529b\u66f4\u5927\uff0c\u9700\u8981\u4f18\u5316\u6e32\u67d3\u7b97\u6cd5<\/p>\n<\/p>\n<p>\u9488\u5bf9\u8fd9\u4e9b\u95ee\u9898\uff0c \u91c7\u7528\u4ee5\u4e0b\u89e3\u51b3\u65b9\u6848\uff1a<\/p>\n<\/p>\n<p>\u62bd\u8c61\u663e\u793a\u63a5\u53e3\uff1a\u5b9a\u4e49\u7edf\u4e00\u7684\u663e\u793a\u64cd\u4f5c\u63a5\u53e3\uff0c\u5c4f\u853d\u5e95\u5c42\u786c\u4ef6\u5dee\u5f02<\/p>\n<p>\u76f8\u5bf9\u5e03\u5c40\u7cfb\u7edf\uff1a\u4f7f\u7528\u767e\u5206\u6bd4\u6216\u76f8\u5bf9\u5355\u4f4d\u5b9a\u4e49\u754c\u9762\u5143\u7d20\u4f4d\u7f6e\u548c\u5927\u5c0f<\/p>\n<p>\u5b57\u4f53\u52a8\u6001\u7f29\u653e\uff1a\u6839\u636e\u5c4f\u5e55\u5206\u8fa8\u7387\u52a8\u6001\u8c03\u6574\u5b57\u4f53\u5927\u5c0f<\/p>\n<p>\u8d44\u6e90\u6309\u9700\u52a0\u8f7d\uff1a\u6839\u636e\u5f53\u524d\u5c4f\u5e55\u5206\u8fa8\u7387\u9009\u62e9\u5408\u9002\u7684\u56fe\u7247\u548c\u5b57\u4f53\u8d44\u6e90<\/p>\n<\/p>\n<p>1.1.2 \u5355\u8272\u5c4f\u4e0e\u5f69\u5c4f\u7684\u517c\u5bb9\u6027\u8bbe\u8ba1<\/p>\n<p>\u540c\u65f6\u652f\u6301\u5355\u8272\u5c4f\u548c\u5f69\u5c4f\u65f6\uff0c\u9700\u8981\u89e3\u51b3\u4ee5\u4e0b\u95ee\u9898\uff1a<\/p>\n<\/p>\n<p>\u989c\u8272\u8868\u793a\uff1a\u5355\u8272\u5c4f\u53ea\u6709\u9ed1\u767d\u4e24\u8272\uff0c\u800c\u5f69\u5c4f\u652f\u6301\u591a\u79cd\u989c\u8272<\/p>\n<p>\u56fe\u5f62\u6e32\u67d3\uff1a\u5f69\u5c4f\u652f\u6301\u6e10\u53d8\u3001\u9634\u5f71\u7b49\u590d\u6742\u6548\u679c\uff0c\u5355\u8272\u5c4f\u9700\u8981\u7b80\u5316<\/p>\n<p>\u4ea4\u4e92\u53cd\u9988\uff1a\u5f69\u5c4f\u53ef\u901a\u8fc7\u989c\u8272\u53d8\u5316\u63d0\u4f9b\u53cd\u9988\uff0c\u5355\u8272\u5c4f\u9700\u4f9d\u8d56\u5bf9\u6bd4\u5ea6\u6216\u95ea\u70c1<\/p>\n<\/p>\n<p>\u89e3\u51b3\u65b9\u6848\u5305\u62ec\uff1a<\/p>\n<\/p>\n<p>\u989c\u8272\u62bd\u8c61\u5c42\uff1a\u5b9a\u4e49\u989c\u8272\u6620\u5c04\u8868\uff0c\u5c06 RGB \u989c\u8272\u6620\u5c04\u5230\u5355\u8272\u5c4f\u7684\u9ed1\u767d\u503c<\/p>\n<p>\u6e32\u67d3\u7b56\u7565\u5206\u79bb\uff1a\u4e3a\u5355\u8272\u5c4f\u548c\u5f69\u5c4f\u5206\u522b\u5b9e\u73b0\u4e0d\u540c\u7684\u6e32\u67d3\u7b97\u6cd5<\/p>\n<p>\u4ea4\u4e92\u53cd\u9988\u7edf\u4e00\uff1a\u4f7f\u7528\u7edf\u4e00\u7684\u4ea4\u4e92\u53cd\u9988\u63a5\u53e3\uff0c\u5e95\u5c42\u6839\u636e\u5c4f\u5e55\u7c7b\u578b\u5b9e\u73b0<\/p>\n<\/p>\n<p>1.2 \u7edf\u4e00\u663e\u793a\u62bd\u8c61\u5c42\u8bbe\u8ba1<\/p>\n<p>1.2.1 \u663e\u793a\u63a5\u53e3\u5b9a\u4e49<\/p>\n<p>\u6211\u4eec\u9996\u5148\u5b9a\u4e49\u4e00\u4e2a\u62bd\u8c61\u7684\u663e\u793a\u63a5\u53e3\uff0c\u5c4f\u853d\u4e0d\u540c\u5206\u8fa8\u7387\u548c\u7c7b\u578b\u7684 LCD \u5dee\u5f02\uff1a<\/p>\n<\/p>\n<p>c<\/p>\n<p>\/**<\/p>\n<p>&nbsp;* \u663e\u793a\u62bd\u8c61\u5c42\u63a5\u53e3\u5b9a\u4e49<\/p>\n<p>&nbsp;* \u652f\u6301\u4e0d\u540c\u5206\u8fa8\u7387\u548c\u7c7b\u578b\u7684LCD<\/p>\n<p>&nbsp;*\/<\/p>\n<p>#ifndef DISPLAY_ABSTRACTION_H<\/p>\n<p>#define DISPLAY_ABSTRACTION_H<\/p>\n<\/p>\n<p>#include &lt;stdint.h&gt;<\/p>\n<p>#include &lt;stdbool.h&gt;<\/p>\n<\/p>\n<p>\/* \u989c\u8272\u5b9a\u4e49 &#8211; \u91c7\u7528RGB565\u683c\u5f0f *\/<\/p>\n<p>typedef uint16_t color_t;<\/p>\n<\/p>\n<p>\/* \u6807\u51c6\u989c\u8272\u5e38\u91cf *\/<\/p>\n<p>#define COLOR_BLACK &nbsp; &nbsp; &nbsp; 0x0000<\/p>\n<p>#define COLOR_WHITE &nbsp; &nbsp; &nbsp; 0xFFFF<\/p>\n<p>#define COLOR_RED &nbsp; &nbsp; &nbsp; &nbsp; 0xF800<\/p>\n<p>#define COLOR_GREEN &nbsp; &nbsp; &nbsp; 0x07E0<\/p>\n<p>#define COLOR_BLUE &nbsp; &nbsp; &nbsp; &nbsp;0x001F<\/p>\n<p>#define COLOR_YELLOW &nbsp; &nbsp; &nbsp;0xFFE0<\/p>\n<p>#define COLOR_CYAN &nbsp; &nbsp; &nbsp; &nbsp;0x07FF<\/p>\n<p>#define COLOR_MAGENTA &nbsp; &nbsp; 0xF81F<\/p>\n<\/p>\n<p>\/* \u663e\u793a\u533a\u57df\u7ed3\u6784\u4f53 *\/<\/p>\n<p>typedef struct<\/p>\n<p>{\n <\/p>\n<p>&nbsp; &nbsp; uint16_t x;<\/p>\n<p>&nbsp; &nbsp; uint16_t y;<\/p>\n<p>&nbsp; &nbsp; uint16_t width;<\/p>\n<p>&nbsp; &nbsp; uint16_t height;<\/p>\n<p>} rect_t;<\/p>\n<\/p>\n<p>\/* \u663e\u793a\u8bbe\u5907\u80fd\u529b\u7ed3\u6784\u4f53 *\/<\/p>\n<p>typedef struct<\/p>\n<p>{\n <\/p>\n<p>&nbsp; &nbsp; uint16_t width; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;\/* \u5c4f\u5e55\u5bbd\u5ea6 *\/<\/p>\n<p>&nbsp; &nbsp; uint16_t height; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; \/* \u5c4f\u5e55\u9ad8\u5ea6 *\/<\/p>\n<p>&nbsp; &nbsp; uint8_t bits_per_pixel; &nbsp; &nbsp; &nbsp;\/* \u6bcf\u50cf\u7d20\u4f4d\u6570 *\/<\/p>\n<p>&nbsp; &nbsp; bool color_support; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;\/* \u662f\u5426\u652f\u6301\u5f69\u8272 *\/<\/p>\n<p>&nbsp; &nbsp; uint16_t max_font_size; &nbsp; &nbsp; &nbsp;\/* \u6700\u5927\u652f\u6301\u5b57\u4f53\u5927\u5c0f *\/<\/p>\n<p>&nbsp; &nbsp; uint16_t min_font_size; &nbsp; &nbsp; &nbsp;\/* \u6700\u5c0f\u652f\u6301\u5b57\u4f53\u5927\u5c0f *\/<\/p>\n<p>} display_capabilities_t;<\/p>\n<\/p>\n<p>\/* \u663e\u793a\u63a5\u53e3\u51fd\u6570\u6307\u9488\u7ed3\u6784\u4f53 *\/<\/p>\n<p>typedef struct<\/p>\n<p>{\n <\/p>\n<p>&nbsp; &nbsp; \/* \u57fa\u672c\u64cd\u4f5c *\/<\/p>\n<p>&nbsp; &nbsp; void (*init)(void);<\/p>\n<p>&nbsp; &nbsp; void (*clear)(color_t color);<\/p>\n<p>&nbsp; &nbsp; void (*refresh)(void);<\/p>\n<p>&nbsp; &nbsp;<\/p>\n<p>&nbsp; &nbsp; \/* \u7ed8\u5236\u57fa\u672c\u56fe\u5f62 *\/<\/p>\n<p>&nbsp; &nbsp; void (*draw_pixel)(uint16_t x, uint16_t y, color_t color);<\/p>\n<p>&nbsp; &nbsp; void (*draw_line)(uint16_t x1, uint16_t y1, uint16_t x2, uint16_t y2, color_t color);<\/p>\n<p>&nbsp; &nbsp; void (*draw_rect)(uint16_t x, uint16_t y, uint16_t width, uint16_t height, color_t color);<\/p>\n<p>&nbsp; &nbsp; void (*fill_rect)(uint16_t x, uint16_t y, uint16_t width, uint16_t height, color_t color);<\/p>\n<p>&nbsp; &nbsp; void (*draw_circle)(uint16_t x, uint16_t y, uint16_t radius, color_t color);<\/p>\n<p>&nbsp; &nbsp; void (*fill_circle)(uint16_t x, uint16_t y, uint16_t radius, color_t color);<\/p>\n<p>&nbsp; &nbsp;<\/p>\n<p>&nbsp; &nbsp; \/* \u6587\u672c\u7ed8\u5236 *\/<\/p>\n<p>&nbsp; &nbsp; void (*set_font_size)(uint8_t size);<\/p>\n<p>&nbsp; &nbsp; void (*set_text_color)(color_t color, color_t background);<\/p>\n<p>&nbsp; &nbsp; void (*draw_char)(uint16_t x, uint16_t y, char c);<\/p>\n<p>&nbsp; &nbsp; void (*draw_string)(uint16_t x, uint16_t y, const char* str);<\/p>\n<p>&nbsp; &nbsp;<\/p>\n<p>&nbsp; &nbsp; \/* \u56fe\u50cf\u7ed8\u5236 *\/<\/p>\n<p>&nbsp; &nbsp; void (*draw_image)(uint16_t x, uint16_t y, uint16_t width, uint16_t height, const uint16_t* data);<\/p>\n<p>&nbsp; &nbsp;<\/p>\n<p>&nbsp; &nbsp; \/* \u83b7\u53d6\u663e\u793a\u80fd\u529b *\/<\/p>\n<p>&nbsp; &nbsp; void (*get_capabilities)(display_capabilities_t* caps);<\/p>\n<p>} display_interface_t;<\/p>\n<\/p>\n<p>\/* \u83b7\u53d6\u5f53\u524d\u663e\u793a\u63a5\u53e3\u5b9e\u4f8b *\/<\/p>\n<p>display_interface_t* get_display_interface(void);<\/p>\n<\/p>\n<p>\/* \u8bbe\u7f6e\u5f53\u524d\u663e\u793a\u63a5\u53e3\u5b9e\u4f8b *\/<\/p>\n<p>void set_display_interface(display_interface_t* display);<\/p>\n<\/p>\n<p>#endif \/* DISPLAY_ABSTRACTION_H *\/<\/p>\n<p>1.2.2 \u663e\u793a\u63a5\u53e3\u5b9e\u73b0<\/p>\n<p>\u4e0b\u9762\u662f\u663e\u793a\u63a5\u53e3\u7684\u57fa\u7840\u5b9e\u73b0\uff0c\u63d0\u4f9b\u4e86\u7edf\u4e00\u7684\u64cd\u4f5c\u5165\u53e3\uff1a<\/p>\n<\/p>\n<p>\/**<\/p>\n<p>&nbsp;* \u663e\u793a\u62bd\u8c61\u5c42\u5b9e\u73b0<\/p>\n<p>&nbsp;*\/<\/p>\n<p>#include \\&#8221;display_abstraction.h\\&#8221;<\/p>\n<\/p>\n<p>\/* \u5f53\u524d\u663e\u793a\u63a5\u53e3\u5b9e\u4f8b *\/<\/p>\n<p>static display_interface_t* current_display = NULL;<\/p>\n<\/p>\n<p>\/* \u83b7\u53d6\u5f53\u524d\u663e\u793a\u63a5\u53e3\u5b9e\u4f8b *\/<\/p>\n<p>display_interface_t* get_display_interface(void)<\/p>\n<p>{\n <\/p>\n<p>&nbsp; &nbsp; return current_display;<\/p>\n<p>}<\/p>\n<\/p>\n<p>\/* \u8bbe\u7f6e\u5f53\u524d\u663e\u793a\u63a5\u53e3\u5b9e\u4f8b *\/<\/p>\n<p>void set_display_interface(display_interface_t* display)<\/p>\n<p>{\n <\/p>\n<p>&nbsp; &nbsp; current_display = display;<\/p>\n<p>}<\/p>\n<\/p>\n<p>\/* \u901a\u7528\u7ed8\u5236\u51fd\u6570 &#8211; \u4f7f\u7528\u5f53\u524d\u663e\u793a\u63a5\u53e3 *\/<\/p>\n<p>void display_clear(color_t color)<\/p>\n<p>{\n <\/p>\n<p>&nbsp; &nbsp; if (current_display &amp;&amp; current_display-&gt;clear)<\/p>\n<p>&nbsp; &nbsp; {\n <\/p>\n<p>&nbsp; &nbsp; &nbsp; &nbsp; current_display-&gt;clear(color);<\/p>\n<p>&nbsp; &nbsp; }<\/p>\n<p>}<\/p>\n<\/p>\n<p>void display_refresh(void)<\/p>\n<p>{\n <\/p>\n<p>&nbsp; &nbsp; if (current_display &amp;&amp; current_display-&gt;refresh)<\/p>\n<p>&nbsp; &nbsp; {\n <\/p>\n<p>&nbsp; &nbsp; &nbsp; &nbsp; current_display-&gt;refresh();<\/p>\n<p>&nbsp; &nbsp; }<\/p>\n<p>}<\/p>\n<\/p>\n<p>void display_draw_pixel(uint16_t x, uint16_t y, color_t color)<\/p>\n<p>{\n <\/p>\n<p>&nbsp; &nbsp; if (current_display &amp;&amp; current_display-&gt;draw_pixel)<\/p>\n<p>&nbsp; &nbsp; {\n <\/p>\n<p>&nbsp; &nbsp; &nbsp; &nbsp; current_display-&gt;draw_pixel(x, y, color);<\/p>\n<p>&nbsp; &nbsp; }<\/p>\n<p>}<\/p>\n<\/p>\n<p>\/\/ \u5176\u4ed6\u901a\u7528\u7ed8\u5236\u51fd\u6570\u5b9e\u73b0&#8230;<\/p>\n<p>1.3 \u76f8\u5bf9\u5e03\u5c40\u7cfb\u7edf\u8bbe\u8ba1<\/p>\n<p>1.3.1 \u5e03\u5c40\u7ba1\u7406\u5668\u8bbe\u8ba1<\/p>\n<p>\u4e3a\u4e86\u5b9e\u73b0\u8de8\u5206\u8fa8\u7387\u7684 GUI \u9002\u914d\uff0c\u6211\u4eec\u8bbe\u8ba1\u4e00\u4e2a\u76f8\u5bf9\u5e03\u5c40\u7ba1\u7406\u5668\uff1a<\/p>\n<p> &nbsp;<\/p>\n<p>\/**<\/p>\n<p>&nbsp;* \u76f8\u5bf9\u5e03\u5c40\u7ba1\u7406\u5668<\/p>\n<p>&nbsp;* \u652f\u6301\u57fa\u4e8e\u767e\u5206\u6bd4\u7684\u754c\u9762\u5143\u7d20\u5e03\u5c40<\/p>\n<p>&nbsp;*\/<\/p>\n<p>#ifndef LAYOUT_MANAGER_H<\/p>\n<p>#define LAYOUT_MANAGER_H<\/p>\n<\/p>\n<p>#include \\&#8221;display_abstraction.h\\&#8221;<\/p>\n<\/p>\n<p>\/* \u5bf9\u9f50\u65b9\u5f0f\u679a\u4e3e *\/<\/p>\n<p>typedef enum<\/p>\n<p>{\n <\/p>\n<p>&nbsp; &nbsp; ALIGN_LEFT,<\/p>\n<p>&nbsp; &nbsp; ALIGN_CENTER,<\/p>\n<p>&nbsp; &nbsp; ALIGN_RIGHT,<\/p>\n<p>&nbsp; &nbsp; ALIGN_TOP,<\/p>\n<p>&nbsp; &nbsp; ALIGN_MIDDLE,<\/p>\n<p>&nbsp; &nbsp; ALIGN_BOTTOM<\/p>\n<p>} alignment_t;<\/p>\n<\/p>\n<p>\/* \u76f8\u5bf9\u4f4d\u7f6e\u7ed3\u6784\u4f53 *\/<\/p>\n<p>typedef struct<\/p>\n<p>{\n <\/p>\n<p>&nbsp; &nbsp; float x_percent; &nbsp; &nbsp; \/* X\u5750\u6807\u767e\u5206\u6bd4 (0.0-1.0) *\/<\/p>\n<p>&nbsp; &nbsp; float y_percent; &nbsp; &nbsp; \/* Y\u5750\u6807\u767e\u5206\u6bd4 (0.0-1.0) *\/<\/p>\n<p>&nbsp; &nbsp; float width_percent; \/* \u5bbd\u5ea6\u767e\u5206\u6bd4 (0.0-1.0) *\/<\/p>\n<p>&nbsp; &nbsp; float height_percent; \/* \u9ad8\u5ea6\u767e\u5206\u6bd4 (0.0-1.0) *\/<\/p>\n<p>&nbsp; &nbsp; alignment_t h_align; \/* \u6c34\u5e73\u5bf9\u9f50\u65b9\u5f0f *\/<\/p>\n<p>&nbsp; &nbsp; alignment_t v_align; \/* \u5782\u76f4\u5bf9\u9f50\u65b9\u5f0f *\/<\/p>\n<p>} relative_position_t;<\/p>\n<\/p>\n<p>\/* GUI\u5143\u7d20\u57fa\u7c7b *\/<\/p>\n<p>typedef struct gui_element<\/p>\n<p>{\n <\/p>\n<p>&nbsp; &nbsp; char* id; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;\/* \u5143\u7d20ID *\/<\/p>\n<p>&nbsp; &nbsp; relative_position_t position; &nbsp;\/* \u76f8\u5bf9\u4f4d\u7f6e *\/<\/p>\n<p>&nbsp; &nbsp; bool visible; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;\/* \u662f\u5426\u53ef\u89c1 *\/<\/p>\n<p>&nbsp; &nbsp;<\/p>\n<p>&nbsp; &nbsp; \/* \u7ed8\u5236\u51fd\u6570 *\/<\/p>\n<p>&nbsp; &nbsp; void (*draw)(struct gui_element* element);<\/p>\n<p>&nbsp; &nbsp;<\/p>\n<p>&nbsp; &nbsp; \/* \u4e8b\u4ef6\u5904\u7406\u51fd\u6570 *\/<\/p>\n<p>&nbsp; &nbsp; bool (*handle_event)(struct gui_element* element, void* event);<\/p>\n<p>&nbsp; &nbsp;<\/p>\n<p>&nbsp; &nbsp; \/* \u5e03\u5c40\u8ba1\u7b97\u51fd\u6570 *\/<\/p>\n<p>&nbsp; &nbsp; void (*calculate_layout)(struct gui_element* element, rect_t* parent_rect);<\/p>\n<p>&nbsp; &nbsp;<\/p>\n<p>&nbsp; &nbsp; \/* \u5b9e\u9645\u5c4f\u5e55\u4f4d\u7f6e *\/<\/p>\n<p>&nbsp; &nbsp; rect_t screen_rect;<\/p>\n<p>&nbsp; &nbsp;<\/p>\n<p>&nbsp; &nbsp; \/* \u6307\u5411\u4e0b\u4e00\u4e2a\u5143\u7d20\u7684\u6307\u9488 *\/<\/p>\n<p>&nbsp; &nbsp; struct gui_element* next;<\/p>\n<p>} gui_element_t;<\/p>\n<\/p>\n<p>\/* \u5e03\u5c40\u7ba1\u7406\u5668 *\/<\/p>\n<p>typedef struct<\/p>\n<p>{\n <\/p>\n<p>&nbsp; &nbsp; gui_element_t* elements; &nbsp; &nbsp; &nbsp; \/* \u5143\u7d20\u94fe\u8868 *\/<\/p>\n<p>&nbsp; &nbsp; display_interface_t* display; &nbsp;\/* \u663e\u793a\u63a5\u53e3 *\/<\/p>\n<p>&nbsp; &nbsp; rect_t root_rect; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;\/* \u6839\u533a\u57df *\/<\/p>\n<p>} layout_manager_t;<\/p>\n<\/p>\n<p>\/* \u521d\u59cb\u5316\u5e03\u5c40\u7ba1\u7406\u5668 *\/<\/p>\n<p>void layout_manager_init(layout_manager_t* manager, display_interface_t* display);<\/p>\n<\/p>\n<p>\/* \u6dfb\u52a0GUI\u5143\u7d20 *\/<\/p>\n<p>void layout_manager_add_element(layout_manager_t* manager, gui_element_t* element);<\/p>\n<\/p>\n<p>\/* \u79fb\u9664GUI\u5143\u7d20 *\/<\/p>\n<p>void layout_manager_remove_element(layout_manager_t* manager, gui_element_t* <\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u6587\u7ae0\u6d4f\u89c8\u9605\u8bfb923\u6b21\uff0c\u70b9\u8d5e20\u6b21\uff0c\u6536\u85cf9\u6b21\u3002\u672c\u6587\u63d0\u51fa\u4e86\u4e00\u5957\u5b8c\u6574\u7684\u5d4c\u5165\u5f0fGUI\u7cfb\u7edf\u89e3\u51b3\u65b9\u6848\uff0c\u9488\u5bf9\u591a\u5206\u8fa8\u7387LCD\u5c4f\u5e55\u9002\u914d\u548c\u5355\u8272\/\u5f69\u5c4f\u517c\u5bb9\u6027\u95ee\u9898\uff0c\u8bbe\u8ba1\u4e86\u62bd\u8c61\u663e\u793a\u5c42\u3001\u76f8\u5bf9\u5e03\u5c40\u7cfb\u7edf\u548c\u5b57\u4f53\u7ba1\u7406\u7cfb\u7edf\u3002\u901a\u8fc7\u7edf\u4e00\u7684\u663e\u793a\u63a5\u53e3\u5b9a\u4e49(display_abstraction.h)\u5c4f\u853d\u786c\u4ef6\u5dee\u5f02\uff0c\u91c7\u7528\u767e\u5206\u6bd4\u5e03\u5c40(layout_manager.h)\u5b9e\u73b0\u754c\u9762\u81ea\u9002\u5e94\uff0c\u5e76\u5f00\u53d1\u989c\u8272\u62bd\u8c61\u5c42(color_abstraction.h)\u5904\u7406\u5355\u8272\/\u5f69\u5c4f\u8f6c\u6362\u3002\u7cfb\u7edf\u5305\u542b240\u00d7160\u5355\u8272\u5c4f\u548c320\u00d7480\u5f69\u5c4f\u7684\u9a71\u52a8\u5b9e\u73b0\u8303\u4f8b\uff0c\u901a\u8fc7GUI\u5e94\u7528\u793a\u4f8b\u9a8c\u8bc1\u4e86\u65b9\u6848\u7684\u53ef\u884c\u6027\u3002<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[174,270,188],"topic":[],"class_list":["post-44662","post","type-post","status-publish","format-standard","hentry","category-server","tag-c","tag-270","tag-188"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v20.3 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>\u591a\u5206\u8fa8\u7387 LCD \u7684 GUI \u67b6\u6784\u8bbe\u8ba1\u4e0e\u5b9e\u73b0 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.wsisp.com\/helps\/44662.html\" \/>\n<meta property=\"og:locale\" content=\"zh_CN\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"\u591a\u5206\u8fa8\u7387 LCD \u7684 GUI \u67b6\u6784\u8bbe\u8ba1\u4e0e\u5b9e\u73b0 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"og:description\" content=\"\u6587\u7ae0\u6d4f\u89c8\u9605\u8bfb923\u6b21\uff0c\u70b9\u8d5e20\u6b21\uff0c\u6536\u85cf9\u6b21\u3002\u672c\u6587\u63d0\u51fa\u4e86\u4e00\u5957\u5b8c\u6574\u7684\u5d4c\u5165\u5f0fGUI\u7cfb\u7edf\u89e3\u51b3\u65b9\u6848\uff0c\u9488\u5bf9\u591a\u5206\u8fa8\u7387LCD\u5c4f\u5e55\u9002\u914d\u548c\u5355\u8272\/\u5f69\u5c4f\u517c\u5bb9\u6027\u95ee\u9898\uff0c\u8bbe\u8ba1\u4e86\u62bd\u8c61\u663e\u793a\u5c42\u3001\u76f8\u5bf9\u5e03\u5c40\u7cfb\u7edf\u548c\u5b57\u4f53\u7ba1\u7406\u7cfb\u7edf\u3002\u901a\u8fc7\u7edf\u4e00\u7684\u663e\u793a\u63a5\u53e3\u5b9a\u4e49(display_abstraction.h)\u5c4f\u853d\u786c\u4ef6\u5dee\u5f02\uff0c\u91c7\u7528\u767e\u5206\u6bd4\u5e03\u5c40(layout_manager.h)\u5b9e\u73b0\u754c\u9762\u81ea\u9002\u5e94\uff0c\u5e76\u5f00\u53d1\u989c\u8272\u62bd\u8c61\u5c42(color_abstraction.h)\u5904\u7406\u5355\u8272\/\u5f69\u5c4f\u8f6c\u6362\u3002\u7cfb\u7edf\u5305\u542b240\u00d7160\u5355\u8272\u5c4f\u548c320\u00d7480\u5f69\u5c4f\u7684\u9a71\u52a8\u5b9e\u73b0\u8303\u4f8b\uff0c\u901a\u8fc7GUI\u5e94\u7528\u793a\u4f8b\u9a8c\u8bc1\u4e86\u65b9\u6848\u7684\u53ef\u884c\u6027\u3002\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.wsisp.com\/helps\/44662.html\" \/>\n<meta property=\"og:site_name\" content=\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"article:published_time\" content=\"2025-06-19T23:32:19+00:00\" \/>\n<meta name=\"author\" content=\"admin\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"\u4f5c\u8005\" \/>\n\t<meta name=\"twitter:data1\" content=\"admin\" \/>\n\t<meta name=\"twitter:label2\" content=\"\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4\" \/>\n\t<meta name=\"twitter:data2\" content=\"4 \u5206\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/44662.html\",\"url\":\"https:\/\/www.wsisp.com\/helps\/44662.html\",\"name\":\"\u591a\u5206\u8fa8\u7387 LCD \u7684 GUI \u67b6\u6784\u8bbe\u8ba1\u4e0e\u5b9e\u73b0 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"isPartOf\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\"},\"datePublished\":\"2025-06-19T23:32:19+00:00\",\"dateModified\":\"2025-06-19T23:32:19+00:00\",\"author\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\"},\"breadcrumb\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/44662.html#breadcrumb\"},\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.wsisp.com\/helps\/44662.html\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/44662.html#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\u9996\u9875\",\"item\":\"https:\/\/www.wsisp.com\/helps\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"\u591a\u5206\u8fa8\u7387 LCD \u7684 GUI \u67b6\u6784\u8bbe\u8ba1\u4e0e\u5b9e\u73b0\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\",\"url\":\"https:\/\/www.wsisp.com\/helps\/\",\"name\":\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"description\":\"\u9999\u6e2f\u670d\u52a1\u5668_\u9999\u6e2f\u4e91\u670d\u52a1\u5668\u8d44\u8baf_\u670d\u52a1\u5668\u5e2e\u52a9\u6587\u6863_\u670d\u52a1\u5668\u6559\u7a0b\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.wsisp.com\/helps\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"zh-Hans\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\",\"name\":\"admin\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"zh-Hans\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery\",\"contentUrl\":\"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery\",\"caption\":\"admin\"},\"sameAs\":[\"http:\/\/wp.wsisp.com\"],\"url\":\"https:\/\/www.wsisp.com\/helps\/author\/admin\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"\u591a\u5206\u8fa8\u7387 LCD \u7684 GUI \u67b6\u6784\u8bbe\u8ba1\u4e0e\u5b9e\u73b0 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.wsisp.com\/helps\/44662.html","og_locale":"zh_CN","og_type":"article","og_title":"\u591a\u5206\u8fa8\u7387 LCD \u7684 GUI \u67b6\u6784\u8bbe\u8ba1\u4e0e\u5b9e\u73b0 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","og_description":"\u6587\u7ae0\u6d4f\u89c8\u9605\u8bfb923\u6b21\uff0c\u70b9\u8d5e20\u6b21\uff0c\u6536\u85cf9\u6b21\u3002\u672c\u6587\u63d0\u51fa\u4e86\u4e00\u5957\u5b8c\u6574\u7684\u5d4c\u5165\u5f0fGUI\u7cfb\u7edf\u89e3\u51b3\u65b9\u6848\uff0c\u9488\u5bf9\u591a\u5206\u8fa8\u7387LCD\u5c4f\u5e55\u9002\u914d\u548c\u5355\u8272\/\u5f69\u5c4f\u517c\u5bb9\u6027\u95ee\u9898\uff0c\u8bbe\u8ba1\u4e86\u62bd\u8c61\u663e\u793a\u5c42\u3001\u76f8\u5bf9\u5e03\u5c40\u7cfb\u7edf\u548c\u5b57\u4f53\u7ba1\u7406\u7cfb\u7edf\u3002\u901a\u8fc7\u7edf\u4e00\u7684\u663e\u793a\u63a5\u53e3\u5b9a\u4e49(display_abstraction.h)\u5c4f\u853d\u786c\u4ef6\u5dee\u5f02\uff0c\u91c7\u7528\u767e\u5206\u6bd4\u5e03\u5c40(layout_manager.h)\u5b9e\u73b0\u754c\u9762\u81ea\u9002\u5e94\uff0c\u5e76\u5f00\u53d1\u989c\u8272\u62bd\u8c61\u5c42(color_abstraction.h)\u5904\u7406\u5355\u8272\/\u5f69\u5c4f\u8f6c\u6362\u3002\u7cfb\u7edf\u5305\u542b240\u00d7160\u5355\u8272\u5c4f\u548c320\u00d7480\u5f69\u5c4f\u7684\u9a71\u52a8\u5b9e\u73b0\u8303\u4f8b\uff0c\u901a\u8fc7GUI\u5e94\u7528\u793a\u4f8b\u9a8c\u8bc1\u4e86\u65b9\u6848\u7684\u53ef\u884c\u6027\u3002","og_url":"https:\/\/www.wsisp.com\/helps\/44662.html","og_site_name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","article_published_time":"2025-06-19T23:32:19+00:00","author":"admin","twitter_card":"summary_large_image","twitter_misc":{"\u4f5c\u8005":"admin","\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4":"4 \u5206"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.wsisp.com\/helps\/44662.html","url":"https:\/\/www.wsisp.com\/helps\/44662.html","name":"\u591a\u5206\u8fa8\u7387 LCD \u7684 GUI \u67b6\u6784\u8bbe\u8ba1\u4e0e\u5b9e\u73b0 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","isPartOf":{"@id":"https:\/\/www.wsisp.com\/helps\/#website"},"datePublished":"2025-06-19T23:32:19+00:00","dateModified":"2025-06-19T23:32:19+00:00","author":{"@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41"},"breadcrumb":{"@id":"https:\/\/www.wsisp.com\/helps\/44662.html#breadcrumb"},"inLanguage":"zh-Hans","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.wsisp.com\/helps\/44662.html"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.wsisp.com\/helps\/44662.html#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\u9996\u9875","item":"https:\/\/www.wsisp.com\/helps"},{"@type":"ListItem","position":2,"name":"\u591a\u5206\u8fa8\u7387 LCD \u7684 GUI \u67b6\u6784\u8bbe\u8ba1\u4e0e\u5b9e\u73b0"}]},{"@type":"WebSite","@id":"https:\/\/www.wsisp.com\/helps\/#website","url":"https:\/\/www.wsisp.com\/helps\/","name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","description":"\u9999\u6e2f\u670d\u52a1\u5668_\u9999\u6e2f\u4e91\u670d\u52a1\u5668\u8d44\u8baf_\u670d\u52a1\u5668\u5e2e\u52a9\u6587\u6863_\u670d\u52a1\u5668\u6559\u7a0b","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.wsisp.com\/helps\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"zh-Hans"},{"@type":"Person","@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41","name":"admin","image":{"@type":"ImageObject","inLanguage":"zh-Hans","@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/image\/","url":"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery","contentUrl":"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery","caption":"admin"},"sameAs":["http:\/\/wp.wsisp.com"],"url":"https:\/\/www.wsisp.com\/helps\/author\/admin"}]}},"_links":{"self":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/44662","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/comments?post=44662"}],"version-history":[{"count":0,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/44662\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/media?parent=44662"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/categories?post=44662"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/tags?post=44662"},{"taxonomy":"topic","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/topic?post=44662"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}