Archives / 2004 / July
  • VS2005 Color Scheme / XML Doc Comments : Who's Idea Was That?

    This is what XML doc comments look like using my current color scheme in Visual Studio 2003:



    When I took a quick first look into the "Fonts and Colors" options of Visual Studio 2005 I was delighted to see a new setting "XML Doc Attribute", so I was hoping to be able to configure something like this:




    But actually this is what it looks like in Visual Studio 2005 Beta 1 (Express):



    Umm, this is not what I would call an improvement. I can live with the change of the color of the "///"; personally I like the old version better as I think it's less distracting when reading the doc comment, but I'll get used to the new version.


    But what on earth happened to the background color? Visual Studio 2002 and 2003 was perfectly fine. Who came up with the idea to change the behavior behind the last character of the line? Did some customer actually complain about this so it had to be "fixed"? Could somebody please explain the benefits of the new version?

    With the old version, the methods were nicely divided by the doc comments:



    Why would anybody now choose a different background color for a doc comment at all? This is so frustrating. This is one of those issues that has a low priority compared to the other "really important" ones, so it's likely not to be fixed for the final. And the next chance for a fix is years away. That hurts. Sorry guys, you just broke my heart.

    But anyway, I'll give my feedback, maybe there's still a slight chance...

    Update (2004-07-29): My feedback (FDBK12464) has been declared to be a duplicate of FDBK10617 and thus has been "resolved". These two feedbacks describe related, but different issues, so I can only hope that my feedback has been understood correctly.

  • ReadOnlyRichTextBox

    Writing texts for dialog boxes can be a pretty time-consuming task. When using only label controls, the constant tweaking of both wording (resulting in longer or shorter sentences, words wrapping in different ways) and overall text layout will drive you mad sooner or later.

    For my Visual Studio add-in GhostDoc I needed a couple of dialogs like this one:

    As the text between the header and the buttons was very likely to be tweaked over and over again, I decided right from the start to use a RichTextBox control (border removed, background color set to the form's background color) and write the text in Wordpad:

    (I chose RTF over HTML because of the speed and ease of use of the RichTextBox on a Winform dialog).

    To make things look a bit more professional it has to be made sure that the content of the RichTextBox can be neither edited (easy, that's what the ReadOnly property is for) nor selected (just a bit more complicated). I wrote a control derived from RichTextBox called ReadOnlyRichTextBox that does a pretty good job at doing just that; the actual code is pretty simple:

    using System;
    using System.Windows.Forms;
    using System.ComponentModel;
    namespace Weigelt.Windows.Forms
    public class ReadOnlyRichTextBox : RichTextBox
    protected override void OnGotFocus(EventArgs e)
    // no call of base.OnGotFocus(e);
    protected override void OnEnter(EventArgs e)
    // no call of base.OnEnter(e);
    [ DefaultValue(true) ]
    public new bool ReadOnly
    get { return true; }
    set { ; }
    [ DefaultValue(false) ]
    public new bool TabStop
    get { return false; }
    set { ; }
    public ReadOnlyRichTextBox()
    this.SetStyle(ControlStyles.Selectable, false);

    This control drives away any attempt to focus or select it. In order for this to work correctly, the ReadOnlyRichTextBox needs at least one other control on the form (for the SelectNextControl). As this is not actually a huge problem, I didn't spend time on finding an alternative solution.

    You can download the code and a small demo here.

  • One Year of Blogging

    I just can't believe that a whole year has passed. I still remember how I gave the whole blogging thing a long thought; I was a bit afraid of ending as one of those "Hi, I'm X and I'm going to write about Y, so stay tuned" bloggers never to be heard of. Well, at least I managed 1 year.

    Looking back, these were my more popular articles, which generate feedback even now, many months later:

    My "Wouldn't it be cool" articles also seem to be pretty popular.

    Ok, the amount of feedback I get (via comments, or via email) may seem laughable compared to what some of the "big guys of blogging" receive, but it's enough to keep me motivated. And that at least a few people have me on their blog roll makes me feel a tiny little bit proud.

    So... let's see whether I can manage another year ;-)