첨부 실행 코드는 나눔고딕코딩 폰트를 사용합니다.
본 블로그는 광고를 포함하고 있습니다.
광고 클릭에서 발생하는 수익금은 모두 블로그 콘텐츠 향상을 위해 쓰여집니다.

728x90
반응형
728x170

TestProject.zip
다운로드

▶ MainForm.cs

using System.Drawing;
using System.Windows.Forms;

using DevExpress.XtraBars;
using DevExpress.XtraBars.Ribbon;

namespace TestProject
{
    /// <summary>
    /// 메인 폼
    /// </summary>
    public partial class MainForm : Form
    {
        //////////////////////////////////////////////////////////////////////////////////////////////////// Constructor
        ////////////////////////////////////////////////////////////////////////////////////////// Public

        #region 생성자 - MainForm()

        /// <summary>
        /// 생성자
        /// </summary>
        public MainForm()
        {
            InitializeComponent();

            this.showBarButtonItem.ItemClick += showBarButtonItem_ItemClick;
        }

        #endregion

        //////////////////////////////////////////////////////////////////////////////////////////////////// Method
        ////////////////////////////////////////////////////////////////////////////////////////// Private
        //////////////////////////////////////////////////////////////////////////////// Event

        #region Show 바 버튼 항목 항목 클릭시 처리하기 - showBarButtonItem_ItemClick(sender, e)

        /// <summary>
        /// Show 바 버튼 항목 항목 클릭시 처리하기
        /// </summary>
        /// <param name="sender">이벤트 발생자</param>
        /// <param name="e">이벤트 인자</param>
        private void showBarButtonItem_ItemClick(object sender, ItemClickEventArgs e)
        {
            RadialMenu radialMenu = new RadialMenu();

            radialMenu.Manager = this.barManager;

            radialMenu.AddItems(CreateBarItemArray());

            Point point = this.Location;

            point.Offset(this.Width / 2, this.Height / 2);

            radialMenu.ShowPopup(point);
        }

        #endregion

        //////////////////////////////////////////////////////////////////////////////// Function

        #region 바 항목 배열 생성하기 - CreateBarItemArray()

        /// <summary>
        /// 바 항목 배열 생성하기
        /// </summary>
        /// <returns>바 항목 배열</returns>
        private BarItem[] CreateBarItemArray()
        {
            this.barManager.Images = this.imageCollection;

            BarItem      copyBarButtonItem     = new BarButtonItem(this.barManager, "Copy"  , 0);
            BarItem      cutBarButtonItem      = new BarButtonItem(this.barManager, "Cut"   , 1);
            BarItem      deleteBarButtonItem   = new BarButtonItem(this.barManager, "Delete", 2);
            BarItem      pasteBarButtonItem    = new BarButtonItem(this.barManager, "Paste" , 3);
            BarSubItem   formatBarSubItem      = new BarSubItem   (this.barManager, "Format"   );
            BarCheckItem boldBarCheckItem      = new BarCheckItem (this.barManager, false) { ImageIndex = 4, Caption = "Bold"      };
            BarCheckItem italicBarCheckItem    = new BarCheckItem (this.barManager, true ) { ImageIndex = 5, Caption = "Italic"    };
            BarCheckItem underlineBarCheckItem = new BarCheckItem (this.barManager, false) { ImageIndex = 6, Caption = "Underline" };

            BarItem[] barItemArray = new BarItem[] { boldBarCheckItem, italicBarCheckItem, underlineBarCheckItem };

            formatBarSubItem.AddItems(barItemArray);

            BarItem findBarButtonItem = new BarButtonItem(this.barManager, "Find", 7);
            BarItem undoBarButtonItem = new BarButtonItem(this.barManager, "Undo", 8);
            BarItem redoBarButtonItem = new BarButtonItem(this.barManager, "Redo", 9);

            return new BarItem[]
            {
                copyBarButtonItem,
                cutBarButtonItem,
                deleteBarButtonItem,
                pasteBarButtonItem, 
                formatBarSubItem,
                findBarButtonItem,
                undoBarButtonItem,
                redoBarButtonItem
            };
        }

        #endregion
    }
}
728x90
반응형
그리드형
Posted by 사용자 icodebroker

댓글을 달아 주세요