Labels laden wie sie sollen

This commit is contained in:
OlgunR
2025-07-01 16:22:42 +02:00
parent 5ac9b9b6fc
commit 80f49a1546
3 changed files with 50 additions and 35 deletions

View File

@@ -12,6 +12,7 @@ Imports DigitalData.Modules.Base
'Imports System.Security.Principal
Imports DigitalData.Modules.Logging
Imports DigitalData.Modules.Windream
Imports GdPicture.Internal.MSOfficeBinary.translator.Spreadsheet.XlsFileFormat.Records
Imports Limilabs.Mail
'Imports DevExpress.DataAccess.Native.Json
'Imports GdPicture.Internal.MSOfficeBinary.translator.Spreadsheet.XlsFileFormat.Records
@@ -168,23 +169,22 @@ Public Class frmIndex
pnlIndex.Controls.Add(lbl)
End Sub
Private Sub AddLabelAndControl(labelText As String,
ctrl As Control,
indexName As String)
Private Sub AddLabelAndControl(labelText As String, ctrl As Control, indexName As String)
'--- Label vorbereiten ------------------------------------
Dim lbl As New Label With {
Dim lbl As New Windows.Forms.Label With {
.Name = $"lbl_{indexName}",
.Text = labelText,
.AutoSize = True,
.Anchor = AnchorStyles.Left,
.Margin = New Padding(4, 4, 4, 4) 'äußerer Abstand
.Margin = New Padding(4, 4, 4, 4)
}
'--- Control vorbereiten ----------------------------------
ctrl.Anchor = AnchorStyles.Left Or AnchorStyles.Right
ctrl.Margin = New Padding(4, 4, 8, 4) 'äußerer Abstand rechts etwas größer
ctrl.Width = 260 'falls AutoSize=False
ctrl.Margin = New Padding(4, 4, 4, 4)
ctrl.Width = 300 'falls AutoSize=False
ctrl.Dock = DockStyle.Fill
'--- Zeile dynamisch anlegen ------------------------------
tlpIndex.RowCount += 1
@@ -2123,9 +2123,9 @@ Public Class frmIndex
Dim oDpiscale = oScreen.GetScreenScaling(Me)
Dim oRowTop As Integer = 20 * oDpiscale
Dim oLabelLeft As Integer = 10
Dim oControlLeft As Integer = 160
Dim oControlWidth As Integer = 300
Dim oLabelLeft As Integer = 20
Dim oControlLeft As Integer = 250
Dim oControlWidth As Integer = 420
Dim oZeilenhoehe As Integer = 30 * oDpiscale
_Logger.Info("Loading Indicies for Screen Scaling Factor [{0}]", oDpiscale)
@@ -2160,15 +2160,20 @@ Public Class frmIndex
Dim ctrl As Control = Nothing
Dim lbl As Windows.Forms.Label = Nothing
' Label nur anzeigen, wenn nicht BOOLEAN
If oDataType <> ClassConstants.INDEX_TYPE_BOOLEAN Then
Dim lbl As New Label()
lbl = New Windows.Forms.Label()
lbl.Text = oRow.Item("COMMENT").ToString()
lbl.Left = oLabelLeft
lbl.Top = oRowTop
lbl.Width = oControlLeft - oLabelLeft - 10
lbl.Height = 20
lbl.TextAlign = ContentAlignment.MiddleRight
lbl.AutoSize = True
lbl.MaximumSize = New Size(lbl.Width, 0) ' Max Breite, Höhe unbegrenzt
lbl.Height = lbl.PreferredHeight
lbl.TextAlign = ContentAlignment.MiddleLeft
lbl.UseCompatibleTextRendering = True
pnlIndex.Controls.Add(lbl)
End If
@@ -2207,7 +2212,17 @@ Public Class frmIndex
pnlIndex.Controls.Add(ctrl)
End If
oRowTop += oZeilenhoehe
Dim zeilenhoeheAktuell As Integer
If oDataType <> ClassConstants.INDEX_TYPE_BOOLEAN Then
' Verwende die Höhe vom Label oder Mindesthöhe
zeilenhoeheAktuell = Math.Max(lbl.Height, 30 * oDpiscale)
Else
' Für Boolean Controls kannst du die Standardhöhe nehmen
zeilenhoeheAktuell = 30 * oDpiscale
End If
oRowTop += zeilenhoeheAktuell
Next
' Panel- und Formhöhe anpassen, wenn nötig