numericUpDown - font/size problems

  • Thread starter Thread starter Magnus Hedberg
  • Start date Start date
M

Magnus Hedberg

Hi,

I'm having a problem with the numericUpDown control in
Visual Studio as there is no Font property and it doesn't
adapt to the parent Form font size. I.e. I'm stuck with
the initial tiny font size and up/down button size.
I've tried all tricks I know, to change the Font size used
but I can't manage that.
Furthermore the control doesn't handle methods like
protected override OnKeyPress even though Visual Studio
inserts part of the function automatically.
That technique works fine for other controls like button
and textbox.

Any suggestions ?
Magnus
 
Changing fonts and height isn't supported by the NumericUpDown control.
I'll pass this along to the product team as a feature request.

If you give me some details about how you were going to use this (why you
want a big control) it can help us to understand why this feature is
important.

mike




NETCF Beta FAQ's -- http://www.gotdotnet.com/team/netcf/FAQ.aspx
This posting is provided "AS IS" with no warranties, and confers no rights.
 
Hell Mike,
nice to hear from you.

We are using a Windows CE platform (ARMV4I) and have a touch screen
(muck like a kiosk application).
We need big and clear controls which can be manipulated using the
fingers and easily read from a distance when necessary. It would be
enough for us if it used the same Font as the parent control.
As I mentioned earlier, other controls do adopt to their parent control
font size and it seems like that (for numericUpDown) in the Visual
Studio development environment but it doesn't work when the application
is deployed to the device (or emulator).

We also want the numericUpDown control to react to the OnKeyPress etc.
functions because we have a tactile feedback, i.e. the user should here
and understand that the touch of the control actually took place. This
technique works fine for TextBox, Button etc.

The CheckBox control also have problems, the first time it is displayed
it is using the default (small) font, then after that it uses the
correct font (set in the Font property).


Magnus
 
thanks for the info, I'll pass that along.

As for a work around for the numericUpDown, I had a wild idea. You could
make your own with a textbox (that supports big fonts) and a vScrollBar
that's big, but not tall enough to see the thumb (or 2 separate buttons for
up/down):

using System;
using System.Drawing;
using System.Collections;
using System.Windows.Forms;
using System.Data;

namespace myNumericUpDown
{
/// <summary>
/// Summary description for Form1.
/// </summary>
public class Form1 : System.Windows.Forms.Form
{
private System.Windows.Forms.TextBox textBox1;
private System.Windows.Forms.VScrollBar vScrollBar1;
private System.Windows.Forms.MainMenu mainMenu1;

public Form1()
{
//
// Required for Windows Form Designer support
//
InitializeComponent();
}
/// <summary>
/// Clean up any resources being used.
/// </summary>
protected override void Dispose( bool disposing )
{
base.Dispose( disposing );
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.mainMenu1 = new System.Windows.Forms.MainMenu();
this.textBox1 = new System.Windows.Forms.TextBox();
this.vScrollBar1 = new System.Windows.Forms.VScrollBar();
//
// textBox1
//
this.textBox1.Font = new System.Drawing.Font("Tahoma", 18F,
System.Drawing.FontStyle.Regular);
this.textBox1.Location = new System.Drawing.Point(32, 40);
this.textBox1.Size = new System.Drawing.Size(128, 44);
this.textBox1.Text = "textBox1";
//
// vScrollBar1
//
this.vScrollBar1.Location = new System.Drawing.Point(160, 40);
this.vScrollBar1.Maximum = 91;
this.vScrollBar1.Size = new System.Drawing.Size(32, 40);
this.vScrollBar1.ValueChanged += new
System.EventHandler(this.vScrollBar1_ValueChanged);
//
// Form1
//
this.Controls.Add(this.vScrollBar1);
this.Controls.Add(this.textBox1);
this.Menu = this.mainMenu1;
this.Text = "Form1";

}
#endregion

/// <summary>
/// The main entry point for the application.
/// </summary>

static void Main()
{
Application.Run(new Form1());
}

private void vScrollBar1_ValueChanged(object sender,
System.EventArgs e)
{
this.textBox1.Text = this.vScrollBar1.Value.ToString();
}
}
}

NETCF Beta FAQ's -- http://www.gotdotnet.com/team/netcf/FAQ.aspx
This posting is provided "AS IS" with no warranties, and confers no rights.
 
Thanks Mike, I'll try to use your idea (I think it could work). Magnus Don't just participate in USENET...get rewarded for it!
 
Hello Mike,

it did work. Thanks a lot.

I experience the same problem with the TreeView control. In designer
mode you think that it is OK as it shows the parent font size but when
running the application it defaults to 8 or 10 points.

Once again, this is not good enough for larger screens (12"). I assume
that the status for TreeView is the same as for NumericUpDown regarding
this issue?

Magnus
 
Back
Top