コード例 #1
0
ファイル: NPCChatDialogComboBox.cs プロジェクト: wtfcolt/game
        /// <summary>
        /// Raises the <see cref="E:System.Windows.Forms.ComboBox.DrawItem"/> event.
        /// </summary>
        /// <param name="e">A <see cref="T:System.Windows.Forms.DrawItemEventArgs"/> that contains the event data. </param>
        protected override void OnDrawItem(DrawItemEventArgs e)
        {
            // Get the dialog to draw
            NPCChatDialogBase dialog = null;

            if (e.Index >= 0 && e.Index < Items.Count)
            {
                dialog = Items[e.Index] as NPCChatDialogBase;
            }

            // If invalid, use the default drawing
            if (dialog == null)
            {
                base.OnDrawItem(e);
                return;
            }

            e.DrawBackground();
            e.Graphics.DrawString(string.Format("{0}: {1}", dialog.ID, dialog.Title), e.Font, new SolidBrush(e.ForeColor),
                                  e.Bounds);
            e.DrawFocusRectangle();

            // TODO: Fix the display for the selected item; do not let the text be edited
        }
コード例 #2
0
ファイル: NPCChatDialogForm.cs プロジェクト: wtfcolt/game
 public void EndDialog()
 {
     IsVisible = false;
     _dialog = null;
 }
コード例 #3
0
ファイル: NPCChatDialogForm.cs プロジェクト: wtfcolt/game
        public void StartDialog(NPCChatDialogBase dialog)
        {
            if (dialog == null)
            {
                Debug.Fail("Dialog is null.");
                return;
            }

            _dialog = dialog;
            SetFocus();
        }