Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Changing the border of TextBox

5 views
Skip to first unread message

Nicolas Staelens

unread,
Aug 22, 2005, 4:50:15 AM8/22/05
to
Hello

Changing the border of a TextBox isn't currently supported by the
.NETCF, nor by the TextBoxEx in the SDF on OpenNETCF.

Is there any way to change the border of a TextBox by yourself? I
would like to keep only the bottom line of the box. I know that that
is not a standard BorderStyle, but normally you can adjust the Paint
of a control, which isn't possible in the .NETCF.

Anyone who has found a way to do this?

Thx

Arun

unread,
Aug 22, 2005, 6:21:48 AM8/22/05
to
There is no BorderStyle property supported
Instead instantiate panel control and add textbox control to that and
set the bounds accordingly to show the way you wanted.

Try this code below

using System;
using System.Drawing;
using System.Windows.Forms;

namespace paneltextbox
{
public class PanelTextBox : Panel
{
/// <summary>
/// Class to create a ProgressBarPanel Control
/// </summary>

# region " Destructor "
/// <summary>
/// Clean up resource memory used.
/// </summary>
protected override void Dispose( bool disposing )
{
base.Dispose( disposing );
}
#endregion

#region " Globals "

// Global Variables
private Panel PnlWnd;
private TextBox txtBox;

# endregion

# region " Paint Constructor "

/// <summary>
/// Constructor to build control
/// </summary>

public PanelTextBox()
{
//Set Form Rectangle Area
this.Bounds = new Rectangle(63,31,98,21);

//Set Form Background Color
this.BackColor = Color.Black;

//Add New Panel and Set Area
PnlWnd = new Panel();
PnlWnd.Bounds = new Rectangle(0, 0, this.Width, this.Height);
PnlWnd.BackColor = Color.White;
this.Controls.Add(PnlWnd);

//Add StatusBar Label
txtBox = new TextBox();
this.txtBox.Location = new System.Drawing.Point(-1, -1);
txtBox.Text = "";
PnlWnd.Controls.Add(txtBox);
}

# endregion

}
}


Hope this helps,
Cheers,
Arun.
www.innasite.com

Nicolas Staelens

unread,
Aug 22, 2005, 7:18:15 AM8/22/05
to
Hey

That works fantastic. Thanks!

But can you explain to me why, by setting the point to (-1,-1) it
doesn't draw the right line of the textbox?

I thought the x-axis pointed from left to right en the y-axis from top
to bottom, but then you would get the right line drawn if one
specifies the (-1,-1) point...where am I mistaken?

Thx!
NS


On 22 Aug 2005 03:21:48 -0700, "Arun" <arunkuma...@gmail.com>
wrote:

Arun

unread,
Aug 22, 2005, 9:34:31 AM8/22/05
to
Glad that I could help,

>But can you explain to me why, by setting the point to (-1,-1) it
>doesn't draw the right line of the textbox?

It is just hidden behind the panel. You can try setting it to 0,0 to
see the lines.

Cheers,
Arun.
www.innasite.com

0 new messages