Autor Beitrag
MH1987
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 98



BeitragVerfasst: So 28.01.07 12:44 
Hi,

ich hätte gerne eine Drop down liste wo in jedem Item ein LandName und ie jeweilige Flagge hinter ist.
Ich hab bisher nur die Combo-Box als drop down liste gefunden, aber dort bekomme ich keine bilder rein.

Mit einem Menu ginge das, aber das ist ja immer am oberen bildschirm rand.

Kann mir jemand weiterhelfen?

Danke

Gruß

Matthias
Keldorn
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 2266
Erhaltene Danke: 4

Vista
D6 Prof, D 2005 Pro, D2007 Pro, DelphiXE2 Pro
BeitragVerfasst: So 28.01.07 13:55 
Hallo

welche Delphiversion hast Du? z.B. gibts bei Delphi2005 (weiß nicht ab welcher Delphiversion genau) eine ComboboxEX, wo du mit einer imagelist deine Bildchen einfach hinzufügen kannst. ansonsten wirst du nicht drumrumkommen, deine Combobox selbst zu zeichnen.
Mfg Frank

_________________
Lükes Grundlage der Programmierung: Es wird nicht funktionieren.
(Murphy)
jaenicke
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 19346
Erhaltene Danke: 1754

W11 x64 (Chrome, Edge)
Delphi 12 Pro, C# (VS 2022), JS/HTML, Java (NB), PHP, Lazarus
BeitragVerfasst: So 28.01.07 14:02 
:shock: Wofür das Rad neu erfinden?
torry.net/pages.php?id=134
Da gibts beispielsweise die Image CL v.1.0, hier direkt die Homepage dieser Komponente: mcop.netfirms.com/icl.html
MH1987 Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 98



BeitragVerfasst: So 28.01.07 14:44 
hab mir mal die Komponente runter geladen, komm aber noch nicht so ganz damit klar.

meine bisherigen versuche:

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
procedure TForm1.FormCreate(Sender: TObject);
var neu: TBitmap;
    list: TImageList;
begin
  neu:= TBitmap.Create;
  neu.LoadFromFile('D:\Zubehör\Programmieren\delphi\dogtags\flaggen\DE.bmp');

  list:= TImageList.Create(Form1);
  list.Insert(0,neu,neu);

  self.MCoPImageComboBox1.DropDownCount:= 1;
  self.MCoPImageComboBox1.ItemIndex:= 1;
  self.MCoPImageComboBox1.ImageList.Insert(0,neu,neu);

end;


wäre toll wenn mir jemand zeigen könnte wie ich da ein bild rein bekomme
jaenicke
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 19346
Erhaltene Danke: 1754

W11 x64 (Chrome, Edge)
Delphi 12 Pro, C# (VS 2022), JS/HTML, Java (NB), PHP, Lazarus
BeitragVerfasst: So 28.01.07 15:16 
:shock: WTF?
1. Welche Delphi-Version hast du? Wie bereits gesagt ist bei neueren Versionen so eine Komponente schon dabei.
2. Du verbindest die ImageList ja gar nicht mit der ComboBox.
3. Warum muss es eigentlich per Code sein? Warum gehts nicht einfach in der IDE im Formulardesigner? Ändert sich deine Liste, dass die dynamisch geladen werden muss?

Wenn du es jedenfalls per Code machen willst, so gehts:
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
var
  neu: TBitmap;
begin
  neu:= TBitmap.Create;
  neu.LoadFromFile('L:\Delphi\Komponenten\Grafik\Bildeditor für Delphi\EYEDROP.BMP');

  self.MCoPImageComboBox1.DropDownCount:= 1; // Nur einen Eintrag zur Auswahl untereinander anzeigen 
  self.MCoPImageComboBox1.ImageList.Insert(0, neu, neu); // Bild einfügen
  self.MCoPImageComboBox1.ItemIndex:= 1; // den zweiten Eintrag in der Box anzeigen

  neu.Free;

Dafür musst du eine TImageList aufs Formular legen und bei der ComboBox diese in der Eigenschaft ImageList auswählen...
MH1987 Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 98



BeitragVerfasst: So 28.01.07 23:14 
ich muss sie leider dynamisch laden.
Hab es aber immernoch nicht so gan hinbekommen. Es gibt immerhin keinen Fehler und der Text steht auch da aber die dazugehörige flagge nicht! Der Pfad des Bitmaps stimmt, das hab ich überprüft.
Die ImageList1 existiert bereits.
hab ich sonst noch was vergessen?

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
var
  neu: TBitmap;
begin
  neu:= TBitmap.Create;
  neu.LoadFromFile('flaggen/'+laender[1].LandName+'.bmp');

  self.ImageList1.Insert(0,neu,neu);

  self.MCoPImageComboBox1.ImageList:= self.ImageList1;

  self.MCoPImageComboBox1.ImageList.AddImages(self.ImageList1);

  self.MCoPImageComboBox1.AddItem(laender[1].LandName,sender);
end;
jaenicke
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 19346
Erhaltene Danke: 1754

W11 x64 (Chrome, Edge)
Delphi 12 Pro, C# (VS 2022), JS/HTML, Java (NB), PHP, Lazarus
BeitragVerfasst: Mo 29.01.07 00:34 
user profile iconMH1987 hat folgendes geschrieben:
Der Pfad des Bitmaps stimmt, das hab ich überprüft.

Welcher Pfad? Du hast doch fälschlicherweise gar keinen angegeben? :gruebel:
Wie wärs mit Pfad?
ausblenden Delphi-Quelltext
1:
  neu.LoadFromFile(ExtractFilePath(ParamStr(0)) + '/flaggen/' + laender[1].LandName + '.bmp');					


user profile iconMH1987 hat folgendes geschrieben:
Hab es aber immernoch nicht so gan hinbekommen. Es gibt immerhin keinen Fehler und der Text steht auch da aber die dazugehörige flagge nicht!

Komisch... Bei mir funktioniert exakt dein Code... :nixweiss:
Siehe Anhang...
Ach so: Ohne Pfad ging auch... Ich hab den danach erst hingeschrieben, als es schon ging.
Einloggen, um Attachments anzusehen!
MH1987 Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 98



BeitragVerfasst: Mo 29.01.07 10:59 
Es lag nicht an meinem Delphi-Code sondern an der groesse des Bildes :roll:
ich habs jetzt aus 16x16 gemacht und es funzt.

Danke nochmals für deine Bemühungen!

Gruß
Matthias