Click here to Skip to main content
15,888,610 members
Home / Discussions / C#
   

C#

 
AnswerRe: Constructing a Generic Class from several similar classes Pin
Pete O'Hanlon29-Sep-11 23:50
mvePete O'Hanlon29-Sep-11 23:50 
GeneralRe: Constructing a Generic Class from several similar classes Pin
Wayne Gaylard30-Sep-11 1:10
professionalWayne Gaylard30-Sep-11 1:10 
AnswerRe: Constructing a Generic Class from several similar classes Pin
lukeer30-Sep-11 1:21
lukeer30-Sep-11 1:21 
GeneralRe: Constructing a Generic Class from several similar classes Pin
Wayne Gaylard30-Sep-11 1:48
professionalWayne Gaylard30-Sep-11 1:48 
GeneralRe: Constructing a Generic Class from several similar classes Pin
lukeer30-Sep-11 2:55
lukeer30-Sep-11 2:55 
AnswerRe: Constructing a Generic Class from several similar classes Pin
BobJanova30-Sep-11 2:29
BobJanova30-Sep-11 2:29 
AnswerRe: Constructing a Generic Class from several similar classes Pin
Luc Pattyn30-Sep-11 2:40
sitebuilderLuc Pattyn30-Sep-11 2:40 
QuestionHow to use TextBoxRenderer in usercontrol Pin
Arjen H.29-Sep-11 21:11
Arjen H.29-Sep-11 21:11 
I would like to create a custom usercontrol with some custom drawing using TextBoxRenderer. All I get with TextBoxRenderer.DrawTextBox() and also with ComboBoxRenderer.DrawTextBox() are single solid gray rectangles not using Visual Styles. When I use ComboBoxRenderer.DrawDropDownButton() the drawing is perfectly using Visual Styles. The Application.EnableVisualStyles() is called in program.cs and TextBoxRenderer.IsSupported returns true. In the code below I added a textbox to show Visual Styles are on.

C#
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Windows.Forms.VisualStyles;
using System.Drawing;


namespace WindowsFormsApplication1
{
  public class UserControl2 : UserControl
  {
    protected override void OnPaint(PaintEventArgs e)
    {
      base.OnPaint(e);
      this.BorderStyle = BorderStyle.FixedSingle;
      TextBoxRenderer.DrawTextBox(e.Graphics, new Rectangle(10, 10, 50, 50), TextBoxState.Normal);
      TextBoxRenderer.DrawTextBox(e.Graphics, new Rectangle(70, 10, 50, 50), TextBoxState.Hot);
      ComboBoxRenderer.DrawDropDownButton(e.Graphics, new Rectangle(10, 70, 20, 20), ComboBoxState.Normal);
      ComboBoxRenderer.DrawDropDownButton(e.Graphics, new Rectangle(70, 70, 20, 20), ComboBoxState.Hot);

      TextBox tb = new TextBox();
      tb.Location = new Point(10, 100);
      this.Controls.Add(tb);
    }
  }
}



Using: Win7 Prof 64 bit, visual studio 2008, .net 3.5

Thanks in advance for any suggestions...
AnswerRe: How to use TextBoxRenderer in usercontrol Pin
Pete O'Hanlon29-Sep-11 22:31
mvePete O'Hanlon29-Sep-11 22:31 
GeneralRe: How to use TextBoxRenderer in usercontrol Pin
Arjen H.29-Sep-11 23:03
Arjen H.29-Sep-11 23:03 
QuestionHow to Controls the threads Pin
Anubhava Dimri29-Sep-11 20:04
Anubhava Dimri29-Sep-11 20:04 
AnswerRe: How to Controls the threads Pin
OriginalGriff29-Sep-11 21:37
mveOriginalGriff29-Sep-11 21:37 
QuestionProblem in facebook app using C# sdk Pin
rahul_galgali29-Sep-11 19:05
rahul_galgali29-Sep-11 19:05 
AnswerRe: Problem in facebook app using C# sdk Pin
killabyte29-Sep-11 20:14
killabyte29-Sep-11 20:14 
GeneralRe: Problem in facebook app using C# sdk Pin
rahul_galgali29-Sep-11 20:58
rahul_galgali29-Sep-11 20:58 
AnswerRe: Problem in facebook app using C# sdk Pin
Richard MacCutchan29-Sep-11 22:18
mveRichard MacCutchan29-Sep-11 22:18 
AnswerRe: Problem in facebook app using C# sdk Pin
Eddy Vluggen30-Sep-11 6:51
professionalEddy Vluggen30-Sep-11 6:51 
QuestionBeginner C# developer question Pin
SFORavi29-Sep-11 9:44
SFORavi29-Sep-11 9:44 
AnswerRe: Beginner C# developer question Pin
DaveyM6929-Sep-11 9:53
professionalDaveyM6929-Sep-11 9:53 
GeneralRe: Beginner C# developer question Pin
SFORavi29-Sep-11 10:08
SFORavi29-Sep-11 10:08 
GeneralMessage Removed Pin
29-Sep-11 10:14
professionalN_tro_P29-Sep-11 10:14 
GeneralRe: Beginner C# developer question Pin
SFORavi29-Sep-11 11:42
SFORavi29-Sep-11 11:42 
AnswerRe: Beginner C# developer question Pin
Perić Željko6-Oct-11 9:06
professionalPerić Željko6-Oct-11 9:06 
QuestionHow to set IPv6 address to the adapter using C# Pin
Member 760066229-Sep-11 7:20
Member 760066229-Sep-11 7:20 
QuestionLinq to Sql Pin
siva45529-Sep-11 4:01
siva45529-Sep-11 4:01 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.