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

■ RibbonControl 클래스 : 개념 탭(Contextual Tab) 사용하기

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


TestProject.zip


MainForm.cs

 

 

using System.Drawing;

 

using DevExpress.XtraBars;

using DevExpress.XtraBars.Ribbon;

 

namespace TestProject

{

    /// <summary>

    /// 메인 폼

    /// </summary>

    public partial class MainForm : RibbonForm

    {

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

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

 

        #region 생성자 - MainForm()

 

        /// <summary>

        /// 생성자

        /// </summary>

        public MainForm()

        {

            InitializeComponent();

 

            this.ribbonControl.Images = this.imageCollection;

 

            RibbonPage homeRibbonPage = new RibbonPage("Home");

 

            this.ribbonControl.Pages.Add(homeRibbonPage);

 

            RibbonPageCategory selectionRibbonPageCategory = new RibbonPageCategory("Selection", Color.LightPink, false);

 

            this.ribbonControl.PageCategories.Add(selectionRibbonPageCategory);

 

            RibbonPage formatRibbonPage    = new RibbonPage("Format"   );

            RibbonPage clipboardRibbonPage = new RibbonPage("Clipboard");

 

            selectionRibbonPageCategory.Pages.AddRange

            (

                new RibbonPage[]

                {

                    formatRibbonPage,

                    clipboardRibbonPage

                }

            );

 

            RibbonPageGroup formatRibbonPageGroup = new RibbonPageGroup("Format");

 

            formatRibbonPageGroup.AllowTextClipping = false;

 

            BarButtonItem copyBarButtonItem = new BarButtonItem(ribbonControl.Manager, "Copy", 0);

            BarButtonItem cutBarButtonItem  = new BarButtonItem(ribbonControl.Manager, "Cut" , 1);

 

            formatRibbonPageGroup.ItemLinks.AddRange

            (

                new BarItem[]

                {

                    copyBarButtonItem,

                    cutBarButtonItem

                }

            );

 

            formatRibbonPage.Groups.Add(formatRibbonPageGroup);

 

            this.ribbonControl.ItemClick += ribbonControl_ItemClick;

 

            selectionRibbonPageCategory.Visible = true;

 

            this.ribbonControl.SelectedPage = selectionRibbonPageCategory.Pages[0];

        }

 

        #endregion

 

        //////////////////////////////////////////////////////////////////////////////////////////////////// Method

        ////////////////////////////////////////////////////////////////////////////////////////// Private

 

        #region 리본 컨트롤 항목 클릭시 처리하기 - ribbonControl_ItemClick(sender, e)

 

        /// <summary>

        /// 리본 컨트롤 항목 클릭시 처리하기

        /// </summary>

        /// <param name="sender">이벤트 발생자</param>

        /// <param name="e">이벤트 인자</param>

        private void ribbonControl_ItemClick(object sender, ItemClickEventArgs e)

        {

        }

 

        #endregion

    }

}

 

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

Posted by 사용자 icodebroker

댓글을 달아 주세요