Skip to content

Commit 3c443c0

Browse files
authored
Merge pull request #1052 from syncfusion-content/910705-Prepare-UG-document-for-the-feature-customize-the-drop-down-icon-in-the-WF-SfDateTimeEdit-control
WINFORMS 910705 : Update the Customization of default dropdown Icon in SfDateTimeEdit's UG documentation in Winforms.
2 parents 58af0eb + 1687b7c commit 3c443c0

File tree

2 files changed

+95
-87
lines changed

2 files changed

+95
-87
lines changed

WindowsForms/DateTimePicker/Appearance.md

Lines changed: 95 additions & 87 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
layout: post
33
title: Customization of SfDateTimeEdit | Windows Forms | Syncfusion
44
description: Customize the visibility of UpDown Button, Key Navigation Support and DropDown Popup alignment support
5-
platform: WindowsForms
5+
platform: windowsforms
66
control: SfDateTimeEdit
77
documentation: ug
88
---
@@ -30,13 +30,13 @@ The following code snippets illustrates the customization.
3030

3131
{% highlight C# %}
3232

33-
sfDateTimeEdit1.Style.BorderColor = Color.Red;
33+
sfDateTimeEdit1.Style.BorderColor = Color.Red;
3434

3535
{% endhighlight %}
3636

3737
{% highlight VB %}
3838

39-
sfDateTimeEdit1.Style.BorderColor = Color.Red
39+
sfDateTimeEdit1.Style.BorderColor = Color.Red
4040

4141
{% endhighlight %}
4242

@@ -61,40 +61,32 @@ The following code snippets illustrates the same.
6161

6262
{% highlight C# %}
6363

64-
//Setting the DropDown Fore color
64+
//Setting the DropDown Fore color
6565

66-
this.dateTimeEdit.Style.DropDown.ForeColor = Color.Purple;
66+
this.dateTimeEdit.Style.DropDown.ForeColor = Color.Purple;
67+
this.dateTimeEdit.Style.DropDown.HoverForeColor = Color.Yellow;
68+
this.dateTimeEdit.Style.DropDown.PressedForeColor = Color.Green;
6769

68-
this.dateTimeEdit.Style.DropDown.HoverForeColor = Color.Yellow;
69-
70-
this.dateTimeEdit.Style.DropDown.PressedForeColor = Color.Green;
71-
72-
//Setting the DropDown Back color
70+
//Setting the DropDown Back color
7371

7472
this.sfDateTimeEdit1.Style.DropDown.BackColor = Color.Aqua;
75-
7673
this.sfDateTimeEdit1.Style.DropDown.HoverBackColor = Color.Gray;
77-
7874
this.sfDateTimeEdit1.Style.DropDown.PressedBackColor = Color.Orange;
7975

8076
{% endhighlight %}
8177

8278
{% highlight VB %}
8379

84-
'Setting the DropDown Fore color
85-
86-
Me.dateTimeEdit.Style.DropDown.ForeColor = Color.Purple
80+
'Setting the DropDown Fore color
8781

88-
Me.dateTimeEdit.Style.DropDown.HoverForeColor = Color.Yellow
82+
Me.dateTimeEdit.Style.DropDown.ForeColor = Color.Purple
83+
Me.dateTimeEdit.Style.DropDown.HoverForeColor = Color.Yellow
84+
Me.dateTimeEdit.Style.DropDown.PressedForeColor = Color.Green
8985

90-
Me.dateTimeEdit.Style.DropDown.PressedForeColor = Color.Green
91-
92-
'Setting the DropDown Back color
86+
'Setting the DropDown Back color
9387

9488
Me.sfDateTimeEdit1.Style.DropDown.BackColor = Color.Aqua
95-
9689
Me.sfDateTimeEdit1.Style.DropDown.HoverBackColor = Color.Gray
97-
9890
Me.sfDateTimeEdit1.Style.DropDown.PressedBackColor = Color.Orange
9991

10092
{% endhighlight %}
@@ -105,34 +97,57 @@ The following code snippets illustrates the same.
10597

10698
![Customize the drop down](appearance-images/drodownbackcolor.png)
10799

100+
## Customize default calendar Icon in drop-down button
101+
102+
The [DateTimeIcon](https://help.syncfusion.com/cr/windowsforms/Syncfusion.WinForms.Input.SfDateTimeEdit.html#Syncfusion_WinForms_Input_SfDateTimeEdit_DateTimeIcon) property in the SfDateTimeEdit control allows you to customize the calendar icon displayed in the drop-down button. By setting this property, you can replace the default icon with your own image, helping to match the design of your application.
108103

109-
### Change visibility of dropdown button
104+
Note: The recommended size for the custom image is 16x16 pixels. If the image is larger than this size, it will be automatically resized to 16x16 pixels.
105+
106+
{% tabs %}
107+
108+
{% highlight C# %}
109+
110+
this.dateTimeEdit.DateTimeIcon = Image.FromFile(@"Images/calendar.png");
111+
112+
{% endhighlight %}
113+
114+
{% highlight VB %}
115+
116+
Me.dateTimeEdit.DateTimeIcon = Image.FromFile(@"Images/calendar.png");
117+
118+
{% endhighlight %}
119+
120+
{% endtabs %}
121+
122+
![Customize drop-down calendar appearance](appearance-images/CalendarIconCustomization.png)
123+
124+
### Change visibility of drop-down button
110125

111126
The drop-down button in the SfDateTimeEdit allows you to open the pop-up calendar by using the mouse interaction. The visibility of drop-down button can be changed by the [ShowDropDown](https://help.syncfusion.com/cr/windowsforms/Syncfusion.WinForms.Input.SfDateTimeEdit.html#Syncfusion_WinForms_Input_SfDateTimeEdit_ShowDropDown) property.
112127

113128
{% tabs %}
114129

115130
{% highlight C# %}
116131

117-
//Enable the DropDown Button
132+
//Enable the DropDown Button
118133

119-
this.dateTimeEdit.ShowDropDown = true;
134+
this.dateTimeEdit.ShowDropDown = true;
120135

121-
//Disable the DropDown Button
136+
//Disable the DropDown Button
122137

123-
this.dateTimeEdit.ShowDropDown = false;
138+
this.dateTimeEdit.ShowDropDown = false;
124139

125140
{% endhighlight %}
126141

127142
{% highlight VB %}
128143

129-
'Enable the DropDown Button
144+
'Enable the DropDown Button
130145

131-
Me.dateTimeEdit.ShowDropDown = true
146+
Me.dateTimeEdit.ShowDropDown = true
132147

133-
'Disable the DropDown Button
148+
'Disable the DropDown Button
134149

135-
Me.dateTimeEdit.ShowDropDown = false
150+
Me.dateTimeEdit.ShowDropDown = false
136151

137152
{% endhighlight %}
138153

@@ -155,29 +170,23 @@ The following code snippets illustrates the same.
155170

156171
{% highlight C# %}
157172

158-
//Setting the UpDown Fore color
159-
160-
this.dateTimeEdit.Style.UpDownForeColor = Color.HotPink;
161-
162-
this.dateTimeEdit.Style.UpDownHoverForeColor = Color.Blue;
173+
//Setting the UpDown Fore color
163174

164-
this.dateTimeEdit.Style.UpDownBackColor = Color.LightGray;
165-
166-
this.dateTimeEdit.Style.UpDownHoverBackColor = Color.Yellow;
175+
this.dateTimeEdit.Style.UpDownForeColor = Color.HotPink;
176+
this.dateTimeEdit.Style.UpDownHoverForeColor = Color.Blue;
177+
this.dateTimeEdit.Style.UpDownBackColor = Color.LightGray;
178+
this.dateTimeEdit.Style.UpDownHoverBackColor = Color.Yellow;
167179

168180
{% endhighlight %}
169181

170182
{% highlight VB %}
171183

172-
'Setting the UpDown Fore color
173-
174-
Me.dateTimeEdit.Style.UpDownForeColor = Color.HotPink
175-
176-
Me.dateTimeEdit.Style.UpDownHoverForeColor = Color.Blue
177-
178-
Me.dateTimeEdit.Style.UpDownBackColor = Color.LightGray
184+
'Setting the UpDown Fore color
179185

180-
Me.dateTimeEdit.Style.UpDownHoverBackColor = Color.Yellow
186+
Me.dateTimeEdit.Style.UpDownForeColor = Color.HotPink
187+
Me.dateTimeEdit.Style.UpDownHoverForeColor = Color.Blue
188+
Me.dateTimeEdit.Style.UpDownBackColor = Color.LightGray
189+
Me.dateTimeEdit.Style.UpDownHoverBackColor = Color.Yellow
181190

182191
{% endhighlight %}
183192

@@ -193,25 +202,25 @@ The up-down allows you to change the value by increment or decrement of values o
193202

194203
{% highlight C# %}
195204

196-
//Enable the UpDown Button
205+
//Enable the UpDown Button
197206

198-
this.dateTimeEdit.ShowUpDown = true;
207+
this.dateTimeEdit.ShowUpDown = true;
199208

200-
//Disable the UpDown Button
209+
//Disable the UpDown Button
201210

202-
this.dateTimeEdit.ShowUpDown = false;
211+
this.dateTimeEdit.ShowUpDown = false;
203212

204213
{% endhighlight %}
205214

206215
{% highlight VB %}
207216

208-
'Enable the UpDown Button
217+
'Enable the UpDown Button
209218

210-
Me.dateTimeEdit.ShowUpDown = true
219+
Me.dateTimeEdit.ShowUpDown = true
211220

212-
'Disable the UpDown Button
221+
'Disable the UpDown Button
213222

214-
Me.dateTimeEdit.ShowUpDown = false
223+
Me.dateTimeEdit.ShowUpDown = false
215224

216225
{% endhighlight %}
217226

@@ -227,13 +236,13 @@ The drop-down calendar of the SfDateTimeEdit can be obtained from the [MonthCale
227236

228237
{% highlight C# %}
229238

230-
dateTimeEdit.MonthCalendar.ShowFooter = false;
239+
dateTimeEdit.MonthCalendar.ShowFooter = false;
231240

232241
{% endhighlight %}
233242

234243
{% highlight VB %}
235244

236-
dateTimeEdit.MonthCalendar.ShowFooter = false
245+
dateTimeEdit.MonthCalendar.ShowFooter = false
237246

238247
{% endhighlight %}
239248

@@ -249,21 +258,19 @@ The size of the drop-down calendar can be customized by using the [DropDownSize]
249258

250259
{% highlight C# %}
251260

252-
//Setting DropDownSize
261+
//Setting DropDownSize
253262

254-
this.dateTimeEdit.DropDownSize = new Size(294, 293);
255-
256-
this.dateTimeEdit.Width = 294;
263+
this.dateTimeEdit.DropDownSize = new Size(294, 293);
264+
this.dateTimeEdit.Width = 294;
257265

258266
{% endhighlight %}
259267

260268
{% highlight VB %}
261269

262-
'Setting DropDownSize
263-
264-
Me.dateTimeEdit.DropDownSize = New Size(294, 293)
270+
'Setting DropDownSize
265271

266-
Me.dateTimeEdit.Width = 294
272+
Me.dateTimeEdit.DropDownSize = New Size(294, 293)
273+
Me.dateTimeEdit.Width = 294
267274

268275
{% endhighlight %}
269276

@@ -279,8 +286,9 @@ Week numbers can be displayed by setting [ShowWeekNumbers](https://help.syncfusi
279286

280287
{% highlight C# %}
281288

282-
//Setting ShowWeekNumbers
283-
sfDateTimeEdit1.MonthCalendar.ShowWeekNumbers = true;
289+
//Setting ShowWeekNumbers
290+
291+
sfDateTimeEdit1.MonthCalendar.ShowWeekNumbers = true;
284292

285293
{% endhighlight %}
286294

@@ -312,9 +320,9 @@ Before apply theme to SfDateTimeEdit, required theme assembly should be loaded a
312320

313321
{% highlight C# %}
314322

315-
using Syncfusion.WinForms.Controls;
323+
using Syncfusion.WinForms.Controls;
316324

317-
static class Program
325+
static class Program
318326
{
319327
/// <summary>
320328
/// The main entry point for the application.
@@ -333,9 +341,9 @@ using Syncfusion.WinForms.Controls;
333341

334342
{% highlight VB %}
335343

336-
Imports Syncfusion.WinForms.Controls
344+
Imports Syncfusion.WinForms.Controls
337345

338-
Friend Module Program
346+
Friend Module Program
339347
''' <summary>
340348
''' The main entry point for the application.
341349
''' </summary>
@@ -363,17 +371,17 @@ This option helps to set the Office2016Colorful Theme.
363371

364372
{% highlight C# %}
365373

366-
// Office2016Colorful
374+
// Office2016Colorful
367375

368-
this.dateTimeEdit.ThemeName = "Office2016Colorful";
376+
this.dateTimeEdit.ThemeName = "Office2016Colorful";
369377

370378
{% endhighlight %}
371379

372380
{% highlight VB %}
373381

374-
' Office2016Colorful
382+
' Office2016Colorful
375383

376-
Me.dateTimeEdit.ThemeName = "Office2016Colorful"
384+
Me.dateTimeEdit.ThemeName = "Office2016Colorful"
377385

378386
{% endhighlight %}
379387

@@ -389,17 +397,17 @@ This option helps to set the Office2016White Theme.
389397

390398
{% highlight C# %}
391399

392-
// Office2016White
400+
// Office2016White
393401

394-
this.dateTimeEdit.ThemeName = "Office2016White";
402+
this.dateTimeEdit.ThemeName = "Office2016White";
395403

396404
{% endhighlight %}
397405

398406
{% highlight VB %}
407+
408+
' Office2016White
399409

400-
' Office2016White
401-
402-
Me.dateTimeEdit.ThemeName = "Office2016White"
410+
Me.dateTimeEdit.ThemeName = "Office2016White"
403411

404412
{% endhighlight %}
405413

@@ -415,17 +423,17 @@ This option helps to set the Office2016DarkGray Theme.
415423

416424
{% highlight C# %}
417425

418-
// Office2016DarkGray
426+
// Office2016DarkGray
419427

420-
this.dateTimeEdit.ThemeName = "Office2016DarkGray";
428+
this.dateTimeEdit.ThemeName = "Office2016DarkGray";
421429

422430
{% endhighlight %}
423431

424432
{% highlight VB %}
425433

426-
' Office2016DarkGray
434+
' Office2016DarkGray
427435

428-
Me.dateTimeEdit.ThemeName = "Office2016DarkGray"
436+
Me.dateTimeEdit.ThemeName = "Office2016DarkGray"
429437

430438
{% endhighlight %}
431439

@@ -441,17 +449,17 @@ This option helps to set the Office2016Black Theme.
441449

442450
{% highlight C# %}
443451

444-
// Office2016Black
452+
// Office2016Black
445453

446-
this.dateTimeEdit.ThemeName = "Office2016Black";
454+
this.dateTimeEdit.ThemeName = "Office2016Black";
447455

448456
{% endhighlight %}
449457

450458
{% highlight VB %}
451459

452-
' Office2016Black
460+
' Office2016Black
453461

454-
Me.dateTimeEdit.ThemeName = "Office2016Black"
462+
Me.dateTimeEdit.ThemeName = "Office2016Black"
455463

456464
{% endhighlight %}
457465

Loading

0 commit comments

Comments
 (0)