在MDI表单上删除由于tablelayout pannel导致的凹陷边框 [英] Remove sunken border of due to tablelayout pannel on MDI form

查看:60
本文介绍了在MDI表单上删除由于tablelayout pannel导致的凹陷边框的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

删除由MDL表格上的tablelayout pannel引起的凹陷边框。

解决方案

对于我在其他位置找到的解决方案,$ b $我发布此解决方案: -  
1.在MDI上粘贴以下代码
< pre lang =cs>公共静态类MDIClientSupport
{
[DllImport(& user32.dll& quot;)]
private static extern int GetWindowLong(IntPtr hWnd,int nIndex);
[DllImport(& quot; user32.dll& quot;)]
private static extern int SetWindowLong(IntPtr hWnd,int nIndex,int dwNewLong);
[DllImport(& quot; user32.dll& quot;,ExactSpelling = true)]
private static extern int SetWindowPos(IntPtr hWnd,IntPtr hWndInsertAfter,int X,int Y,int cx,int cy ,uint uFlags);
private const int GWL_EXSTYLE = -20;
private const int WS_EX_CLIENTEDGE = 0x200;
private const uint SWP_NOSIZE = 0x0001;
private const uint SWP_NOMOVE = 0x0002;
private const uint SWP_NOZORDER = 0x0004;
private const uint SWP_NOREDRAW = 0x0008;
private const uint SWP_NOACTIVATE = 0x0010;
private const uint SWP_FRAMECHANGED = 0x0020;
private const uint SWP_SHOWWINDOW = 0x0040;
private const uint SWP_HIDEWINDOW = 0x0080;
private const uint SWP_NOCOPYBITS = 0x0100;
private const uint SWP_NOOWNERZORDER = 0x0200;
private const uint SWP_NOSENDCHANGING = 0x0400;
public static bool SetBevel(此Form表单,bool show)
{
foreach(控制c in form.Controls)
{
MdiClient client = c as MdiClient;
if(client!= null)
{
int windowLong = GetWindowLong(c.Handle,GWL_EXSTYLE);
if(show)
{
windowLong | = WS_EX_CLIENTEDGE;
}
其他
{
windowLong& amp; = ~WS_EX_CLIENTEDGE;
}
SetWindowLong(c.Handle,GWL_EXSTYLE,windowLong);
//更新非客户区域。
SetWindowPos(client.Handle,IntPtr.Zero,0,0,0,0,
SWP_NOACTIVATE | SWP_NOMOVE | SWP_NOSIZE | SWP_NOZORDER |
SWP_NOOWNERZORDER | SWP_FRAMECHANGED);
返回true;
}
}
返回false;
}
}< / pre>
2.使用MDI表单中的代码加密方法
< pre> this.SetBevel(假);< /预>


Remove sunken border of due to tablelayout pannel on MDI form.

解决方案

For this i found solution at another location,
i am posting this solution:-
1. Paste following code on MDI
<pre lang="cs">public static class MDIClientSupport
  {
      [DllImport(&quot;user32.dll&quot;)]
      private static extern int GetWindowLong(IntPtr hWnd, int nIndex);
      [DllImport(&quot;user32.dll&quot;)]
      private static extern int SetWindowLong(IntPtr hWnd, int nIndex, int dwNewLong);
      [DllImport(&quot;user32.dll&quot;, ExactSpelling = true)]
      private static extern int SetWindowPos(IntPtr hWnd, IntPtr hWndInsertAfter, int X, int Y, int cx, int cy, uint uFlags);
      private const int GWL_EXSTYLE = -20;
      private const int WS_EX_CLIENTEDGE = 0x200;
      private const uint SWP_NOSIZE = 0x0001;
      private const uint SWP_NOMOVE = 0x0002;
      private const uint SWP_NOZORDER = 0x0004;
      private const uint SWP_NOREDRAW = 0x0008;
      private const uint SWP_NOACTIVATE = 0x0010;
      private const uint SWP_FRAMECHANGED = 0x0020;
      private const uint SWP_SHOWWINDOW = 0x0040;
      private const uint SWP_HIDEWINDOW = 0x0080;
      private const uint SWP_NOCOPYBITS = 0x0100;
      private const uint SWP_NOOWNERZORDER = 0x0200;
      private const uint SWP_NOSENDCHANGING = 0x0400;
      public static bool SetBevel(this Form form, bool show)
      {
          foreach (Control c in form.Controls)
          {
              MdiClient client = c as MdiClient;
              if (client != null)
              {
                  int windowLong = GetWindowLong(c.Handle, GWL_EXSTYLE);
                  if (show)
                  {
                      windowLong |= WS_EX_CLIENTEDGE;
                  }
                  else
                  {
                      windowLong &amp;= ~WS_EX_CLIENTEDGE;
                  }
                  SetWindowLong(c.Handle, GWL_EXSTYLE, windowLong);
                  // Update the non-client area.
                  SetWindowPos(client.Handle, IntPtr.Zero, 0, 0, 0, 0,
                      SWP_NOACTIVATE | SWP_NOMOVE | SWP_NOSIZE | SWP_NOZORDER |
                      SWP_NOOWNERZORDER | SWP_FRAMECHANGED);
                  return true;
              }
          }
          return false;
      }
  }</pre>
2.paste following code in MDI form load method
<pre>  this.SetBevel(false);</pre>


这篇关于在MDI表单上删除由于tablelayout pannel导致的凹陷边框的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