Ejemplo n.º 1
0
		private void RenameBar(object sender, System.EventArgs e)
		{
			if(lstBars.SelectedIndex<0)
				return;
			Bar bar=lstBars.SelectedItem as Bar;
			if(bar==null)
				return;
            ToolbarName tn=new ToolbarName();
			tn.RenameDialog=true;
			tn.txtName.Text=bar.Text;
			tn.StartPosition=FormStartPosition.CenterParent;
			if(tn.ShowDialog(this)==DialogResult.OK)
			{
				bar.Text=tn.txtName.Text;
				lstBars.Refresh();
				((IOwner)m_DotNetBar).InvokeUserCustomize(bar,new EventArgs());
				((IOwner)m_DotNetBar).InvokeEndUserCustomize(bar,new EndUserCustomizeEventArgs(eEndUserCustomizeAction.BarRenamed));
			}
			tn.Close();
			tn.Dispose();
		}
Ejemplo n.º 2
0
		private void NewBar(object sender, System.EventArgs e)
		{
			ToolbarName nt=new ToolbarName();
			nt.txtName.Text="Custom Bar";
			using(LocalizationManager lm=new LocalizationManager(m_DotNetBar))
			{
				nt.txtName.Text=lm.GetLocalizedString("sys_custombar");
			}

			nt.StartPosition=FormStartPosition.CenterParent;

			if(nt.ShowDialog(this)==DialogResult.OK)
			{
				Bar bar=new Bar(nt.txtName.Text);
				bar.CustomBar=true;
				bar.CanHide=true;
				bar.SetDesignMode(true);
				bar.GrabHandleStyle=eGrabHandleStyle.StripeFlat;

				string name="userBar";
				int i=0;
				while(m_DotNetBar.Bars.Contains(name+i.ToString()))
					i++;
				bar.Name=name+i.ToString();

				m_DotNetBar.Bars.Add(bar);
				bar.DockSide=eDockSide.None;
				lstBars.Items.Add(bar,CheckState.Checked);
				if(m_DotNetBar.AllowUserBarCustomize)
					bar.Items.Add(new CustomizeItem());
				((IOwner)m_DotNetBar).InvokeUserCustomize(bar,new EventArgs());
				((IOwner)m_DotNetBar).InvokeEndUserCustomize(bar,new EndUserCustomizeEventArgs(eEndUserCustomizeAction.NewBarCreated));
			}
			nt.Close();
			nt.Dispose();
		}