I have a winforms form with a DevExpress TreeList on it.
The Treelist is drawn as expected.
But the indicator known as "expand button" is missing.
According to the DevExpress Manual the button could be disabled with
OptionsView.ShowButtons = false;
However the TreeList.OptionView.ShowButton value is true.
(It is true during debugging, also no change if I explicitly set it to false and then again to true during initialization)
Which settings can be done so that the "expand button" disappears other then ShowButtons = false?
Try to make the root visible :
treeList1.OptionsView.ShowRoot = true;
Related
Hello i want to disable / enable button with check box.
myproject:
If I understood correctly you question, there is a property called Enabled on the Control.
Here is a link to that property documentation
Update: (Just to make more clear the answer based on comments)
It belogns to the Winforms API as this property is part of the Namespace of System.Windows.Forms
As most (if not every) control inherits from Control Class and this Class has the Enabled property which states that "Enabled
Gets or sets a value indicating whether the control can respond to user interaction."
So, every Control that inherits from this Class can use that property.
Hello if you want do get your button enabled or disabled try something like this.
first set the button.enable to false:
button.enabled = false;
then:
if(checkbox.checked == true)
{
button.enabled = true;
}
else
{
//let the user know with messagebox that he needs to accept the terms
}
I'm creating an application in Forms for very non tech-savvy users. In doing so, I'm attempting to keep some more complicated buttons and menus hidden in the main program unless an invisible checkbox is checked- which only the QA/Dev team would need to use for troubleshooting.
I've attempted to use checkBox1.Hide() followed by checkBox1.Show on click as well as on CheckedChanged, however when the checkbox is hidden or has visibile set to false, the checkbox is unable to be checked. I've also looked at the checkbox's properties window in the Form design, but setting the bordercolor to white or the bordersize to 0 under FlatAppareance had no effect.
Any suggestions? Thanks for the help.
I agree with the comments this is not a good practice when designing a user interface, but there is a way to make an invisible button in winforms.
in your constructor or in a method set the properties of the button like so
button1.FlatStyle = FlatStyle.Flat;
button1.FlatAppearance.BorderColor = BackColor;
button1.FlatAppearance.MouseOverBackColor = BackColor;
button1.FlatAppearance.MouseDownBackColor = BackColor;
this will render a invisible to the user button that can be clicked. that is if your click event is already set up.
I have a Form which I show with ShowDialog. I explicitely set the icon for the form with:
using (frmActivation myActivationView = new frmActivation())
{
myActivationView.ShowInTaskbar = true;
myActivationView.Icon = Properties.Resources.icon;
myActivationView.ShowDialog();
}
And I also set it in the project properties in the application tab as mentionend here:
Even though I have set ShowInTaskbar explicitely to true, it will show me the wrong icon.
I'm out of ideas what else could be the reason that it won't show the set icon?
It's not enough to set ShowInTaskbar. You must also make sure that the property ShowIcon of the form is set to true.
Based on the screenshot of your form and the fact, I can't see an icon in the upper left corner, I guess you haven't set it yet.
From the MSDN: Form.ShowIcon Property
The ShowIcon property contains a Boolean value that indicates whether the form's Icon is displayed in the caption bar of the form. If the ControlBox property is false, both the icon and control box will be suppressed.
If ShowIcon is false when the primary form is shown, a generic icon will be displayed in the taskbar button for the application.
I am working on a C# WinForms application that uses some DevExpress controls. I am struggling to figure out why I cannot make a hidden SimpleButton visible at runtime by setting its' Visible property to true. I've attempted to give the control focus, refresh the control, refresh the form to no avail. One thing that I have noticed in the debugger is that after the statement btnAddJob.Visible = true, the Visible property is still false. Any ideas?
public AddPredefinedJobsForm(WorkOrder workOrder)
: this()
{
currentWorkOrder = workOrder;
// Here I am just getting the position to display the button
btnAddJob.Location = new Point(btnNewJob.Location.X, btnNewJob.Location.Y);
// Hiding the button that my hidden button will replace below
btnNewJob.Visible = false;
// Give my hidden button focus
btnAddJob.Focus();
// Make my hidden button Visible
btnAddJob.Visible = true;
// Refresh the button
btnAddJob.Refresh();
// Refresh the entire form
this.Refresh();
}
If you have the button inside of a container control (like a Panel), you'll need to set the container's visibility to True in order for its child controls to be visible.
How do I set a disabled TextBox's current text color to be the same as its current background color in C#?
Simply doing txtLala.ForeColor = txtLala.BackColor does not seems to work.
This works:
txtLala.Text = "Red";
txtLala.BackColor = System.Drawing.Color.Red;
txtLala.ForeColor = txtLala.BackColor;
txtLala.ReadOnly = true;
Try setting the color, before the readonly. And also check how you are setting the color!
EDIT
Try this
txtLala.Attributes.Add("style","background-color:Red;color:Red");
If you are trying to make it invisible, you know you can set it as
txtLala.Visible = False;
EDIT II
I finally tried
txtLala.Enabled = false;
... you see that grey shadow color! I don't think you can mess with that, it looks to be a browser property setting.
Why not set as ReadOnly or Visible = False?
Maybe you have a good reason for Enabled = false
But you should note:
Use the Enabled property to specify or determine whether a control is functional. When set to false, the control appears dimmed, preventing any input from being entered in the control.
Note The ability to enable or disable functionality is always available. However, dimming and locking the control only works in Microsoft Internet Explorer version 4 and later.
This property propagates down the control hierarchy. Therefore, disabling a container control will disable all child controls within that container.
Note Not all controls support this property. See the indivual controls for details.
It seems to only work for TextBox that is read only. If it is disabled (.Enabled = false). It does not seems to work.
If this is a readonly textbox, you need to explicitly set your BackColor first, then your statement will work.
txtLala.BackColor = System.Drawing.SystemColors.Info;
txtLala.ForeColor = txtLala.BackColor;
Ref: http://bytes.com/groups/net-c/233961-read-only-textbox
Then again, if it's readonly, a label might be better. If you're trying to hide it, perhaps setting .Visible = false would be better still.
Edit: This seems to be a common question on the web. With respect to winforms: This site suggests dropping the box into a frame and setting Enabled = false on the frame, not the textbox. Once you do that, you may be able to maintain control of the forecolor.