|
■No75494 (魔界の仮面弁士) に追記 >>VB6 同様、固定ピッチフォントにした上で > プロポーショナルフォントで右寄せしたいなら、 > ListView で代用するという手もあります。
さらに別案。
Public Class Form1 Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load '.Items.Add でも .DataSource でも OK ListBox1.DataSource = Enumerable.Range(1, 100).ToArray() End Sub
Private Sub Form1_Shown(sender As Object, e As EventArgs) Handles Me.Shown SetRightAligh(ListBox1) End Sub
Private Declare Auto Function GetWindowLong Lib "user32" _ (ByVal hwnd As IntPtr, ByVal nIndex As Integer) As Integer Private Declare Auto Function SetWindowLong Lib "user32" _ (ByVal hwnd As IntPtr, ByVal nIndex As Integer, ByVal dwNewLong As Integer) As Integer
Friend Sub SetRightAligh(ByVal lst As ListBox) Const GWL_EXSTYLE As Integer = -20 Const WS_EX_RTLREADING As Integer = &H2000 Const WS_EX_RIGHT As Integer = &H1000 Dim style As Integer = GetWindowLong(lst.Handle, GWL_EXSTYLE) style = style Or WS_EX_RIGHT Or WS_EX_RTLREADING SetWindowLong(lst.Handle, GWL_EXSTYLE, style) End Sub End Class
|