您当前的位置: 首页 > 

仙剑情缘

暂无认证

  • 0浏览

    0关注

    333博文

    0收益

  • 0浏览

    0点赞

    0打赏

    0留言

私信
关注
热门博文

LVGL 8.2 Line

仙剑情缘 发布时间:2022-07-03 17:15:20 ,浏览量:0

Simple Line

{
    /*Create an array for the points of the line*/
    static lv_point_t line_points[] = { {5, 5}, {70, 70}, {120, 10}, {180, 60}, {240,10} };  // 5个点坐标值
 

    /*Create style*/
    static lv_style_t style_line;
    lv_style_init(&style_line);
    lv_style_set_line_width(&style_line, 8);  // 设置线宽
    lv_style_set_line_color(&style_line, lv_palette_main(LV_PALETTE_BLUE));//设置线条颜色为蓝色
    lv_style_set_line_rounded(&style_line, true); // 使能线条圆角功能
    /*Create a line and apply the new style*/
    lv_obj_t* line1;
    line1 = lv_line_create(lv_scr_act());  // 创建线条对象
    lv_line_set_points(line1, line_points, 5); // 设置线条数据点数
    lv_obj_add_style(line1, &style_line, 0); // 线条添加style
    lv_obj_center(line1);  // 居中显示
}
运行效果

在这里插入图片描述

  • 修改线条颜色为红色
 lv_style_set_line_color(&style_line, lv_palette_main(LV_PALETTE_RED));
  • 运行效果 在这里插入图片描述
  • 关闭圆角功能
 lv_style_set_line_rounded(&style_line, false);

在这里插入图片描述

  • 修改线宽为1
lv_style_set_line_width(&style_line, 1);
  • 运行效果 在这里插入图片描述
关注
打赏
1658017818
查看更多评论
立即登录/注册

微信扫码登录

0.0363s