Alignmenttext und Currency
This commit is contained in:
parent
4db9b71a29
commit
443242415a
@ -148,8 +148,6 @@ Public Class ClassControlCreator
|
||||
ctrl.Location = props.Location
|
||||
ctrl.Font = props.Font
|
||||
ctrl.ForeColor = props.Color
|
||||
|
||||
|
||||
If designMode Then
|
||||
ctrl.Cursor = Cursors.Hand
|
||||
End If
|
||||
@ -310,6 +308,7 @@ Public Class ClassControlCreator
|
||||
Dim oFormatString = oControlRow.ItemEx("FORMAT_STRING", String.Empty)
|
||||
Dim oBackColorIf = oControlRow.ItemEx("CTRL_BACKCOLOR_IF", String.Empty)
|
||||
Dim oIndexname = oControlRow.ItemEx("INDEX_NAME", String.Empty)
|
||||
Dim oAlignment = oControlRow.ItemEx("TEXT_ALIGNMENT", "Near")
|
||||
Dim oControl As BaseEdit = Nothing
|
||||
If oHeight >= 27 Then
|
||||
oControl = CreateBaseControl(New MemoEdit(), oControlRow, designMode)
|
||||
@ -324,6 +323,13 @@ Public Class ClassControlCreator
|
||||
|
||||
oControl.Height = oHeight
|
||||
oControl.Width = oWidth
|
||||
If oAlignment = "Near" Then
|
||||
oControl.Properties.Appearance.TextOptions.HAlignment = DevExpress.Utils.HorzAlignment.Near
|
||||
ElseIf oAlignment = "Center" Then
|
||||
oControl.Properties.Appearance.TextOptions.HAlignment = DevExpress.Utils.HorzAlignment.Center
|
||||
ElseIf oAlignment = "Far" Then
|
||||
oControl.Properties.Appearance.TextOptions.HAlignment = DevExpress.Utils.HorzAlignment.Far
|
||||
End If
|
||||
|
||||
If Not designMode Then
|
||||
'oControl.ReadOnly = oReadOnly
|
||||
@ -352,17 +358,24 @@ Public Class ClassControlCreator
|
||||
End Function
|
||||
|
||||
Public Function CreateExistingLabel(row As DataRow, designMode As Boolean) As Label
|
||||
Dim control As Label = CreateBaseControl(New Label(), row, designMode)
|
||||
Dim oControl As Label = CreateBaseControl(New Label(), row, designMode)
|
||||
Try
|
||||
control.Text = row.Item("CTRL_CAPTION_LANG")
|
||||
oControl.Text = row.Item("CTRL_CAPTION_LANG")
|
||||
Catch ex As Exception
|
||||
Logger.Warn("Label [{0}] does not have a translation!", control.Name)
|
||||
control.Text = row.Item("CTRL_TEXT")
|
||||
Logger.Warn("Label [{0}] does not have a translation!", oControl.Name)
|
||||
oControl.Text = row.Item("CTRL_TEXT")
|
||||
End Try
|
||||
Dim oAlignment = oControlRow.ItemEx("TEXT_ALIGNMENT", "Near")
|
||||
If oAlignment = "Near" Then
|
||||
oControl.TextAlign = ContentAlignment.MiddleLeft
|
||||
ElseIf oAlignment = "Center" Then
|
||||
oControl.TextAlign = ContentAlignment.MiddleCenter
|
||||
ElseIf oAlignment = "Far" Then
|
||||
oControl.TextAlign = ContentAlignment.MiddleRight
|
||||
End If
|
||||
oControl.AutoSize = True
|
||||
|
||||
control.AutoSize = True
|
||||
|
||||
Return control
|
||||
Return oControl
|
||||
End Function
|
||||
|
||||
Public Function CreateExistingButton(row As DataRow, designMode As Boolean) As Button
|
||||
@ -394,21 +407,30 @@ Public Class ClassControlCreator
|
||||
|
||||
Return oControl
|
||||
End Function
|
||||
Public Function CreateExistingCombobox(row As DataRow, designMode As Boolean) As Windows.Forms.ComboBox
|
||||
Dim control As Windows.Forms.ComboBox = CreateBaseControl(New Windows.Forms.ComboBox(), row, designMode)
|
||||
|
||||
control.Size = New Size(row.Item("WIDTH"), row.Item("HEIGHT"))
|
||||
Public Function CreateExistingCombobox(pRow As DataRow, designMode As Boolean) As Windows.Forms.ComboBox
|
||||
Dim oControl As Windows.Forms.ComboBox = CreateBaseControl(New Windows.Forms.ComboBox(), pRow, designMode)
|
||||
oControl.Size = New Size(pRow.Item("WIDTH"), pRow.Item("HEIGHT"))
|
||||
|
||||
If Not designMode Then
|
||||
control.Enabled = Not row.Item("READ_ONLY")
|
||||
control.TabStop = Not row.Item("READ_ONLY")
|
||||
control.BackColor = IIf(row.Item("READ_ONLY"), Color.LightGray, Color.White)
|
||||
oControl.Enabled = Not pRow.Item("READ_ONLY")
|
||||
oControl.TabStop = Not pRow.Item("READ_ONLY")
|
||||
oControl.BackColor = IIf(pRow.Item("READ_ONLY"), Color.LightGray, Color.White)
|
||||
|
||||
control.AutoCompleteMode = AutoCompleteMode.SuggestAppend
|
||||
control.AutoCompleteSource = AutoCompleteSource.ListItems
|
||||
oControl.AutoCompleteMode = AutoCompleteMode.SuggestAppend
|
||||
oControl.AutoCompleteSource = AutoCompleteSource.ListItems
|
||||
End If
|
||||
|
||||
Return control
|
||||
Dim oAlignment = pRow.ItemEx("TEXT_ALIGNMENT", "Near")
|
||||
If oAlignment = "Near" Then
|
||||
oControl. = ContentAlignment.MiddleLeft
|
||||
ElseIf oAlignment = "Center" Then
|
||||
oControl.TextAlign = ContentAlignment.MiddleCenter
|
||||
ElseIf oAlignment = "Far" Then
|
||||
oControl.TextAlign = ContentAlignment.MiddleRight
|
||||
End If
|
||||
|
||||
|
||||
Return oControl
|
||||
End Function
|
||||
|
||||
Public Function CreateExistingDatepicker(row As DataRow, designMode As Boolean) As DateTimePicker
|
||||
|
||||
@ -69,6 +69,9 @@ Public Module ModuleControlProperties
|
||||
<Category(ClassConstants.CAT_DISPLAY)>
|
||||
Public Property TextColor As Color
|
||||
|
||||
<DisplayName("Text Alignement")>
|
||||
<Category(ClassConstants.CAT_DISPLAY)>
|
||||
Public Property TextAlignment As String
|
||||
Class FontConverter
|
||||
Inherits TypeConverter
|
||||
|
||||
|
||||
@ -582,16 +582,17 @@ Public Class frmFormDesigner
|
||||
obj.ChangedAt = ClassAllgemeineFunktionen.NotNullDate(row.Item("CHANGED_WHEN"), Nothing)
|
||||
obj.ChangedWho = ClassAllgemeineFunktionen.NotNullString(row.Item("CHANGED_WHO"), "")
|
||||
|
||||
Dim style As FontStyle = ClassAllgemeineFunktionen.NotNullString(row.Item("FONT_STYLE"), FontStyle.Regular)
|
||||
Dim size As Single = ClassAllgemeineFunktionen.NotNullString(row.Item("FONT_SIZE"), 10)
|
||||
Dim familyString As String = ClassAllgemeineFunktionen.NotNullString(row.Item("FONT_FAMILY"), "Arial")
|
||||
Dim family As FontFamily = New FontFamily(familyString)
|
||||
Dim oStyle As FontStyle = ClassAllgemeineFunktionen.NotNullString(row.Item("FONT_STYLE"), FontStyle.Regular)
|
||||
Dim oSize As Single = ClassAllgemeineFunktionen.NotNullString(row.Item("FONT_SIZE"), 10)
|
||||
Dim oFamilyString As String = ClassAllgemeineFunktionen.NotNullString(row.Item("FONT_FAMILY"), "Arial")
|
||||
Dim oFamily As FontFamily = New FontFamily(oFamilyString)
|
||||
|
||||
obj.Font = New Font(family, size, style)
|
||||
obj.Font = New Font(oFamily, oSize, oStyle)
|
||||
|
||||
Dim color As Integer = ClassAllgemeineFunktionen.NotNullString(row.Item("FONT_COLOR"), 0)
|
||||
Dim oColor As Integer = ClassAllgemeineFunktionen.NotNullString(row.Item("FONT_COLOR"), 0)
|
||||
|
||||
obj.TextColor = IntToColor(color)
|
||||
obj.TextColor = IntToColor(oColor)
|
||||
obj.TextAlignment = ClassAllgemeineFunktionen.NotNullString(row.Item("TEXT_ALIGNMENT"), 0)
|
||||
|
||||
Return obj
|
||||
End Function
|
||||
|
||||
@ -1,5 +1,14 @@
|
||||
Imports DevExpress.DataAccess.Native.Sql
|
||||
Imports System.ComponentModel
|
||||
'Imports System.Data.SqlClient
|
||||
Imports System.Globalization
|
||||
Imports System.IO
|
||||
Imports System.Reflection
|
||||
Imports System.Runtime.InteropServices
|
||||
Imports System.Text.RegularExpressions
|
||||
Imports System.Threading
|
||||
Imports DevExpress.DataAccess.Native.Sql
|
||||
Imports DevExpress.Utils
|
||||
Imports DevExpress.Utils.Automation
|
||||
Imports DevExpress.XtraBars
|
||||
Imports DevExpress.XtraEditors
|
||||
Imports DevExpress.XtraEditors.Mask
|
||||
@ -19,14 +28,6 @@ Imports DigitalData.Modules.Interfaces
|
||||
Imports DigitalData.Modules.Logging
|
||||
Imports DigitalData.Modules.ZooFlow
|
||||
Imports DigitalData.Modules.ZooFlow.Constants
|
||||
Imports System.ComponentModel
|
||||
'Imports System.Data.SqlClient
|
||||
Imports System.Globalization
|
||||
Imports System.IO
|
||||
Imports System.Reflection
|
||||
Imports System.Runtime.InteropServices
|
||||
Imports System.Text.RegularExpressions
|
||||
Imports System.Threading
|
||||
'Imports System.Windows.Forms.VisualStyles.VisualStyleElement
|
||||
'Imports System.Windows.Forms.VisualStyles.VisualStyleElement.TextBox
|
||||
Imports WINDREAMLib
|
||||
@ -2739,6 +2740,33 @@ Public Class frmValidator
|
||||
' oErrorMessage = IDB_GetDocInfo()
|
||||
End If
|
||||
|
||||
Dim oCurrency As String
|
||||
If PROFIL_CURRENCY_ATTRIBUTE <> "" Then
|
||||
oCurrency = GetVariableValuefromSource(PROFIL_CURRENCY_ATTRIBUTE, 1, False)
|
||||
MyValidationLogger.Debug(String.Format("Read oCurrency from Attribute: {0} is {1}", PROFIL_CURRENCY_ATTRIBUTE, oCurrency))
|
||||
Else
|
||||
oCurrency = "EUR"
|
||||
MyValidationLogger.Debug(String.Format("oCurrency by default is {0}", oCurrency))
|
||||
End If
|
||||
If Not IsNothing(oCurrency) Then
|
||||
DocCurrency = oCurrency
|
||||
Dim oValueType = DocCurrency.GetType.ToString
|
||||
If IsDBNull(DocCurrency) Then
|
||||
DocCurrency = "EUR"
|
||||
Else
|
||||
Try
|
||||
DocCurrency = DocCurrency.ToString
|
||||
Catch ex As Exception
|
||||
MyValidationLogger.Warn($"Unexpected error in Converting oCurreny to string: " & ex.Message)
|
||||
DocCurrency = "EUR"
|
||||
End Try
|
||||
End If
|
||||
Else
|
||||
MyValidationLogger.Warn($"oCurrency is Nothing - Check PROFIL_CURRENCY_ATTRIBUTE! ")
|
||||
|
||||
End If
|
||||
|
||||
|
||||
|
||||
|
||||
If oErrMsgMissingInput = "" Then
|
||||
@ -2788,27 +2816,10 @@ Public Class frmValidator
|
||||
End If
|
||||
End If
|
||||
Try
|
||||
Dim oCurrency As String
|
||||
If PROFIL_CURRENCY_ATTRIBUTE <> "" Then
|
||||
oCurrency = GetVariableValuefromSource(PROFIL_CURRENCY_ATTRIBUTE, 1, False)
|
||||
Else
|
||||
oCurrency = "EUR"
|
||||
End If
|
||||
|
||||
If Not IsNothing(oCurrency) Then
|
||||
DocCurrency = oCurrency
|
||||
Dim oValueType = DocCurrency.GetType.ToString
|
||||
If IsDBNull(DocCurrency) Then
|
||||
DocCurrency = "EUR"
|
||||
Else
|
||||
Try
|
||||
DocCurrency = DocCurrency.ToString
|
||||
Catch ex As Exception
|
||||
MyValidationLogger.Warn($"Unexpected error in Converting oCurreny to string: " & ex.Message)
|
||||
DocCurrency = "EUR"
|
||||
End Try
|
||||
End If
|
||||
If DocCurrency <> String.Empty Then
|
||||
|
||||
|
||||
If DocCurrency <> String.Empty Then
|
||||
If DocCurrency.ToString.Length <> 3 Then
|
||||
MyValidationLogger.Info("DocCurrency-Length = 3 - Setting to EUR")
|
||||
DocCurrency = "EUR"
|
||||
@ -2861,10 +2872,7 @@ Public Class frmValidator
|
||||
Else
|
||||
MyValidationLogger.Warn($"DocCurrency is String.empty! ")
|
||||
End If
|
||||
Else
|
||||
MyValidationLogger.Warn($"oCurrency is Nothing - Check PROFIL_CURRENCY_ATTRIBUTE! ")
|
||||
|
||||
End If
|
||||
Catch ex As Exception
|
||||
MyValidationLogger.Warn($"Unexpected error in display format Currency: " & ex.Message)
|
||||
End Try
|
||||
@ -3397,6 +3405,9 @@ Public Class frmValidator
|
||||
|
||||
oTextBox.EditValue = ObjectEx.NotNull(oValueFromSource, oDefaultValue)
|
||||
|
||||
If oControl.GetType = GetType(DevExpress.XtraEditors.TextEdit) And oFormatString = "CURRENCY" Then
|
||||
ApplyCurrencyMask(oTextBox)
|
||||
End If
|
||||
Try
|
||||
Dim oBackColor As String = oControlRow.Item("CTRL_BACKCOLOR_IF")
|
||||
If oBackColor <> String.Empty Then
|
||||
@ -4074,6 +4085,33 @@ Public Class frmValidator
|
||||
|
||||
|
||||
End Sub
|
||||
|
||||
Private Sub ApplyCurrencyMask(pTextEdit As TextEdit)
|
||||
If pTextEdit Is Nothing Then Return
|
||||
Try
|
||||
' Kultur auf Basis der aktuellen UI, aber Währungssymbol aus DocCurrency setzen
|
||||
Dim culture As New CultureInfo("de-DE")
|
||||
' Wenn DocCurrency leer/fehlerhaft ist, fallback auf EUR
|
||||
Dim currencySymbol As String = If(String.IsNullOrWhiteSpace(DocCurrency) OrElse DocCurrency.Length <> 3, "EUR", DocCurrency)
|
||||
|
||||
' DevExpress Numeric-Mask "c" mit angepasster Kultur
|
||||
pTextEdit.Properties.MaskSettings.Configure(Of MaskSettings.Numeric)(
|
||||
Sub(settings)
|
||||
settings.MaskExpression = "c"
|
||||
settings.Culture = DirectCast(culture.Clone(), CultureInfo)
|
||||
settings.Culture.NumberFormat.CurrencySymbol = currencySymbol
|
||||
End Sub)
|
||||
|
||||
pTextEdit.Properties.UseMaskAsDisplayFormat = True
|
||||
|
||||
|
||||
Catch ex As Exception
|
||||
MyValidationLogger.Warn(String.Format("Unexpected error while applying CurrencyMaskfor pTextEdit: [{0} - ERROR: {1}", pTextEdit.Name, ex.Message))
|
||||
|
||||
End Try
|
||||
|
||||
End Sub
|
||||
|
||||
Private Sub frmValidation_Shown(sender As Object, e As System.EventArgs) Handles Me.Shown
|
||||
' Refresh_FileList()
|
||||
Load_Next_Document(True)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user