Mini Kabibi Habibi

Current Path : C:/Users/Public/Documents/DXperience 13.1 Demos/WinForms/CS/BarTutorials/AddNewBar/
Upload File :
Current File : C:/Users/Public/Documents/DXperience 13.1 Demos/WinForms/CS/BarTutorials/AddNewBar/AddNewBar.cs

using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;

namespace DevExpress.XtraBars.Demos.Tutorials {
	/// <summary>
	/// Summary description for AddNewBar.
	/// </summary>
	public partial class AddNewBar : TutorialControl {
		public AddNewBar() {
			//
			// Required for Windows Form Designer support
			//
			InitializeComponent();

			//
			// TODO: Add any constructor code after InitializeComponent call
			//
		}

        //<button1>
		private void button1_Click(object sender, System.EventArgs e) {
			DevExpress.XtraBars.Bar bar = new DevExpress.XtraBars.Bar(barManager1);
			bar.DockStyle = DevExpress.XtraBars.BarDockStyle.Top;
			bar.Visible = true;
			Description(bar.Text + " Added");
		}
        //</button1>

        //<button2>
		private void button2_Click(object sender, System.EventArgs e) {
			string s = "";
			int lastBarIndex = barManager1.Bars.Count - 1;
			if(lastBarIndex >= 0) {
				DevExpress.XtraBars.Bar bar = (DevExpress.XtraBars.Bar)barManager1.Bars[lastBarIndex];
				s = "Bar Deleted: " + bar.BarName;
				bar.Dispose();
			}
			Description(s);
		}
        //</button2>

        //<button1>
		private void Description(string s) {
			label1.Text = (s == null) ? "" : s;
		}
        //</button1>
	}
}