Files
2023-01-16 17:52:08 +01:00

103 lines
3.2 KiB
VB.net
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
Imports System.Globalization
Imports System.Runtime.InteropServices
Imports EgtUILib
Public Module Utility
#Region "<!--EgtKeyboard-->"
' Posizione della tastiera
Public Enum Positions
CenteredInOwner
RelativeToSource
Custom
End Enum
' Lato di riferimento per posizionare la tastiera quando impostato a RelativeToSource
Public Enum RelativeToSourcePositions
Top
Right
Bottom
Left
End Enum
#End Region
Enum WidthType
GRID
PIXEL
NULL
End Enum
Friend Function DoubleToString(ByVal dVal As Double, ByVal nNumDec As Integer) As String
Dim sFormat As String = "F" + Math.Abs(nNumDec).ToString()
Dim sVal As String = dVal.ToString(sFormat, CultureInfo.InvariantCulture)
If nNumDec > 0 Then
Return sVal.TrimEnd("0".ToCharArray()).TrimEnd(".".ToCharArray)
Else
Return sVal
End If
End Function
Friend Function StringToDouble(sVal As String, ByRef dVal As Double) As Boolean
If String.IsNullOrEmpty(sVal) Then Return False
Return EgtLuaEvalNumExpr(sVal, dVal)
End Function
Private m_MainWindow As Window
Public Property MainWindow As Window
Get
Return m_MainWindow
End Get
Set(value As Window)
m_MainWindow = value
End Set
End Property
#Region "<!--EgtPopup-->"
Public Class WinApi
<StructLayout(LayoutKind.Sequential)> _
Public Structure RECT
Public Left As Integer
Public Top As Integer
Public Right As Integer
Public Bottom As Integer
End Structure
<DllImport("user32.dll")> _
Public Shared Function GetWindowRect(hWnd As IntPtr, ByRef lpRect As RECT) As <MarshalAs(UnmanagedType.Bool)> Boolean
End Function
<DllImport("user32.dll")> _
Public Shared Function SetWindowPos(hWnd As IntPtr, hWndInsertAfter As IntPtr, X As Integer, Y As Integer, cx As Integer, cy As Integer, _
uFlags As UInteger) As Boolean
End Function
Public Shared ReadOnly HWND_TOPMOST As New IntPtr(-1)
Public Shared ReadOnly HWND_NOTOPMOST As New IntPtr(-2)
Public Shared ReadOnly HWND_TOP As New IntPtr(0)
Public Shared ReadOnly HWND_BOTTOM As New IntPtr(1)
Public Const SWP_NOSIZE As UInt32 = &H1
Public Const SWP_NOMOVE As UInt32 = &H2
Public Const SWP_NOZORDER As UInt32 = &H4
Public Const SWP_NOREDRAW As UInt32 = &H8
Public Const SWP_NOACTIVATE As UInt32 = &H10
Public Const SWP_FRAMECHANGED As UInt32 = &H20
' The frame changed: send WM_NCCALCSIZE
Public Const SWP_SHOWWINDOW As UInt32 = &H40
Public Const SWP_HIDEWINDOW As UInt32 = &H80
Public Const SWP_NOCOPYBITS As UInt32 = &H100
Public Const SWP_NOOWNERZORDER As UInt32 = &H200
' Dont do owner Z ordering
Public Const SWP_NOSENDCHANGING As UInt32 = &H400
' Dont send WM_WINDOWPOSCHANGING
Public Const TOPMOST_FLAGS As UInt32 = SWP_NOACTIVATE Or SWP_NOOWNERZORDER Or SWP_NOSIZE Or SWP_NOMOVE Or SWP_NOREDRAW Or SWP_NOSENDCHANGING
End Class
#End Region
End Module