Setting Colour on the Editor part of UltraCalendarCombo - winforms

Does anyone know how to colour the editor part (where you can type in the date) for the UltraCalendarCombo (winforms one) programmatically (i.e. without using the Style Library files)?
I want to set the background to a different colour whenever the control has focus but can't find any properties or methods to do this.
Thanks

If I understand you correctly, I believe you can do it one of 2 ways...
// Directly via the BackColor property
ultraCalendarCombo1.BackColor = Color.Blue;
// Using an Appearance object
ultraCalendarCombo1.Appearance = new Infragistics.Win.Appearance { BackColor = Color.Blue };

I've actually figure this one out.
Steve's answer colours the editor part and the drop down part as well.
You need to apply other Appearance properties as well.
// This is a copy from Steve's answer
// Directly via the BackColor property
ultraCalendarCombo1.BackColor = Color.Blue;
// Using an Appearance object
ultraCalendarCombo1.Appearance
= new Infragistics.Win.Appearance { BackColor = Color.Blue };
// Now we set the drop down part to a different colour (Let's say white)
ultraCalendarCombo1.DropDownApperance
= new Infragistics.Win.Appearance { BackColor = Color.White };
I believe you can do it by creating .isl (Infragistics Style Library) files but I wasn't quite sure how to swap these in and out programmatically.

Related

Changing color of togglebutton in matlab depending on array output

I am trying to change the background color of toggle buttons depending on my array output. Basically i have a loop which is filling the array.
number = 20;
tic
A = [];
for i = 1 : number
A = [i]
pause(1)
end
Depending on what number i is inside the Array i want to change that background color of the toggle button in my GUI. so i tried with this:
function togglebutton1_Callback(hObject, eventdata, handles)
if A == 1
set('BackgroundColor','red')
Sadly it didn't work. I would appreciate any help
It is going to be difficult to change the true background color of the uicontrol (with the style set to 'toggle') since that is regulated by the underlying java object. If you want to change that you'll likely have to resort to something like this
What you could do though, is rely on the fact that MATLAB's uicontrol supports HTML-formatted strings. So you could use HTML to make the button appear to be a different color
set(button, 'String', '<HTML><BODY bgcolor="red">Red Toggle');
Or personally, I think it looks better to simply change the foreground color
set(button, 'ForegroundColor', 'red')
I realise this might not solve your fundamental issue, but keep the following in mind when changing properties.
set works with a reference to the handle graphics object as its first argument, i.e. your button.
set(button,'BackgroundColor','red')
This works for me on R2013a. However, the documentation states that you should only use it for releases before R2014b. For release R2014b and onwards, using dot notation should be the norm:
button = uicontrol('Style','togglebutton');
button.BackgroundColor = 'r';
https://uk.mathworks.com/help/matlab/ref/uicontrol-properties.html#property_BackgroundColor

Make WinForms control appear on top of all other controls

I have a WinForm, in which I am hiding all borders and the Control Box. Inside the WinForm I have a RECT() (not a WinForms control) the RECT fills the entire WinForm.
I am trying to add a Label to the WinForm, but I want the label to appear on top of the RECT. The Label appears on the WinForm, but never on top of the RECT. I've tried using the following:
/*App Runs - Label does not show up*/
_label.Text = "This is the label";
_label.BackColor = Color.Cornsilk;
_form.Controls.Add(_label);
_form.Controls.SetChildIndex(_label, 0);
/*App Does Not Run*/
_label.Text = "This is the label";
_label.BackColor = Color.Cornsilk;
_form.Controls.SetChildIndex(_label, 0); //trying to set the index before I add the label to the form
_form.Controls.Add(_label);
/*App Runs - Label does not show up*/
_label.Text = "This is the label";
_label.BackColor = Color.Cornsilk;
_label.BringToFront();
_form.Controls.Add(_label);
/*App Runs - Label does not show up*/
_label.Text = "This is the label";
_label.BackColor = Color.Cornsilk;
_form.Controls.Add(_label);
_label.BringToFront();
As you can see, I've tried a lot of different stuff and nothing is working. I have also tried adding the label after the RECT has been added, to no avail. I am having a similar issue with adding a Background Image (though not the question being asked here). Does anyone know of a more forceful way to make the Label appear on top of the RECT?
Also, because of the API and dll's I am using, I cannot use something other than a RECT or WinForms.
You can use BringToFront on the label itself:
_label.BringToFront();
This will bring the label to the front of the Z order on the form, so it should display on top of other form elements.
I have a RECT() (not a WinFrom control) the RECT fills the entire WinForm
A "RECT" isn't a control - it's a definition size and position. Depending on what you're using to display your background, this may not work. If it's painting into the entire form, it could be overwriting your other controls, and "masking" them, no matter what you use for z order. Without more information, it could be difficult to provide guidance, but you'd have to make sure you cause the label to redraw after the "RECT".

