첨부 실행 코드는 나눔고딕코딩 폰트를 사용합니다.
유용한 소스 코드가 있으면 icodebroker@naver.com으로 보내주시면 감사합니다.
블로그 자료는 자유롭게 사용하세요.

■ BarManager 클래스 : 바 항목 추가하기

------------------------------------------------------------------------------------------------------------------------


TestProject.zip


MainForm.cs

 

 

using System.Drawing;

 

using DevExpress.XtraBars;

using DevExpress.XtraEditors;

using DevExpress.XtraEditors.Controls;

using DevExpress.XtraEditors.Repository;

 

namespace TestProject

{

    /// <summary>

    /// 메인 폼

    /// </summary>

    public partial class MainForm : XtraForm

    {

        //////////////////////////////////////////////////////////////////////////////////////////////////// Constructor

        ////////////////////////////////////////////////////////////////////////////////////////// Public

 

        #region 생성자 - MainForm()

 

        /// <summary>

        /// 생성자

        /// </summary>

        public MainForm()

        {

            InitializeComponent();

 

            this.barManager.BeginUpdate();

 

            BarSubItem fileItem = new BarSubItem(this.barManager, "&File");

 

            BarButtonItem newItem  = new BarButtonItem(this.barManager, "New");

 

            newItem.ImageUri.Uri = "New";

 

            BarButtonItem openItem = new BarButtonItem(this.barManager, "Open");

 

            openItem.ImageUri.Uri = "Open";

 

            BarButtonItem closeItem = new BarButtonItem(barManager, "Close");

 

            closeItem.ImageUri.Uri = "Close";

 

            fileItem.AddItems(new BarItem[] { newItem, openItem, closeItem });

 

            barManager.MainMenu.AddItem(fileItem);

 

            barManager.EndUpdate();

 

            BarStaticItem positionItem = new BarStaticItem()

            {

                Caption       = "행 : 0,  열 : 0",

                Alignment     = BarItemLinkAlignment.Left,

                AutoSize      = BarStaticItemSize.Content,

                TextAlignment = StringAlignment.Center

            };

 

            BarStaticItem readyItem = new BarStaticItem()

            {

                Caption       = "Ready",

                Alignment     = BarItemLinkAlignment.Right,

                Width         = 80,

                AutoSize      = BarStaticItemSize.Content,

                TextAlignment = StringAlignment.Far,

                Border        = BorderStyles.NoBorder

            };

 

            BarEditItem zoomItem = new BarEditItem(this.barManager, new RepositoryItemZoomTrackBar())

            {

                EditWidth = 150,

                Alignment = BarItemLinkAlignment.Right

            };

 

            zoomItem.Edit.BorderStyle = BorderStyles.NoBorder;

 

            this.barManager.StatusBar.AddItems(new BarItem[] { positionItem, zoomItem, readyItem });

        }

 

        #endregion

    }

}

 

------------------------------------------------------------------------------------------------------------------------

Posted by 사용자 icodebroker

댓글을 달아 주세요