Deklaration: Declare Function GetWindowExtEx Lib "gdi32" ( _ ByVal hdc As Long, _ lpSize As POINTAPI) As Long Beschreibung: Parameter:
Rückgabewert: Beispiel: Private Declare Function SetMapMode Lib "gdi32" ( _ ByVal hdc As Long, _ ByVal nMapMode As Long) As Long Private Declare Function GetMapMode Lib "gdi32" (ByVal hdc As Long) As Long Private Declare Function GetWindowExtEx Lib "gdi32" ( _ ByVal hdc As Long, _ lpSize As POINTAPI) As Long Private Declare Function SetWindowExtEx Lib "gdi32" ( _ ByVal hdc As Long, _ ByVal nX As Long, _ ByVal nY As Long, _ lpSize As Any) As Long Private Declare Function GetViewportExtEx Lib "gdi32" ( _ ByVal hdc As Long, _ lpSize As POINTAPI) As Long Private Declare Function SetViewportExtEx Lib "gdi32" ( _ ByVal hdc As Long, _ ByVal nX As Long, _ ByVal nY As Long, _ lpSize As Any) As Long Private Declare Function Polyline Lib "gdi32" ( _ ByVal hdc As Long, _ lpPoint As POINTAPI, _ ByVal nCount As Long) As Long Private Declare Function GetClientRect Lib "user32" ( _ ByVal hwnd As Long, _ lpRect As RECT) As Long Private Type RECT Left As Long Top As Long Right As Long Bottom As Long End Type Private Type POINTAPI x As Long y As Long End Type ' Get- / SetMapMode Rückgabe- / nMapMode-Konstanten Private Const MM_ANISOTROPIC = 8 ' Benutzerdefiniert, X- und Y-Achse haben verschiedene Skalierungen. ' Benutzen Sie die Get-/SetViewPortExtEx-Funktion und die ' Get-/SetWindowExtEx-Funktion, um die Maßeinheiten zu definieren Private Const MM_HIENGLISH = 5 ' Jeder logische Schritt ist 0,001 Inch Private Const MM_HIMETRIC = 3 ' Jeder logische Schritt ist 0,01 Millimeter Private Const MM_ISOTROPIC = 7 ' Benutzerdefiniert, X- und Y-Achse haben die selben Skalierungen. ' Benutzen Sie die Get-/SetViewPortExtEx-Funktion und die ' Get-/SetWindowExtEx-Funktion, um die Maßeinheit zu definieren Private Const MM_LOENGLISH = 4 ' Jeder logische Schritt ist 0,01 Inch Private Const MM_LOMETRIC = 2 ' Jeder logische Schritt ist 0,1 Millimeter Private Const MM_TEXT = 1 ' Jeder logische Schritt ist ein Pixel Private Const MM_TWIPS = 6 ' Jeder logische Schritt ist ein Twip Dim OldMapMode As Long, OldWindowExt As POINTAPI, OldViewport As POINTAPI Dim TmpPT(5) As POINTAPI, ClientR As RECT ' Skalierung der Form ermitteln Private Sub Form_Load() Dim RetVal As Long ' Aktuelle Skalierung ermitteln OldMapMode = GetMapMode(Me.hdc) Call GetViewportExtEx(Me.hdc, OldViewport) Call GetWindowExtEx(Me.hdc, OldWindowExt) ' Figur festlegen (Sechseck) TmpPT(0).x = 50 TmpPT(0).y = 2 TmpPT(1).x = 98 TmpPT(1).y = 35 TmpPT(2).x = 79 TmpPT(2).y = 90 TmpPT(3).x = 21 TmpPT(3).y = 90 TmpPT(4).x = 2 TmpPT(4).y = 35 TmpPT(5).x = 50 TmpPT(5).y = 2 End Sub ' Figur zeichnen (2 logische Schritte Abstand zu jedem Rand) Private Sub Form_Paint() Me.Cls ' Fensterbereich ermitteln Call GetClientRect(Me.hwnd, ClientR) ' Neue Skalierung der Form setzen (100/92 Schritte = Fensterbreite / Höhe) Call SetMapMode(Me.hdc, MM_ANISOTROPIC) ' Benutzerdefinierten Typen wählen Call SetWindowExtEx(Me.hdc, 100, 92, ByVal 0&) ' Das Fenster soll ' 100/92 logische Schritte hoch und breit sein Call SetViewportExtEx(Me.hdc, ClientR.Right, ClientR.Bottom, ByVal 0&) _ ' Die 100/92 Schritte ergeben sich aus der Fensterhöhe und Breite Call Polyline(Me.hdc, TmpPT(0), 6) ' Figur Zeichnen Me.CurrentX = 10 Me.CurrentY = 10 Me.Print "Hallo" End Sub Private Sub Form_Resize() Me.Refresh End Sub ' Alte Skalierung wieder herstellen Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer) Call SetMapMode(Me.hdc, OldMapMode) Call SetViewportExtEx(Me.hdc, OldViewport.x, OldViewport.y, ByVal 0&) Call SetWindowExtEx(Me.hdc, OldWindowExt.x, OldWindowExt.y, ByVal 0&) End Sub Diese Seite wurde bereits 7.599 mal aufgerufen. |
sevGraph (VB/VBA) Grafische Auswertungen Präsentieren Sie Ihre Daten mit wenig Aufwand in grafischer Form. sevGraph unterstützt hierbei Balken-, Linien- und Stapel-Diagramme (Stacked Bars), sowie 2D- und 3D-Tortendiagramme und arbeitet vollständig datenbankunabhängig! Buchempfehlung Tipp des Monats Mai 2024 Hermann Röttger Wochentage eines Datumsbereichs ermitteln Wochentage eines Datumsbereichs ermitteln, optional mit Feiertagsberechnung TOP Entwickler-Paket TOP-Preis!! Mit der Developer CD erhalten Sie insgesamt 24 Entwickler- komponenten und Windows-DLLs. Die Einzelkomponenten haben einen Gesamtwert von 1605.50 EUR... |
||||||||||||||
Microsoft, Windows und Visual Basic sind entweder eingetragene Marken oder Marken der Microsoft Corporation in den USA und/oder anderen Ländern. Weitere auf dieser Homepage aufgeführten Produkt- und Firmennamen können geschützte Marken ihrer jeweiligen Inhaber sein. |