Autor Beitrag
adler
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 511

Windows XP
Delphi 05 Pers
BeitragVerfasst: Sa 01.10.05 14:55 
Hallo.

Ich glaube mein SetMapMode(Handle, MM_...) funktioniert nicht.
So sieht es aus:

ausblenden Delphi-Quelltext
1:
2:
3:
  SetMapMode(Panel1.Handle, MM_LOMETRIC);
  Panel1.Height := 550;
  Panel1.Width := 850;


Und müsste dann eigentlich 55 mm Hoch und 85 mm Breit sein oder?

Bitte um Hilfe.


Moderiert von user profile iconraziel: Topic aus Sonstiges verschoben am Di 04.10.2005 um 09:34

_________________
Wo's nix zu gucken gibt, gibts vielleicht was zu hören.
Sprint
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 849



BeitragVerfasst: Sa 01.10.05 15:21 
SetMapMode erwartet als ersten Parameter ein DeviceContext Handle und kein Fensterhandle.

_________________
Ciao, Sprint.
adler Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 511

Windows XP
Delphi 05 Pers
BeitragVerfasst: Sa 01.10.05 15:48 
Und den hat ein Panel nicht oder?
Was kann ich dann nehmen?

_________________
Wo's nix zu gucken gibt, gibts vielleicht was zu hören.
Sprint
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 849



BeitragVerfasst: Sa 01.10.05 16:03 
user profile iconadler hat folgendes geschrieben:
Und den hat ein Panel nicht oder? Was kann ich dann nehmen?

Mit Suche im MSDN GETWINDOWDC, Suche im MSDN GETDC oder mit der Delphi Funktion GetDeviceContext (TWinControl) eins erzeugen.

_________________
Ciao, Sprint.
adler Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 511

Windows XP
Delphi 05 Pers
BeitragVerfasst: Sa 01.10.05 16:24 
Die Antwort versteh ich nicht, habe mir die Suche mal angeguckt, aber ich versteh es nicht, kannst du nicht ein Beispiel machen?
Wie ich das erzeugen soll.

_________________
Wo's nix zu gucken gibt, gibts vielleicht was zu hören.
Sprint
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 849



BeitragVerfasst: Sa 01.10.05 16:40 
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
var
  DC: HDC;
begin

  DC := GetDC(Panel1.Handle);
  // ...
  ReleaseDC(Panel1.Handle, DC);

end;

_________________
Ciao, Sprint.
adler Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 511

Windows XP
Delphi 05 Pers
BeitragVerfasst: Sa 01.10.05 16:52 
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
procedure TForm1.FormShow(Sender: TObject);
var
  DC: HDC;
begin
  DC := GetDC(Panel1.Handle);
  SetMapMode( DC , MM_LOMETRIC);
  Panel1.Height := 550;
  Panel1.Width := 850;
end;


Nunja, kein Fehler aber geht net so wie am Anfang.

_________________
Wo's nix zu gucken gibt, gibts vielleicht was zu hören.
Sprint
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 849



BeitragVerfasst: Sa 01.10.05 17:10 
Heigth und Width sind Werte in Pixel und nicht Millimeter.

_________________
Ciao, Sprint.
adler Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 511

Windows XP
Delphi 05 Pers
BeitragVerfasst: Sa 01.10.05 17:18 
Und wie gebe ich dann die breite und höhe in mm an?
Ich will die ja in mm einstellen können.

_________________
Wo's nix zu gucken gibt, gibts vielleicht was zu hören.
Alstar
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 827



BeitragVerfasst: Sa 01.10.05 18:36 
Musst Du umrechnen. Es gibt die Property
ausblenden Delphi-Quelltext
1:
Screen.PixelPerInch					

dann musst du nurnoch Inch in CM umrechenen und dann kannst du berechnen wieviele Pixel auf einen Millimeter passen ...

Alstar
Lannes
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 2352
Erhaltene Danke: 4

Win XP, 95, 3.11, IE6
D3 Prof, D4 Standard, D2005 PE, TurboDelphi, Lazarus, D2010
BeitragVerfasst: Sa 01.10.05 21:01 
Hallo,

Screen.PixelPerInch gilt doch nur für die vertikalen Maße,
oder irre ich mich da :?:

_________________
MfG Lannes
(Nichts ist nicht Nichts) and ('' <> nil ) and (Pointer('') = nil ) and (@('') <> nil )
Alstar
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 827



BeitragVerfasst: So 02.10.05 11:09 
Na und? Pixel sind quadratisch. Sprich: Vertikale und Horizontale Maße sind gleich.

Alstar
Lannes
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 2352
Erhaltene Danke: 4

Win XP, 95, 3.11, IE6
D3 Prof, D4 Standard, D2005 PE, TurboDelphi, Lazarus, D2010
BeitragVerfasst: So 02.10.05 11:36 
Hallo,

