Questions tagged [controls]

Use this tag for programming scenarios related to controls (interactive elements of the user interface).

A control is an interface element that a computer user interacts with.
Common controls include:

  1. Window A rectangle that represents a "window" into a document, form, or design area.

  2. Text box A box in which to enter text or numbers.

  3. Button An equivalent to a push-button as found on mechanical or electronic instruments.

  4. Hyperlink Text with some kind of indicator (usually underlining and/or color) that indicates that clicking it will take one to another screen or page.

  5. Drop-down list A list of items from which to select. The list normally only displays items when a special button or indicator is clicked.

  6. List box A GUI widget that allows the user to select one or more items from a list contained within a static, multiple line text box.

  7. Combo box A combination of a drop-down list or list box and a single-line textbox, allowing the user to either type a value directly into the control or choose from the list of existing options.

  8. Check box A box which indicates an "on" or "off" state via a check mark ☑ or a cross ☒. Sometimes can appear in an intermediate state (shaded or with a dash) to indicate mixed status of multiple objects.

  9. Radio button A button, similar to a check-box, except that only one item in a group can be selected. Its name comes from the mechanical push-button group on a car radio receiver. Selecting a new item from the group's buttons also deselects the previously selected button.

  10. Cycle button A button that cycles its content through two or more values, thus enabling selection of one from a group of items.

  11. Datagrid A spreadsheet-like grid that allows numbers or text to be entered in rows and columns.

  12. Slider A bar that allows users to make adjustments to a value or process throughout a range of allowed values.

8394 questions
44
votes
13 answers

Is there a simple JavaScript slider?

I need to create a custom volume slider for a WMP object. The current slider is complicated to modify, and use, is there a simple way to generate a slider on an HTML page that can have it's value passed to a javascript function?
UnkwnTech
  • 88,102
  • 65
  • 184
  • 229
44
votes
5 answers

Control for displaying multiline text?

I need to display a multiline, read-only text - which control can be used for that? It should only display the text, like a Label does, however Label does not support multiline? Thanks for any hint :-)
stefan.at.kotlin
  • 15,347
  • 38
  • 147
  • 270
42
votes
6 answers

Change the location of an object programmatically

I've tried the following code: this.balancePanel.Location.X = this.optionsPanel.Location.X; to change the location of a panel that I made in design mode while the program is running but it returns an error: Cannot modify the return value of…
Ahoura Ghotbi
  • 2,866
  • 12
  • 36
  • 65
42
votes
3 answers

Can Margin be enforced even with Dock property set?

I have a WinForms Form with a few controls on it. All of them are GroupBox controls and I want them stacked, with a vertical margin set between them. I have set the Dock property to Top and it stacks them alright, but ignores the margin (controls…
Kornelije Petak
  • 9,412
  • 15
  • 68
  • 96
41
votes
3 answers

Working with version control on a Drupal/CMS project

I was wondering how teams that develop sites using Drupal (or any other CMS) integrate version control, subversion, git or similar, into their workflow. You'd obviously want your custom code and theme files under version control but when you use a…
Jens Ljungblad
  • 566
  • 1
  • 5
  • 11
40
votes
3 answers

Inheriting validation using ControlValueAccessor in Angular

I have a custom form control component (it is a glorified input). The reason for it being a custom component is for ease of UI changes - i.e. if we change the way we style our input controls fundamentally it will be easy to propagate change across…
matthall74
  • 451
  • 1
  • 4
  • 6
40
votes
7 answers

How to change disabled background color of TextBox in WPF

I've seen the following thread which is related to my question: WPF ComboBox: background color when disabled The above deals with changing the Content Template for a ComboBox. I am working with WPF, am somewhat new to Styles and Templates, and I…
39
votes
3 answers

How do I put limits on OrbitControl?

Is there a way to put limits on the OrbitControls.js? Imagine I'm creating something above the ground, I wouldn't like the camera to go below the ground, know what I mean?! The same things goes for zoom in and zoom out. Is there a way to set some…
user1659565
37
votes
1 answer

Control vs UserControl in WinForms?

What is the difference between a Control and a UserControl in .NET WinForms? I want to create a custom control, but which one should I inherit from? I've always used Control in the past without any issues, but is the "recommended" way of creating a…
Jon Tackabury
  • 47,710
  • 52
  • 130
  • 168
37
votes
7 answers

How do you change the color of the border on a group box?

In C#.NET I am trying to programmatically change the color of the border in a group box. Update: This question was asked when I was working on a winforms system before we switched to .NET.
Amy Patterson
  • 679
  • 1
  • 10
  • 24
37
votes
12 answers

How to Stretch WPF Tab Item Headers to Parent Control Width

Is there a way in XAML to cause the tab item headers to stretch across the width of the tab control? For example, I have three tabs: red, blue and green. If I have a tab control with its width set to auto, the tab headers will only fill up part of…
Ben Doerr
  • 1,655
  • 1
  • 13
  • 23
37
votes
3 answers

Control difference between Hide() and Visible?

I was wondering about the difference between using a Control’s Hide() method compared to setting the Visible property to false. When would I want to use the one over the other?
erikric
  • 4,049
  • 8
  • 32
  • 44
37
votes
9 answers

Trigger control's event programmatically

Assume that I have a WinFoms project. There is just one button (e.g. button1). The question is: is it possible to trigger the ButtonClicked event via code without really clicking it?
steavy
  • 1,483
  • 6
  • 19
  • 42
36
votes
4 answers

How do you determine which validator failed?

I am working with a page and I am getting an Page.IsValid = false and I am trying to determine which control is causing the validation problem.
Robert
  • 1,129
  • 2
  • 12
  • 23
34
votes
9 answers

C# winform check if control is physicaly visible

Is it possible to determine if at least one pixel of a control can be seen (by a property or maybe using event notification). NB : I am not looking for the Visible property that can return true even if an other window hides the control
Toto
  • 7,491
  • 18
  • 50
  • 72