Hi CK,
你的第二个问题解决办法是设置StatusStrip的RightToLeft属性为YES就可以了。
Me.StatusStrip1.RightToLeft = System.Windows.Forms.RightToLeft.Yes
你的第一个问题解决办法需要用api 引用了,自己传消息给操作系统。
我找了找,下面的代码可以实现图标视图, 但还是做不到大图标视图。
Imports System.Runtime.InteropServices
Imports System.Text
Public Class Form1
' All Folder View styles
Private Const LV_VIEW_ICON As Integer = &H0
Private Const LV_VIEW_DETAILS As Integer = &H1
Private Const LV_VIEW_SMALLICON As Integer = &H2
Private Const LV_VIEW_LIST As Integer = &H3
Private Const LV_VIEW_TILE As Integer = &H4
Private Const EM_HIDEBALLOONTIP As Integer = &H1504
Private Const LVM_SETVIEW As Integer = &H108E
Private Const ListViewClassName As String = "SysListView32"
Private Shared ReadOnly NullHandleRef As HandleRef = New HandleRef(Nothing, IntPtr.Zero)
<DllImport("user32.dll", ExactSpelling:=True)> _
Private Shared Function EnumChildWindows(ByVal hwndParent As HandleRef, ByVal lpEnumFunc As EnumChildrenCallback, ByVal lParam As HandleRef) As Boolean
End Function
<DllImport("user32.dll", CharSet:=CharSet.Auto)> _
Private Shared Function SendMessage(ByVal hWnd As HandleRef, ByVal Msg As UInteger, ByVal wParam As Integer, ByVal lParam As Integer) As Integer
End Function
<DllImport("user32.dll", CharSet:=CharSet.Auto)> _
Private Shared Function RealGetWindowClass(ByVal hwnd As IntPtr, <Out()> ByVal pszType As StringBuilder, ByVal cchType As UInteger) As UInteger
End Function
Private Delegate Function EnumChildrenCallback(ByVal hwnd As IntPtr, ByVal lParam As IntPtr) As Boolean
Private listViewHandle As HandleRef
Private Sub FindListViewHandle()
Me.listViewHandle = NullHandleRef
Dim lpEnumFunc As EnumChildrenCallback = New EnumChildrenCallback(AddressOf EnumChildren)
EnumChildWindows(New HandleRef(Me.WebBrowser1, Me.WebBrowser1.Handle), lpEnumFunc, NullHandleRef)
End Sub
Private Function EnumChildren(ByVal hwnd As IntPtr, ByVal lparam As IntPtr) As Boolean
Dim sb As StringBuilder = New StringBuilder(100)
RealGetWindowClass(hwnd, sb, 100)
If sb.ToString() = ListViewClassName Then
Me.listViewHandle = New HandleRef(Nothing, hwnd)
End If
Return True
End Function
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
WebBrowser1.Navigate("C:\") ' WebBrowser1 is used as File Explorer.
FindListViewHandle()
SendMessage(Me.listViewHandle, LVM_SETVIEW, LV_VIEW_ICON, 0)
End Sub
End Class
下面连接是代码的参考出处
http://social.msdn.microsoft.com/forums/en-US/vblanguage/thread/3bdeef02-7df8-4803-93ca-d0163cc07a32/
做不到大图标视图原因是没有LV_VIEW_LARGEICON这个参数,根据LVM_SETVIEW Message(
http://msdn.microsoft.com/en-us/library/bb761220(v=VS.85).aspx)里面的说明,
只有以上代码中的一系列可用参数,没有LV_VIEW_LARGEICON这个参数的数值。
也许MVP 和 MSFT 能补充以下。