- 分享
- 0
- 人气
- 0
- 主题
- 62
- 帖子
- 6367
- UID
- 51295
- 积分
- 3715
- 阅读权限
- 21
- 注册时间
- 2006-11-21
- 最后登录
- 2022-1-19
- 在线时间
- 3699 小时
|
- Public Class Form1
- Dim mdiClient As MdiClient = Nothing
- Dim SB_BOTH As Integer = 3
- <DllImport("user32.dll")> _
- Private Shared Function ShowScrollBar(ByVal hWnd As IntPtr, ByVal wBar As Integer, ByVal bShow As Integer) As Integer
- End Function
- Protected Overrides Sub WndProc(ByRef m As Message)
- If mdiClient IsNot Nothing Then
- ShowScrollBar(mdiClient.Handle, SB_BOTH, 0)
- End If
- MyBase.WndProc(m)
- End Sub
- Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
- For Each c As Control In Me.Controls
- If TypeOf c Is MdiClient Then
- mdiClient = c
- End If
- Next
- Dim fm As Form = New Form2
- fm.MdiParent = Me
- fm.Show()
- End Sub
- End Class
复制代码
- <DllImport("user32.dll")> _
- Private Shared Function ShowScrollBar(ByVal hWnd As IntPtr, ByVal wBar As Integer, ByVal bShow As Integer) As Integer
- End Function
- Protected Overrides Sub WndProc(ByRef m As Message)
- If mdiClient IsNot Nothing Then
- ShowScrollBar(mdiClient.Handle, SB_BOTH, 0)
- End If
- MyBase.WndProc(m)
复制代码
- private const int SB_BOTH = 3;
-
- private const int WM_NCCALCSIZE = 0x83;
-
- [System.Runtime.InteropServices.DllImport("user32.dll")]
-
- private static extern int ShowScrollBar(IntPtr hWnd, int wBar, int bShow);
-
- protected override void WndProc(ref Message m)
- {
-
- if (mdiClient != null)
- {
-
- ShowScrollBar(mdiClient.Handle, SB_BOTH, 0);
- }
-
- base.WndProc(ref m);
- }
-
- MdiClient mdiClient = null;
-
- private void FormMain_Load(object sender, EventArgs e)
- {
- foreach (Control c in this.Controls)
- {
- if (c is MdiClient)
- {
- mdiClient = c as MdiClient;
- }
- }
- }
复制代码 |
|