AGB  ·  Datenschutz  ·  Impressum  







Anmelden
Nützliche Links
Registrieren
Zurück Delphi-PRAXiS Programmierung allgemein Multimedia Delphi Screen DPI und TrayIcon Größe?
Thema durchsuchen
Ansicht
Themen-Optionen

Screen DPI und TrayIcon Größe?

Ein Thema von PeterPanino · begonnen am 19. Okt 2023 · letzter Beitrag vom 22. Okt 2023
 
PeterPanino

Registriert seit: 4. Sep 2004
1.467 Beiträge
 
Delphi 10.4 Sydney
 
#1

Screen DPI und TrayIcon Größe?

  Alt 19. Okt 2023, 14:26
Ich verwende diesen Code zur Bestimmung des SCREEN DPI Wertes:

Delphi-Quellcode:
function GetScalingFactor: Integer;
// The function returns the number of pixels per logical inch along the screen width. Normally, this will be 96
// for a scaling of 100%. Higher values indicate higher scaling.
// Once you have the scaling factor, you can make an educated guess about the tray icon size. For example,
// if the scaling is 100% (96 DPI), a 16x16 icon is typical. For 200% (192 DPI), you might want to use a 32x32 icon.
// Please note that this is not a foolproof method; it's more of an educated guess based on the system's DPI settings.
var
  hdc: Winapi.Windows.HDC;
begin
  hdc := GetDC(0);
  try
    Result := GetDeviceCaps(hdc, LOGPIXELSX);
  finally
    ReleaseDC(0, hdc);
  end;
end;
Könnt ihr bitte mal testen, ob sich die Pixelgröße der Tray Icons abhängig von diesem Wert ändert?

Zweck: Ich erzeuge das Icon für mein Tray Icon dynamisch zur Laufzeit. Auf meinem Bildschirm ergibt die Tray Icon Größe 32x32 Pixel. Aber das könnte bei anderen Bildschirmen ja anders sein.
Geändert von PeterPanino, damit der Platz auf dem Bildschirm nicht so leer aussieht.
  Mit Zitat antworten Zitat
 

 

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 12:12 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