AGB  ·  Datenschutz  ·  Impressum  







Anmelden
Nützliche Links
Registrieren
Thema durchsuchen
Ansicht
Themen-Optionen

mehrzeilige listbox-einträge

Ein Thema von maddins · begonnen am 9. Apr 2007 · letzter Beitrag vom 11. Okt 2008
Antwort Antwort
LinuxFan

Registriert seit: 9. Jul 2007
Ort: Bensheim
20 Beiträge
 
RAD-Studio 2010 Arc
 
#1

Re: mehrzeilige listbox-einträge

  Alt 10. Okt 2008, 17:32
Zitat von hoika:
Hallo,

warum so kompliziert,
nimm einen TListView, da musst du gar nichts machen.

Delphi-Quellcode:
ListItem:= ListView.Items.Add;
ListItem.Caption:= 'Spalte 1';
ListItem.SubItems.Add('Spalte2');
Hier geht es um mehrZEILIGE ListBoxes. Nicht um mehrspaltige.

Für alle die es interessiert:
Delphi-Quellcode:
type
  TCodeInsightItem = record
                       ciType: string[255];
                       ciKey: string[255];
                       ciAttri: string[255];
                       ciReturn: string[255];
                       ciDesc: string[255];
                     end;

type
  PCodeInsightItem = ^TCodeInsightItem;

...........

procedure X ...;
var
  ciEntry: TCodeInsightItem;
  ciEntryP: PCodeInsightItem;
begin
  for i := 0 to lbxCodeInsight.Items.Count - 1 do
  begin
    ciEntryP := PCodeInsightItem(lbxCodeInsight.Items.Objects[i]);
    Dispose(ciEntryP);
  end;
  lbxCodeInsight.Items.Clear;
  for i := 0 to intBuffer - 1 do
  begin
    ... Definition von ciEntry ...
    New(ciEntryP);
    ciEntryP^.ciType := ciEntry.ciType;
    ciEntryP^.ciKey := ciEntry.ciKey;
    ciEntryP^.ciAttri := ciEntry.ciAttri;
    ciEntryP^.ciReturn := ciEntry.ciReturn;
    ciEntryP^.ciDesc := ciEntry.ciDesc;

    lbxCodeInsight.Items.AddObject(ciEntryP^.ciKey, TObject(ciEntryP));
  end;
end;

procedure TfrmMain.lbxCodeInsightDrawItem(Control: TWinControl; Index: Integer;
  Rect: TRect; State: TOwnerDrawState);
var
  Entry: PCodeInsightItem;
  ciKeyWidth, ciAttriWidth: Integer;
begin
     Entry := PCodeInsightItem(Items.Objects[Index]);
     if ItemIndex <> Index then
       if Index mod 2 = 0 then Canvas.Brush.Color := $00FDF7EE else Canvas.Brush.Color := clWhite;
     Canvas.FillRect(Rect);
     Canvas.TextOut(Rect.Left+1, Rect.Top+1, Entry^.ciType);
     Canvas.Font.Style := [fsBold];
     Canvas.TextOut(Rect.Left+60, Rect.Top+1, Entry^.ciKey);
     ciKeyWidth := Canvas.TextWidth(Entry^.ciKey);
     Canvas.Font.Style := [];
     Canvas.TextOut(Rect.Left+60+ciKeyWidth, Rect.Top+1, ' (' + Entry^.ciAttri + ')');
     ciAttriWidth := Canvas.TextWidth(' (' + Entry^.ciAttri + ')');
     if Entry^.ciReturn <> 'then Canvas.TextOut(Rect.Left+60+ciKeyWidth+ciAttriWidth, Rect.Top+1, ' : ' + Entry^.ciReturn);
     Canvas.Font.Style := [fsBold];
     Canvas.Font.Size := 8;
     Canvas.TextOut(Rect.Left+5, Rect.Top+18, Entry^.ciDesc);
   end;
end;
http://home.viathinksoft.de/victor/d...ne_listbox.jpg
Victor-Philipp Negoescu
ViaThinkSoft
http://www.viathinksoft.de
  Mit Zitat antworten Zitat
Antwort Antwort


Forumregeln

Es ist dir nicht erlaubt, neue Themen zu verfassen.
Es ist dir nicht erlaubt, auf Beiträge zu antworten.
Es ist dir nicht erlaubt, Anhänge hochzuladen.
Es ist dir nicht erlaubt, deine Beiträge zu bearbeiten.

BB-Code ist an.
Smileys sind an.
[IMG] Code ist an.
HTML-Code ist aus.
Trackbacks are an
Pingbacks are an
Refbacks are aus

Gehe zu:

Impressum · AGB · Datenschutz · Nach oben
Alle Zeitangaben in WEZ +1. Es ist jetzt 18:38 Uhr.
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024-2025 by Thomas Breitkreuz