c# WinForms can you get the NumericUpDown text area

后端 未结 4 1349
半阙折子戏
半阙折子戏 2021-01-16 16:09

Is it possible to get the text area of a NumericUpDown control? I\'m looking to get it\'s size so that I can mask it with a panel. I don\'t want the user to be able to edit

4条回答
  •  无人及你
    2021-01-16 17:12

    The 'proper' way to do this is to create an Up-Down control and a Label (the label can't be selected or edited). However, the authors of Windows Forms, in their infinite wisdom, have decided that we don't need the Up-Down control and so they didn't provide a .NET wrapper for one. They decided that the only reason we could ever want an Up-Down control is when paired with a TextBox control.

    The Up-Down control is simple enough to create a light wrapper if you want to go this route: http://msdn.microsoft.com/en-us/library/bb759880.aspx

    Edit 1

    [snip]

    Edit 2

    I blogged about it here: http://tergiver.wordpress.com/2010/11/05/using-the-up-down-control-in-windows-forms/

提交回复
热议问题