秋·风

  博客园 :: 首页 :: 博问 :: 闪存 :: 新随笔 :: 联系 :: 订阅 订阅 :: 管理 ::
  278 随笔 :: 0 文章 :: 308 评论 :: 20万 阅读
< 2025年3月 >
23 24 25 26 27 28 1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30 31 1 2 3 4 5

修复lazarus linux(ubuntu/银河麒麟)Object Inspector、使用combobox、colorbox等控件style为csOwnerDraw*时下拉列表文字不显示的问题(在树莓派正常),这类问题大概率是ubuntu/银河麒麟引起的,如果使用中也遇到同样的问题可参照以下方法处理。
打开lazarus/lcl/include/customcombobox.inc,(第109行)定位TCustomComboBox.DrawItem(Index: Integer; ARect: TRect; State: TOwnerDrawState);
添加红字1行,重绘背景,重新编译应用程序就可以解决Object Inspector、combobox和colorbox列表的不显示item的问题,这方法不一定是最佳的,但能解决我遇到的问题
修复前:


修复后:

 

复制代码
procedure TCustomComboBox.DrawItem(Index: Integer; ARect: TRect;
  State: TOwnerDrawState);
begin
  //TControlCanvas(FCanvas).UpdateTextFlags;
  //2022.05.28 LBZ
  {$ifdef linux}
  FCanvas.FillRect(ARect);
  {$endif}
  //2022.05.28 LBZ
  if Assigned(FOnDrawItem) then
    FOnDrawItem(Self, Index, ARect, State)
  else
  begin
    if not (odBackgroundPainted in State) then
      FCanvas.FillRect(ARect)
    else
      InternalDrawItem(Self, FCanvas, ARect, Items[Index]);
  end;
end;
复制代码

 

posted on   秋·风  阅读(571)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· TypeScript + Deepseek 打造卜卦网站:技术与玄学的结合
· Manus的开源复刻OpenManus初探
· AI 智能体引爆开源社区「GitHub 热点速览」
· 从HTTP原因短语缺失研究HTTP/2和HTTP/3的设计差异
· 三行代码完成国际化适配,妙~啊~
历史上的今天:
2014-05-29 [转]xe6 android 使用距离传感器(Proximiry)
点击右上角即可分享
微信分享提示