:gruebel:
Wie muss ich denn das interpretieren?
user profile iconDelphi-Hilfe hat folgendes geschrieben:
Verwenden Sie die Eigenschaft PixelsPerInch, wenn Maße von Pixel in Zoll (und umgekehrt) konvertiert werden müssen. PixelsPerInch gilt nur für vertikale Maße. Die meisten Bildschirme verwenden für horizontale Maße einen anderen Skalierungsfaktor. Der Wert in PixelsPerInch wird von Windows gesetzt, wenn Delphi geladen wird.

Ich rechne in einem aktuellen Programm mit PixelsPerInch,
bei einem 19" Röhrenbildschirm ist die Berechnung ok,
auf einem anderen Rechner mit 19" Flachbildschirm ist nur die vertikale Berechnung in Ordnung.

_________________
MfG Lannes
(Nichts ist nicht Nichts) and ('' <> nil ) and (Pointer('') = nil ) and (@('') <> nil )
Alstar
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 827



BeitragVerfasst: So 02.10.05 11:42 
Axxo?! :gruebel:

Dein 19" LCD hat nicht zufällig die Auflösung von 1280 x 1024?!

Alstar
Lannes
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 2352
Erhaltene Danke: 4

Win XP, 95, 3.11, IE6
D3 Prof, D4 Standard, D2005 PE, TurboDelphi, Lazarus, D2010
BeitragVerfasst: So 02.10.05 12:20 
Hallo,

genau, richtig geraten :wink:
In meinem Programm erstelle ich Tabellen im Richedit über RTF-Code.
Dazu errechne ich die Textbreite per TextWidth und erhalte einen Wert in Pixel.
Um die breite der Tabellenspalten festzulegen muss ich mit Twips arbeiten,
diese errechnen sich wie folgt:
1 Inch = 1440 Twips
1 Inch = ???? Pixel horizontal < da liegt das Problem

_________________
MfG Lannes
(Nichts ist nicht Nichts) and ('' <> nil ) and (Pointer('') = nil ) and (@('') <> nil )
Alstar
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 827



BeitragVerfasst: So 02.10.05 13:15 
Das Problem liegt darin, dass die Auflösungen bei 17" und 19" TFT-Monitoren etwas komisch ist.
1280 x 1024 ergibt ein Seitenverhältnis von 1.25:1 anstatt von normalerweise 1.33:1

[ot]
Gibt es eigentlich 19" TFTs mit einer höheren Auflösung als 1280 x 1024?
[/ot]

Alstar
BenBE
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 8721
Erhaltene Danke: 191

Win95, Win98SE, Win2K, WinXP
D1S, D3S, D4S, D5E, D6E, D7E, D9PE, D10E, D12P, DXEP, L0.9\FPC2.0
BeitragVerfasst: So 02.10.05 14:03 
@Alstar: Ja, gibt es, allerdings kann sich die niemand leisten ...

Achso, noch was: Mein TFT hat physikalisch 38:30 cm bei 1.25:1 Bildverhältnis.

D.h. 1280 Pixel horizontal sind 38cm, 1024 Pixel vertikal sind 30cm. Um diese Informationen für jeden Monitor auslesen zu können, müsstest Du generell über die EDID-Informationen die Hardware abfragen. Da aber EDID nur bei Verfügbarkeit von DDC2 von der Grafikkarte abgefragt werden kann, ist ein Echtheitsgetreues Bild von den Maßstäben her nicht vollständig erreichbar.

_________________
Anyone who is capable of being elected president should on no account be allowed to do the job.
Ich code EdgeMonkey - In dubio pro Setting.
Flocke
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 54

Win 2000, Win XP, Win 2003, Linux
Delphi 2006 Prof.
BeitragVerfasst: Mo 03.10.05 11:31 
Zitat:
1 Inch = 1440 Twips
1 Inch = ???? Pixel horizontal < da liegt das Problem

So:
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
function HorizontalResolution: integer;
var
  dc: HDC;
begin
  dc := GetDC(0);
  Result := GetDeviceCaps(dc, LOGPIXELSX);
  ReleaseDC(0, dc);
end;
Lannes
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 2352
Erhaltene Danke: 4

Win XP, 95, 3.11, IE6
D3 Prof, D4 Standard, D2005 PE, TurboDelphi, Lazarus, D2010
BeitragVerfasst: Mo 11.12.06 21:01 
Hallo Flocke,

hab Deine Antwort vor einem Jahr wohl irgendwie übersehen,
es funktioniert, Danke :)

_________________
MfG Lannes
(Nichts ist nicht Nichts) and ('' <> nil ) and (Pointer('') = nil ) and (@('') <> nil )