Profile Picture

NDateTimePicker with skins and palettes

Posted By Brad Swearingen 13 Years Ago
Author
Message
Brad Swearingen
Posted 13 Years Ago
View Quick Profile
Forum Guru

Forum Guru (53 reputation)Forum Guru (53 reputation)Forum Guru (53 reputation)Forum Guru (53 reputation)Forum Guru (53 reputation)Forum Guru (53 reputation)Forum Guru (53 reputation)Forum Guru (53 reputation)Forum Guru (53 reputation)

Group: Forum Members
Last Active: 8 Years Ago
Posts: 53, Visits: 3

I've just started using an NDateTimePicker and noticed a couple of things with how it looks:

1) When I use a skin most of the skins do not draw a border around the calendar drop-down button when the control does not have the focus.  It seems there at least needs to be a line on the left of the button to separate the date with the button.  I've attached a screenshot which shows an example of this.

2) The NDateTimePicker does use the skin or palette but there are many colors that are not utilized by the widget.  Thus they stay the default colors regardless of which skin/palette I use.  I expected this widget to take advantage of the skin/palette fully like the rest of the N* widgets do.  Is there an expectation that I have to code for a palette/skin change event myself and then change the widgets Calendar***Color Properties?  Another way?

I'm using the 11.1.17.12 build.



Attachments
datetimepicker.gif (214 views, 5.00 KB)
Nevron Support
Posted 13 Years Ago
View Quick Profile
Supreme Being

Supreme Being (4,350 reputation)Supreme Being (4,350 reputation)Supreme Being (4,350 reputation)Supreme Being (4,350 reputation)Supreme Being (4,350 reputation)Supreme Being (4,350 reputation)Supreme Being (4,350 reputation)Supreme Being (4,350 reputation)Supreme Being (4,350 reputation)

Group: Forum Members
Last Active: 6 hours ago
Posts: 3,043, Visits: 3,777
Hello Brad,

1. You can change this behavior by creating your custom skin based on the one you use.
Then you should change the image which is used to paint the drop down button.

2. If you are using Windows Vista or Windows 7 and using themes such as Aero, then the properties that modifies the color of the calendar has no effect.
NDateTimePicker control derives from the standard DateTimePicker control and the colors of the calendar are set to a palettes colors in ApplyPalette virtual method.
Currently, the following calendar colors takes their values from palette:
CalendarForeColor = Palette.ControlText;
CalendarMonthBackground = Palette.Control;
CalendarTitleBackColor = Palette.ControlDark;
CalendarTrailingForeColor = NColorHelper.ToGrayScale(Palette.ControlText);

You can add additional colors by overriding ApplyPalette method.

Of course all, these settings will take effect if you are running it on windows XP or the visual styles of your application are not enabled.

Best Regards,
Nevron Support Team



Brad Swearingen
Posted 13 Years Ago
View Quick Profile
Forum Guru

Forum Guru (53 reputation)Forum Guru (53 reputation)Forum Guru (53 reputation)Forum Guru (53 reputation)Forum Guru (53 reputation)Forum Guru (53 reputation)Forum Guru (53 reputation)Forum Guru (53 reputation)Forum Guru (53 reputation)

Group: Forum Members
Last Active: 8 Years Ago
Posts: 53, Visits: 3

Thanks very much for the explanation:

1) I was planning on using one or more of the existing skins and personally thought those images could be improved.  Mainly wanted to report this perhaps making it a candidate for a future minor change to the default skin files.  Glad to know about the workaround with my own skin.

2) On my Win7 I changed to the Classic theme and the colors started being used except for the back color for the date field.  When I stopped calling the Application.EnableVisualStyles() then I got the back color for the palette and the theme did not matter.  I did notice the forecolor wasn't pulled from the palette but was black for the date field, though.  That's much closer to using the entire skin/palette without the visual styles.  I noticed, however, that the left half of the drop-down button didn't cause the drop-down to show when clicked on but caused the selection into the field.  Seems there is some odd behavior here. 

Is there any recommendation for how to use the Application.EnableVisualStyles with the Nevron UI?



Nevron Support
Posted 13 Years Ago
View Quick Profile
Supreme Being

Supreme Being (4,350 reputation)Supreme Being (4,350 reputation)Supreme Being (4,350 reputation)Supreme Being (4,350 reputation)Supreme Being (4,350 reputation)Supreme Being (4,350 reputation)Supreme Being (4,350 reputation)Supreme Being (4,350 reputation)Supreme Being (4,350 reputation)

Group: Forum Members
Last Active: 6 hours ago
Posts: 3,043, Visits: 3,777
Hi Brad,

The problem with the width of the NDateTimePicker drop down button is because on machines running OS after XP and EnableVisualStyles is called there is additional calendar icon.
This make the button wider and we measure it so when we draw our button on top of the original to has the same size.
Currently, when the OS is higher than XP we take the width of SystemInformation.IconSize.Width + SystemInformation.BorderSize.Width * 2 to measure the width of our button.
We will add a additional condition to check whether EnableVisualStyles method was call to handle this case too.

To work around this problem you can override NDateTimePicker.GetDropDownButtonWidth method as follows:

protected override int GetDropDownButtonWidth()
{
   if (System.Environment.OSVersion.Version.Major > 5 && Application.RenderWithVisualStyles == false)
   {
         return SystemInformation.VerticalScrollBarWidth;
   }

   return base.GetDropDownButtonWidth();
}

Hope this helps.

Best Regards,
Nevron Support Team





Similar Topics


Reading This Topic