Results 1 to 3 of 3

Thread: Textbox border

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Nov 2002
    Posts
    195

    Textbox border

    I've just started with C# having used C++ and VB in the past. I'm finding it quite nice to use, but one small niggle is that (like VB) you can't specify the border colours for many of the controls (specifically the TextBox).

    Is there a way around this? With VB I used to just create a borderless textbox and then use a 'Shape' control to do the border manually. Is there a better way to do this in C#?

    (I'm using Visual C# if that makes any difference)
    Using Visual Studio .NET 2005

  2. #2
    Addicted Member jordan23's Avatar
    Join Date
    Dec 2002
    Posts
    166
    You can do it the same way just use this

    Code:
    Graphics g = e.Graphics;
    Pen p = new Pen(Color.Black, 2.0f);
    		
    g.DrawLine(p, this.Width/2, 2, this.Width/2, this.Height/2,lblCenter.Height/2);

  3. #3

    Thread Starter
    Addicted Member
    Join Date
    Nov 2002
    Posts
    195
    Thanks! I had to change the code to the following, but thanks for pushing me in the right direction!
    Code:
    Graphics g = e.Graphics;
    Pen p = new Pen(Color.Blue, 2.0f);
    		
    g.DrawRectangle (p, 0, 0, cmdTest.Width, cmdTest.Height);
    Using Visual Studio .NET 2005

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width