This wasn't intended but eventually becomes a followup on "Where is the caret?"
There are two directions to select some text in a rich edit: from left to right, or from right to left. The initial position of a selection is called an anchor point, and the ending position is called an active end. These are the names given in the EM_SETSEL documentation. The four other related messages and notification are: EM_GETSEL, EM_EXSETSEL, EM_EXSETSEL, and EN_SELCHANGE.
Since the caret marks the active position, to reshow or do something interesting with the caret, I need to know where the anchor and active positions are, given a selection range. As it turns out, all of above messages or notification (except EM_SETSEL) assume the start/min being anchor, and end/max being active.
Quite surprisingly, TOM can provide this information, through ITextDocument:GetSelection and ITextSelection:GetFlags (tomSelStartActive). I said surprising because TOM looks more like wrapper interfaces around Word and rich edit controls, but hey, what do I know?
Wednesday, September 15, 2010
Friday, February 5, 2010
What is RelatedImageListAttribute?
One use of RelatedImageListAttribute is to tell ImageIndexEditor where to get the images.
Imagine a class called ClassA with a property called ImageKey, and another property called PropertyB, which is a structure with an ImageList property.
Then, this is how ImageKey should be described:
Imagine a class called ClassA with a property called ImageKey, and another property called PropertyB, which is a structure with an ImageList property.
Then, this is how ImageKey should be described:
[Editor("System.Windows.Forms.Design.ImageIndexEditor, System.Design, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a", typeof(UITypeEditor))] [RefreshProperties(RefreshProperties.Repaint)] [RelatedImageList("PropertyB.ImageList")] [TypeConverterAttribute(typeof(ImageKeyConverter))] public string ImageKey { set; get; }
Subscribe to:
Posts (Atom)