protected override void OnClick(DesignerRegionMouseEventArgs e)
{
if (e.Region == null)
{
return;
}
string[] parameters = e.Region.Name.Split('_');
if (parameters.Length < 2)
{
return;
}
BorderLayoutRegion region = GetLayoutRegionByName(parameters[0]);
if (region == null)
{
return;
}
BorderLayoutClickAction action =
(BorderLayoutClickAction)Enum.Parse(typeof(BorderLayoutClickAction), parameters[1]);
switch (action)
{
case BorderLayoutClickAction.AddPanel:
this.AddPanel(region);
break;
case BorderLayoutClickAction.AddTabPanel:
this.AddTabPanel(region);
break;
case BorderLayoutClickAction.ClearRegion:
this.ClearRegion(region.Region);
break;
case BorderLayoutClickAction.TurnOffScheme:
TypeDescriptor.GetProperties(this.layout)["SchemeMode"].SetValue(this.layout, false);
//this.Refresh();
break;
case BorderLayoutClickAction.ChangeTab:
int tabId = int.Parse(parameters[2]);
if (region.Items.Count == 0)
{
return;
}
TabPanel tabPanel = region.Items[0] as TabPanel;
if (tabPanel == null)
{
return;
}
if (tabPanel.ActiveTabIndex != tabId)
{
PropertyDescriptor activeTab = TypeDescriptor.GetProperties(tabPanel)["ActiveTabIndex"];
activeTab.SetValue(tabPanel, tabId);
tabPanel.ActiveTabIndex = tabId;
}
break;
case BorderLayoutClickAction.ChangeToPanel:
this.AddPanel(region);
break;
case BorderLayoutClickAction.ChangeToTabPanel:
this.AddTabPanel(region);
break;
case BorderLayoutClickAction.Collapse:
CollapsePanel(region, true);
break;
case BorderLayoutClickAction.Expand:
CollapsePanel(region, false);
break;
default:
throw new ArgumentOutOfRangeException();
}
this.Tag.SetDirty(true);
this.UpdateDesignTimeHtml();
//base.OnClick(e);
}