■ TokenEdit 클래스의 CustomDrawTokenGlyph 이벤트를 사용해 토큰 글리프 커스텀을 그리는 방법을 보여준다.
▶ MainForm.cs
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 |
using DevExpress.Images; using DevExpress.XtraEditors; namespace TestProject { /// <summary> /// 메인 폼 /// </summary> public partial class MainForm : XtraForm { //////////////////////////////////////////////////////////////////////////////////////////////////// Constructor ////////////////////////////////////////////////////////////////////////////////////////// Public #region 생성자 - MainForm() /// <summary> /// 생성자 /// </summary> public MainForm() { InitializeComponent(); #region 토큰 에디터를 설정한다. this.tokenEdit.Properties.Tokens.AddToken("광주", "C01"); this.tokenEdit.Properties.Tokens.AddToken("대구", "C02"); this.tokenEdit.Properties.Tokens.AddToken("대전", "C03"); this.tokenEdit.Properties.Tokens.AddToken("부산", "C04"); this.tokenEdit.Properties.Tokens.AddToken("서울", "C05"); this.tokenEdit.Properties.Tokens.AddToken("인천", "C06"); #endregion this.tokenEdit.CustomDrawTokenGlyph += tokenEdit_CustomDrawTokenGlyph; } #endregion //////////////////////////////////////////////////////////////////////////////////////////////////// Method ////////////////////////////////////////////////////////////////////////////////////////// Private #region 토큰 에디터 토큰 글리프 커스텀 그리기 - tokenEdit_CustomDrawTokenGlyph(sender, e) /// <summary> /// 토큰 에디터 토큰 글리프 커스텀 그리기 /// </summary> /// <param name="sender">이벤트 발생자</param> /// <param name="e">이벤트 인자</param> private void tokenEdit_CustomDrawTokenGlyph(object sender, TokenEditCustomDrawTokenGlyphEventArgs e) { e.Graphics.DrawImage(ImageResourceCache.Default.GetImage("images/actions/cancel_16x16.png"), e.GlyphBounds); e.Handled = true; } #endregion } } |