![]() |
Screen Resolution and Tlistbox
I got a problem i can generate supported resolution modes in a ilstbox,right..
Then i got this after calling the enumdisplaysettings.This is in a listbox. 640X480 8 bit 640X480 8 bit 640X480 8 bit 640X480 8 bit 640X480 16 bit 640X480 16 bit 640X480 16 bit 640X480 16 bit Can i somehow filter(remove) the items that have the same name.Couse i dont need that many items that are the same its confusing! |
Re: Screen Resolution and Tlistbox
Write the items first in a TStringList with
Delphi-Quellcode:
set and then assign it to the ListBox with
MyStringList.Duplicates := dupIgnore;
Delphi-Quellcode:
MyListBox.Items.Assign(MyStringList);
|
Re: Screen Resolution and Tlistbox
How do you call enumdisplaysettings? It doens't return duplicate entries.
|
Re: Screen Resolution and Tlistbox
Delphi-Quellcode:
[edit=mkinzler]Better readable with Delphi-Tags Mfg, mkinzler[/edit]
procedure tform4.res;
var i : Integer; DevMode : TDeviceMode; begin i:=0; while EnumDisplaySettings(nil,i,DevMode) do begin with Devmode do ListBox1.Items.Add(Format('%dx%d %d Colors',[dmPelsWidth,dmPelsHeight,1 shl dmBitsperPel])); Inc(i); end; end; |
Re: Screen Resolution and Tlistbox
Hm, so I guess this is due to different refresh rates? Anyway, adding a mode only if it's not already in the list is preferable rather than removing duplicate entries afterwards.
By the way, you can find a complete implementation here (that ignores the duplicates): ![]() |
Re: Screen Resolution and Tlistbox
Crap i always do something wrong...
|
Re: Screen Resolution and Tlistbox
Here my way :
Delphi-Quellcode:
var
i : Integer; DevMode : TDeviceMode; s : String; begin i:=0; while EnumDisplaySettings(nil,i,DevMode) do begin with Devmode do s := Format('%dx%d %d Colors',[dmPelsWidth,dmPelsHeight,1 shl dmBitsperPel]); if ListBox1.Items.IndexOf(s) < 0 then ListBox1.Items.Add(s); Inc(i); end; end; |
Alle Zeitangaben in WEZ +1. Es ist jetzt 17:16 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