Search Results

Search found 4 results on 1 pages for 'ownerdraw'.

Page 1/1 | 1 

  • .NET OwnerDraw ComboBox: Vista/7 themed DropDownList

    - by Stijn
    I'm working on a custom ComboBox for a project, and have the basic painting working. One of the remaining things to do is make it look like the default ComboBox in Vista and 7, when the DropDownStyle is set to DropDownList (looks like a button instead of a regular ComboBox). I read much about VisualStyleRenderer, read ComboBox.cs and ComboBoxRenderer.cs, and tried to get it working. It works in the sense of, it does something. It just doesn't do what it's supposed to do. I also found an article about Vista themed Owner-Drawn Buttons, but it is in C++ (which would be a challenge on its own for me) and it seems like an awful lot of code. If anyone could supply either VB or C# code, that would be great. Below is my current code. Public Sub New() DrawMode = Windows.Forms.DrawMode.OwnerDrawFixed ItemHeight *= 2 DropDownStyle = ComboBoxStyle.DropDownList End Sub Protected Overrides Sub OnDrawItem(ByVal e As System.Windows.Forms.DrawItemEventArgs) If e.Index = -1 Then Return End If If Not (e.State = DrawItemState.Selected) Then e.DrawBackground() End If Dim brsh As Brush If (e.State And DrawItemState.Focus) = DrawItemState.Focus And (e.State And DrawItemState.Selected) = DrawItemState.Selected Then brsh = SystemBrushes.HighlightText Else brsh = SystemBrushes.ControlText End If e.DrawFocusRectangle() e.Graphics.DrawString(Items(e.Index), e.Font, brsh, e.Bounds) End Sub

    Read the article

  • C# .NET Why does my inherited listview keep drawing in LargeIcon View ?? Because Microsoft is Evil!!

    - by Bugz R us
    I have a inherited Listview which standard has to be in Tile Mode. When using this control, the DrawItem gives e.bounds which are clearly bounds of largeIcon view ?? When debugging to check the view it is actually set to, it says it's in Tile view ?? Yet e.DrawText draws LargeIcon view ?? ......... Edit: ................. This seems only to happen when the control is placed upon another usercontrol? ......... Edit 2: ................. It gets stranger ... When i add buttons next to the list to change the view at runtime, "Tile" is the same as "LargeIcon", and "List" view is the same as "SmallIcons" ??? I've also completely removed the ownerdraw ... .......... Edit 3: ................. MSDN Documentation: Tile view Each item appears as a full-sized icon with the item label and subitem information to the right of it. The subitem information that appears is specified by the application. This view is available only on Windows XP and the Windows Server 2003 family. On earlier operating systems, this value is ignored and the ListView control displays in the LargeIcon view. Well I am on XP ya damn liars ?!? Apparently if the control is within a usercontrol, this value is ignored too ... pff I'm getting enough of this Microsoft crap .... you just keep on hitting bugs ... another day down the drain ... public class InheritedListView : ListView { //Hiding members ... mwuahahahahaha //yeah i was still laughing then [BrowsableAttribute(false)] public new View View { get { return base.View; } } public InheritedListView() { base.View = View.Tile; this.OwnerDraw = true; base.DrawItem += new DrawListViewItemEventHandler(DualLineGrid_DrawItem); } void DualLineGrid_DrawItem(object sender, DrawListViewItemEventArgs e) { View v = this.View; //**when debugging, v is Tile, however e.DrawText() draws in LargeIcon mode, // e.Bounds also reflects LargeIcon mode ???? ** }

    Read the article

  • Syntax Highlighting in a ListBox

    - by ph0enix
    Hi all, I've searched the web and I can't seem to find anything that will work for me. I've seen plenty of discussion, and even some fairly extensible open-source tools, for code editors that provide line numbers and syntax highlighting. Here's my dilemma... I'm working on a "digital code review" project in C#.NET that allows users to specify source files, add them to a particular session, and other users can make comments and line references to the files being reviewed. Basic requirements: Must be written in C#.NET I don't need to be able to edit the text in the text box Users need to be able to select a line (or multiple lines), to make line references. It seems to me that I need some fancy implementation of a ListBox control (not a drop-down list) that has some OwnerDraw capabilities to add line numbers and syntax highlighting. Unfortunately, I haven't had any luck putting it together myself, and I can't seem to find a control that's already been written or a reference on how I might be able to accomplish this. Any suggestions??

    Read the article

1