Autor Beitrag
Sliver
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 18



BeitragVerfasst: Sa 25.10.03 13:03 
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
for i:=0 to 25 do begin
    s:=Chr(i+65)+':';
    typ:=GetDriveType(PChar(s));
    if (Typ<>0) then       
      case Typ of
        DRIVE_FIXED:CheckListBox1.Items.Add((Chr(i+65)+':\'));   //HDD
        DRIVE_REMOTE:CheckListBox1.Items.Add(Chr(i+65)+':\');  //Network
    end;
  end;

So lese ich die Festplatten in die ListBox ein. Bei CheckListBox.Style hab ich lbOwnerDrawVariable eingestellt, so dass ich auch Bildchen einfügen können sollte.

Jetzt zu meiner Frage, wie kann ich zu der Festplatte noch die Bezeichnung hinzufügen und wie füge ich ein Bildchen bei jeder Zeile ein?

cu Sliver

Moderiert von user profile iconTino: Titel geändert & Topic verschoben.
Tino
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Veteran
Beiträge: 9839
Erhaltene Danke: 45

Windows 8.1
Delphi XE4
BeitragVerfasst: Mo 27.10.03 11:17 
Schau dich doch mal in der FAQ um:

...erfahren um welchen DiskTyp es sich handelt?
...Name, Seriennummer und Typ eines Laufwerks ermitteln?

Das könnte dir doch erstmal helfen, oder?

Gruß
Tino
Sliver Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 18



BeitragVerfasst: Mo 27.10.03 14:04 
OK, Typ hab ich ja schon gehabt, den Namen jetzt auch (thx), jetzt also nur noch das Problem mit der CheckListBox und den Bildchen.

cu Sliver
smiegel
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 992
Erhaltene Danke: 1

WIN 7
D7 Prof., C#, RAD XE Prof.
BeitragVerfasst: Mo 27.10.03 14:08 
Hallo,

für die Ausgabe bist Du selber verantwortlich.

In Deinem 1. Posting hast Du folgendes geschrieben:
Silver hat folgendes geschrieben:

... CheckListBox.Style hab ich lbOwnerDrawVariable eingestellt ...


Schau Dir dazu das Ereignis OnDrawItem an. Beispiele findest Du in der Delphi-Hilfe oder per Suche hier im Forum.

_________________
Gruß Smiegel
Ich weiß, daß ich nichts weiß, aber ich weiß mehr als die, die nicht wissen, daß sie nichts wissen. (Sokrates)
Sliver Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 18



BeitragVerfasst: Mo 27.10.03 14:43 
Thx hab es jetzt so gelöst.

ausblenden Delphi-Quelltext
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:
  Bitmap1:=TBitmap.Create;
  Bitmap1.LoadFromFile('faild.bmp'); 
  CheckListBox1.Items.AddObject('Bitmap 1', Bitmap1);
....
procedure TForm1.CheckListBox1DrawItem(Control: TWinControl;
  Index: Integer; Rect: TRect; State: TOwnerDrawState);
var
  Bitmap:TBitmap;
  Offset:Integer;
begin
  offset:=0;
  with CheckListBox1.Canvas do
  begin
    FillRect(Rect);
    Bitmap:=TBitmap(CheckListBox1.Items.Objects[Index]);
    if Bitmap<>nil then
    begin
      //copy bitmap to combobox coordinate
      BrushCopy(Bounds(Rect.Left+2,Rect.Top+2,10,10),Bitmap,Bounds(0,0,10,10),clred);
      Offset:=10;
    end;
    //Set a caption to each item
    TextOut(Rect.Left+Offset,Rect.Top,CheckListBox1.Items[Index]);
  end;
end;


cu Sliver