MS New Properties

This commit is contained in:
2019-11-15 14:35:14 +01:00
parent 9e20642257
commit fefb26b556
28 changed files with 2132 additions and 4130 deletions

View File

@@ -31,6 +31,7 @@ Public Class ClassControlCreator
Public Const PREFIX_DATAGRIDVIEW = "DGV"
Public Const PREFIX_TABLE = "TB"
Public Const PREFIX_LINE = "LINE"
Public Const PREFIX_BUTTON = "BTN"
''' <summary>
@@ -87,6 +88,7 @@ Public Class ClassControlCreator
ctrl.Font = props.Font
ctrl.ForeColor = props.Color
If designMode Then
ctrl.Cursor = Cursors.Hand
End If
@@ -222,6 +224,16 @@ Public Class ClassControlCreator
Return control
End Function
Public Shared Function CreateNewButton(location As Point) As Button
Dim control As New Button With {
.Name = $"{PREFIX_BUTTON}_{clsTools.ShortGuid}",
.Size = New Size(DEFAULT_WIDTH, DEFAULT_HEIGHT),
.Cursor = Cursors.Hand,
.Location = location
}
Return control
End Function
' ----------------------- EXISITING CONTROLS -----------------------
@@ -258,7 +270,33 @@ Public Class ClassControlCreator
Return control
End Function
Private Shared Function ByteArrayToBitmap(bytearray() As Byte) As Bitmap
Return New Bitmap(New System.IO.MemoryStream(bytearray))
End Function
Public Shared Function CreateExistingButton(row As DataRow, designMode As Boolean) As Button
Dim oControl As Button = CreateBaseControl(New Button(), row, designMode)
Dim ctrl_image As Bitmap = Nothing
Dim oBitmap As Bitmap
If Not IsDBNull(row.Item("IMAGE_CONTROL")) Then
Dim obimg() As Byte = row.Item("IMAGE_CONTROL")
oBitmap = ByteArrayToBitmap(obimg)
ctrl_image = oBitmap
End If
oControl.Text = row.Item("CTRL_TEXT")
oControl.Height = row.Item("HEIGHT")
oControl.Width = row.Item("WIDTH")
If Not IsNothing(ctrl_image) And Not IsNothing(oBitmap) Then
oControl.Image = oBitmap
oControl.ImageAlign = ContentAlignment.MiddleLeft
oControl.TextAlign = ContentAlignment.MiddleRight
End If
oControl.AutoSize = True
Return oControl
End Function
Public Shared 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)
@@ -473,6 +511,33 @@ Public Class ClassControlCreator
Return 0
End Try
End Function
Public Shared Function GET_CONTROL_PROPERTY(DT_CONTROL As DataTable, ControlGUID As Integer, ColNAME As String)
Try
CURRENT_CONTROL_ID = 0
CURR_CON_ID = 0
CURR_SELECT_CONTROL = ""
CURR_CHOICE_LIST = ""
Dim dt As New DataTable
dt = DT_CONTROL
' Define the filter
Dim filter As String = "GUID = " & ControlGUID
' Filter the rows using Select() method of DataTable
Dim FilteredRows As DataRow() = dt.Select(filter)
If FilteredRows.Count = 1 Then
Dim oRESULT = FilteredRows(0).Item(ColNAME)
If IsDBNull(oRESULT) Then Return Nothing
Return oRESULT
Else
Return Nothing
End If
Catch ex As Exception
LOGGER.Error(ex)
LOGGER.Info("Unexpected Error in GET_CONTROL_PROPERTY (" & ControlGUID & "#" & ColNAME & "):" & ex.Message)
Return Nothing
End Try
End Function
Public Shared Function GET_DEPENDING_CONTROLS(DT_CONTROLS As DataTable, ControlName As String)
Try