發表文章

目前顯示的是 8月, 2024的文章

Using IFormattable to make your output more convenient

圖片
Module Module1     Sub Main()         Dim Microsoft_example_about_Account_Number As New Account_Number(34567)         Dim Microsoft_example_about_Tempture As New Temperature(333)         Dim formatProvider() As FormatProvider_class = {                     New FormatProvider_class(New Globalization.CultureInfo("de-DE")),                     New FormatProvider_class(New Globalization.CultureInfo("fr-FR"))                 }         Dim fmt = "{0:H}" & vbNewLine &                   "{1:E}" & vbNewLine &                   "{2:G}" & vbNewLine &                   "{3:G}" & vbNewLine &     ...

Windows Forms with High DPI

圖片
  Public Class Form1     Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load         Tracer("Form1_Load")         StartTo_Write_Into_TextBox1 = True         AddHandler Application.Idle, AddressOf Application_Idle     End Sub     Public Sub New()         Application.EnableVisualStyles()         Tracer($"=========== New in ================")         ' 設計工具需要此呼叫。         InitializeComponent()         ' 在 InitializeComponent() 呼叫之後加入所有初始設定。         Me.TextBox1 = New System.Windows.Forms.TextBox()         Me.TextBox1.SuspendLayout()         Me.SuspendLayout()         Me.TextBox1.BackColor = System.Drawing.Color.LightSteelBlue         Me.TextBox1.ForeColor = System.Drawing.Color...

Executable requested execution levels on Windows

圖片
  Imports System.Runtime.InteropServices Imports System.Security.Principal Imports System.Threading Module Module1     Sub Main()         If Not IsWindowsVersionOrGreater(10, 0, 0) Then             Console.WriteLine("Your PC must at least be Windows 10")             Console.ReadKey()             Process.Start("rundll32.exe", "shell32.dll,ShellAbout")             Return         End If         Dim ptr_ModuleFileName As IntPtr = Marshal.AllocHGlobal(4096)         GetModuleFileName(Nothing, ptr_ModuleFileName, 2000)         Dim ModuleFileName As String = Marshal.PtrToStringUni(ptr_ModuleFileName)         Thread.GetDomain().SetPrincipalPolicy(PrincipalPolicy.WindowsPrincipal)         Dim UserName As String = Thread.Curren...