Can't change backcolor of TabPage with DevExpress WinForms XtraTab

I'm using a DevExpress WinForms XtraTab control v11.2 and I can't get the tab page background color to change. It's stuck on transparent. I've set colors on the XtraTab's AppearancePage.PageClient and there was no effect.
If you throw a default XtraTabControl out you get two tabs that are both white in the main area. I want this area to be grey.
In addition to what you're doing, set the XtraTabControl's PaintStyleName to Standard or PropertyView or one of the other non-Default styles to get the look you want:
Here's an example of dragging in the XtraTabControl and only changing the PaintStyleName property:
If the control's look and feel is set as skin then from what I'm aware you can't change the backcolor.
In order to actually do so you have two options:
1) Use devexpress SkinEditor utility to create a skin with the colors you want.
2) Set default look and feel to false, the style to flat, then you will be able to choose what color you want (keep in mind since you will be disabling the skin it won't look as good so the first option might be better).
this.xtraTabControl1.LookAndFeel.Style = DevExpress.LookAndFeel.LookAndFeelStyle.Flat;
this.xtraTabControl1.LookAndFeel.UseDefaultLookAndFeel = false;
this.xtraTabControl1.TabPages[0].BackColor = System.Drawing.Color.Gray;

Styling of WPF Chart AreaSerie in program

I need to create area series in WPF chart toolkit in a program, but I do not know how to change a color of serie.
Setting of PathStyle doesn't work even in XAML. According to source files area series should be binded to background color but this doesn't work either.
Thank you for your help.
I had a hard time also figuring out how to change colors. Changing Background colours or ColorPalette didn't seem to do anything. I solved the issue, for the LineSeries, by settings the background with a setter in the style ( the DataPointStyle of the LineSeries, which applies on a DataPoint)
so in vb :
Dim NLS = New LineSeries()
NLS.IndependentValuePath = "Time"
NLS.DependentValuePath = "Quantity"
NLS.Title = " Quantity in function of time"
NLS.ItemsSource = MyItemSource
Dim ThisStyle As New Style(GetType(DataPoint))
ThisStyle.Setters.Add(New Setter(BackgroundProperty, New SolidColorBrush(MyWantedColor)))
NLS.DataPointStyle = ThisStyle
I hope this can help you solve your issue for the Area Series.

DataGridView special coloring - which way is better styles or cellformatting event?

I'm wondering for efficiency which is a better way to do the datagridview cell coloring?
You can use styles set on the grid at design time. I don't use these often though for some reason.
or
you can handle the cellformatting event of every single cell in the grid and do comparisions.
I do not know how the styles check and apply the style but if it makes less calls than a cell formatting event for every single cell it would seem that it is better. I wasn't sure so I figured I'd ask here.
The CellFormatting event is indeed an expensive option, as it is called for every visible cell each time it is painted: setting a style is easier I find if you do it in code:
DataGridViewCellStyle cellStyle = new DataGridViewCellStyle
{
Alignment = DataGridViewContentAlignment.MiddleLeft,
BackColor = Color.White,
ForeColor = Color.Black,
SelectionBackColor = Color.FromArgb(224, 224, 224),
SelectionForeColor = Color.Black,
WrapMode = DataGridViewTriState.False,
NullValue = string.Empty
};
myDGV.DefaultCellStyle = cellStyle;
myDGV.ColumnHeadersDefaultCellStyle = cellStyle;

Resources