コード例 #1
0
ファイル: DiscussionBox.cs プロジェクト: GrimMaple/mrHelper
        private Control createTextBox(DiscussionNote note, bool discussionResolved)
        {
            TextBox textBox = new TextBoxNoWheel();

            _toolTip.SetToolTip(textBox, getNoteTooltipText(note));
            textBox.ReadOnly    = true;
            textBox.Text        = note.Body.Replace("\n", "\r\n");
            textBox.Multiline   = true;
            textBox.Height      = getTextBoxPreferredHeight(textBox);
            textBox.BackColor   = getNoteColor(note);
            textBox.LostFocus  += TextBox_LostFocus;
            textBox.KeyDown    += TextBox_KeyDown;
            textBox.KeyUp      += TextBox_KeyUp;
            textBox.MinimumSize = new Size(300, 0);
            textBox.Tag         = note;
            textBox.ContextMenu = createContextMenuForDiscussionNote(note, discussionResolved, textBox);

            return(textBox);
        }
コード例 #2
0
ファイル: DiscussionBox.cs プロジェクト: GrimMaple/mrHelper
        // Create a label that shows filename
        private Control createLabelFilename(DiscussionNote firstNote)
        {
            if (firstNote.Type != "DiffNote")
            {
                return(null);
            }

            string oldPath = firstNote.Position.Old_Path + " (line " + firstNote.Position.Old_Line + ")";
            string newPath = firstNote.Position.New_Path + " (line " + firstNote.Position.New_Line + ")";

            string result;

            if (firstNote.Position.Old_Line == null)
            {
                result = newPath;
            }
            else if (firstNote.Position.New_Line == null)
            {
                result = oldPath;
            }
            else if (firstNote.Position.Old_Path == firstNote.Position.New_Path)
            {
                result = newPath;
            }
            else
            {
                result = newPath + "\r\n(was " + oldPath + ")";
            }

            TextBox labelFilename = new TextBoxNoWheel
            {
                ReadOnly    = true,
                Text        = result,
                Multiline   = true,
                MinimumSize = new Size(300, 0)
            };

            labelFilename.Height = getTextBoxPreferredHeight(labelFilename);
            return(labelFilename);
        }