using System;
using System.ComponentModel;
using System.Drawing;
namespace Microsoft.Windows.Forms
{
partial class UIForm
{
///
/// 获取或设置父控件
///
[Browsable(false), DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
public IUIControl UIParent
{
get
{
return null;
}
set
{
throw new NotSupportedException("不允许为 UIWindow 设置 Parent");
}
}
private UIControl.UIControlCollection m_UIControls;
///
/// 获取子控件集合
///
[Browsable(false), DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
public UIControl.UIControlCollection UIControls
{
get
{
this.CheckDisposed();
if (this.m_UIControls == null)
this.m_UIControls = new UIControl.UIControlCollection(this);
return this.m_UIControls;
}
}
private int m_LayoutSuspendCount;
///
/// 获取布局操作是否被挂起
///
public bool LayoutSuspended
{
get
{
return this.m_LayoutSuspendCount != 0;
}
}
///
/// 挂起布局操作
///
public new void SuspendLayout()
{
this.m_LayoutSuspendCount++;
base.SuspendLayout();
}
///
/// 恢复挂起的布局操作
///
public new void ResumeLayout()
{
this.ResumeLayout(false);
}
///
/// 恢复挂起的布局操作,可选择是否强制执行布局
///
/// 如果强制则为 true, 否则为 false
public new void ResumeLayout(bool performLayout)
{
this.m_LayoutSuspendCount--;
this.DoLayoutCore(performLayout);
base.ResumeLayout(performLayout);
}
///
/// 如果未挂起布局操作则重新计算子控件布局
///
public void DoLayout()
{
this.DoLayoutCore(false);
}
///
/// 重新计算子控件布局,可选择是否强制执行布局
///
/// 如果强制则为 true, 否则为 false
protected void DoLayoutCore(bool performLayout)
{
if (performLayout || !this.LayoutSuspended)
UIControl.DoLayoutInternal(this);
}
///
/// 将所在 Win32 控件坐标系的点转换为控件坐标系的点
///
/// 点
/// 转换后的点
public Point PointToUIControl(Point p)
{
return p;
}
///
/// 将控件坐标系的点转换为所在 Win32 控件坐标系的点
///
/// 点
/// 转换后的点
public Point PointToUIWindow(Point p)
{
return p;
}
///
/// 将所在 Win32 控件坐标系的矩形转换为控件坐标系的矩形
///
/// 矩形
/// 转换后的矩形
public Rectangle RectangleToUIControl(Rectangle r)
{
return r;
}
///
/// 将控件坐标系的矩形转换为所在 Win32 控件坐标系的矩形
///
/// 矩形
/// 转换后的矩形
public Rectangle RectangleToUIWindow(Rectangle r)
{
return r;
}
///
/// 查找所在的 Win32 控件
///
/// 所在的 Win32 控件
public IUIWindow FindUIWindow()
{
return this;
}
///
/// 根据坐标查找子控件
///
/// 坐标
/// 子控件
public UIControl FindUIChild(Point p)
{
return UIControl.FindUIChildInternal(this, p);
}
///
/// 根据名称查找子控件
///
/// 名称
/// 子控件
public UIControl FindUIChild(string name)
{
return UIControl.FindUIChildInternal(this, name);
}
///
/// 大小改变,重新计算布局
///
/// 计算布局
protected override void OnSizeChanged(EventArgs e)
{
base.OnSizeChanged(e);
this.DoLayout();
}
}
}