Anh Bilder

This commit is contained in:
2024-11-18 13:46:56 +01:00
parent 151b912afb
commit bc5c7a794a

View File

@@ -154,10 +154,16 @@ Public Class frmSendungAnhangImport
'NOT WORKING
'PdfViewer.LoadFromFile(loc) NOT WORKING
End If
ElseIf typ = "BILD" Then
ElseIf typ = "BILD" Or typ = ".jpg" Then
PdfViewer.Visible = False
WebBrowser.Visible = (loc <> "")
WebBrowser.Navigate(loc)
' WebBrowser.Navigate(loc)
If loc <> "" Then
DisplayImageInWebBrowser(loc, WebBrowser)
Else
WebBrowser.Navigate("")
End If
End If
Button5.Visible = PdfViewer.Visible
@@ -166,6 +172,42 @@ Public Class frmSendungAnhangImport
End Try
End Sub
' Funktion zur Anzeige eines Bildes im WebBrowser
Private Sub DisplayImageInWebBrowser(imagePath As String, browser As WebBrowser)
' Dynamisches HTML erstellen
Dim html As String = $"
<!DOCTYPE html>
<html lang='en'>
<head>
<meta charset='UTF-8'>
<meta name='viewport' content='width=device-width, initial-scale=1.0'>
<title>Bild Vorschau</title>
<style>
body {{
margin: 0;
display: flex;
justify-content: center;
align-items: center;
height: 100vh;
background-color: #f0f0f0;
}}
img {{
max-width: 100%;
max-height: 100%;
object-fit: contain;
}}
</style>
</head>
<body>
<img src='file:///{imagePath.Replace("\", "/")}' alt='Bild'>
</body>
</html>
"
' HTML im WebBrowser laden
browser.DocumentText = html
End Sub
Function getAcitvePnl() As FlowLayoutPanel
For Each u As usrCntlSendungAnhangElement In flpnlAviso.Controls
If u.ACTIVE Then Return flpnlAviso