Lisong's Blog


十二月 25th, 2008

c# 隐藏父窗体滚动条

Learning, by 木公.

最近在找怎么不让子窗体超过MdiParent范围,但是一直没有找到好的方法。
最后找了个折中的办法,都是禁止那丑陋的滚动条出现的。

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
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;
}
}
}

Back Top

回复自“c# 隐藏父窗体滚动条”

评论 (4) 引用 (0) 发表评论 引用地址
  1. 这个办法在移动子窗体的时候滚动条会一闪一闪的,很恶心,不知大还有没有别的方法

    • 这个API其实就是在父窗体滚动条出现时将其屏蔽掉,每当移动子窗体时,滚动条再次出现,所以会有闪的现象,想要解决,好像有点难

  2. I'm not great with html, but I think there's a simple way to add a byline to the beginning of my blog posts under the title. Is there anywhere I can find a step-by-step guide on how to do this?. The blog is set up on WordPress, and is using the pilcrow theme - I hope this helps?.

  3. For wordpress there is the wphone which works great for simple themes, how about joomla? any way of updating a joomla website via mobile?.

  1. 没有任何引用。

发表评论

电子邮件地址不会被公开。 必填项已用 * 标注

*


无觅相关文章插件,快速提升流量