Danke für die schnelle Antwort. Ich hänge mal das wichtigste mit ran, wenn das so einfach geht, bin neu hier
Declaration der API:
' GdiAlphaBlend: Windows NT/2000/XP/Vista: Included in Windows 2000 and later.
Public Declare Function GdiAlphaBlend Lib "gdi32" (ByVal hdcDest As Long, _
ByVal XDest As Long, ByVal YDest As Long, ByVal WidthDest As Long, _
ByVal HeightDest As Long, ByVal hdcSrc As Long, ByVal xSrc As Long, _
ByVal ySrc As Long, ByVal WidthSrc As Long, ByVal HeightSrc As Long, _
ByVal Blendfunc As Long) As Long
Public PicBreite As Long ' Bildbreite
Public PicHoehe As Long ' Bildhöhe
Public Bildpfad As String
Public TempBild As StdPicture
'======================================================
Beim Laden der Datei und des verwendeten Hintergrundbildes die Berechnung des _
Seitenverhältnisses, nach der dann die Picturegröße festgelegt wird:
Public Sub Bildanpassung()
If Len(Bildpfad) > 0 And X_echt > 0 And Y_echt > 0 Then
'Seitenverhältnisse feststellen:
RatioRahmen = Picture3.ScaleWidth / Picture3.ScaleHeight _
'Formseitenverhältnis Bildrahmen
RatioPic = X_echt / Y_echt 'Bildseitenverhältnis
Ratio = RatioPic / RatioRahmen 'Bild-zu-Form Verhältnis
If Ratio < 1 Then Picture1.Height = Picture3.ScaleHeight: Picture1.Width = _
Picture1.Height * RatioPic
If Ratio >= 1 Then Picture1.Width = Picture3.ScaleWidth: Picture1.Height = _
Picture1.Width / RatioPic
Picture1.Top = Picture3.Top + (Picture3.Height / 2 - Picture1.Height / 2)
Picture1.Left = Picture3.Left + (Picture3.Width / 2 - Picture1.Width / 2)
Set TempBild = LoadPicture(Bildpfad) ' Bild laden
With Picture2
PicBreite = Picture1.ScaleWidth 'Bildbreite
PicHoehe = Picture1.ScaleHeight 'Bildhöhe
.Move 0, 0, PicBreite, PicHoehe 'Größe anpassen
.PaintPicture TempBild, 0, 0, PicBreite, PicHoehe 'Positionierung und
' Größe (Stretch) Bild in Picture2
End With
Call HScroll1_Scroll
Set TempBild = LoadPicture() 'Speicher freigeben
If Picture1.Visible = False Then Picture1.Visible = True
Label21.Caption = "Kleinste Auflösung: " & Format(X_echt / Picture1.Width, _
"0.00") & " mm"
End If
End Sub
'======================================================
'Bildhelligkeitsblendfunktion direkt vor dem Linienzeichnen:
Alphawert = HScroll1.Value
With Picture1
.DrawWidth = 1
.DrawStyle = 0
.BackColor = vbWhite
Call GdiAlphaBlend(.hDC, 0, 0, PicBreite, PicHoehe, Picture2.hDC, 0, 0, _
PicBreite, PicHoehe, &H10000 * Alphawert)
'.Refresh 'nicht notwendig, so auch kein Bildflackern
End With
'====================================================== Hoffe, dass jemand die Muse hat, da was zu sehen, wär schön, danke schon mal. Micha |