瀏覽代碼

Fix for MultiSelect style of Paper ListBox

lainz 9 年之前
父節點
當前提交
3badf4d533
共有 3 個文件被更改,包括 9 次插入10 次删除
  1. 1 3
      test/test_paperlistbox/paperlistbox.lpi
  2. 2 0
      test/test_paperlistbox/umain.lfm
  3. 6 7
      test/test_paperlistbox/umain.pas

+ 1 - 3
test/test_paperlistbox/paperlistbox.lpi

@@ -15,9 +15,6 @@
         <TextDesc Value="Your application description."/>
       </XPManifest>
     </General>
-    <VersionInfo>
-      <StringTable ProductVersion=""/>
-    </VersionInfo>
     <BuildModes Count="1">
       <Item1 Name="Default" Default="True"/>
     </BuildModes>
@@ -46,6 +43,7 @@
         <Filename Value="umain.pas"/>
         <IsPartOfProject Value="True"/>
         <ComponentName Value="Form1"/>
+        <HasResources Value="True"/>
         <ResourceBaseClass Value="Form"/>
       </Unit1>
     </Units>

+ 2 - 0
test/test_paperlistbox/umain.lfm

@@ -50,6 +50,8 @@ object Form1: TForm1
           'Drafts'
         )
         ItemHeight = 0
+        ItemIndex = 0
+        MultiSelect = True
         OnDrawItem = ListBox1DrawItem
         Style = lbOwnerDrawFixed
         TabOrder = 0

+ 6 - 7
test/test_paperlistbox/umain.pas

@@ -85,15 +85,14 @@ begin
 
   lb.Canvas.Clipping := False;
 
-  if odSelected in State then
-  begin
-    lb.Canvas.Brush.Color := $00e4e4e4;
-    lb.Canvas.Font.Style := [fsBold];
-  end
+  if odFocused in State then
+    lb.Canvas.Brush.Color := $00e4e4e4
   else
-  begin
     lb.Canvas.Brush.Color := clWhite;
-  end;
+
+  if odSelected in State then
+    lb.Canvas.Font.Style := [fsBold];
+
   lb.Canvas.FillRect(ARect);
   hg := lb.Canvas.TextHeight(lb.Items[Index]);
   lb.Canvas.Font.Color := clBlack;