Hello Linzi,
Thank you for your question.
It is possible to achieve this by inheriting from a couple of classes. First you need to create a custom
YearlyRecurrenceSettings control:
class CustomYearlyRecurrenceControl : YearlyRecurrenceSettings
{
public CustomYearlyRecurrenceControl()
{
this.InitializeComponent();
}
private void InitializeComponent()
{
((System.ComponentModel.ISupportInitialize)(this.radioDayOfMonth)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.radioWeekOfMonth)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.comboBoxMonth1)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.spinDayNumber)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.comboBoxWeekNumber)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.comboBoxWeekdays)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.labelOfMonth)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.comboBoxMonth2)).BeginInit();
this.SuspendLayout();
//
// radioWeekOfMonth
//
this.radioWeekOfMonth.Text = "Of";
//
// comboBoxMonth1
//
//
//
//
this.comboBoxMonth1.RootElement.AutoSizeMode = Telerik.WinControls.RadAutoSizeMode.WrapAroundChildren;
//
// spinDayNumber
//
//
//
//
this.spinDayNumber.RootElement.AutoSizeMode = Telerik.WinControls.RadAutoSizeMode.WrapAroundChildren;
//
// comboBoxWeekNumber
//
this.comboBoxWeekNumber.Location = new System.Drawing.Point(171, 36);
//
//
//
this.comboBoxWeekNumber.RootElement.AutoSizeMode = Telerik.WinControls.RadAutoSizeMode.WrapAroundChildren;
//
// comboBoxWeekdays
//
this.comboBoxWeekdays.Location = new System.Drawing.Point(264, 36);
//
//
//
this.comboBoxWeekdays.RootElement.AutoSizeMode = Telerik.WinControls.RadAutoSizeMode.WrapAroundChildren;
//
// labelOfMonth
//
this.labelOfMonth.Location = new System.Drawing.Point(148, 36);
this.labelOfMonth.Size = new System.Drawing.Size(22, 16);
this.labelOfMonth.Text = "the";
//
// comboBoxMonth2
//
this.comboBoxMonth2.Location = new System.Drawing.Point(55, 36);
//
//
//
this.comboBoxMonth2.RootElement.AutoSizeMode = Telerik.WinControls.RadAutoSizeMode.WrapAroundChildren;
//
// CustomYearlyRecurrenceControl
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.Location = new System.Drawing.Point(80, 40);
this.Name = "CustomYearlyRecurrenceControl";
((System.ComponentModel.ISupportInitialize)(this.radioDayOfMonth)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.radioWeekOfMonth)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.comboBoxMonth1)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.spinDayNumber)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.comboBoxWeekNumber)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.comboBoxWeekdays)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.labelOfMonth)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.comboBoxMonth2)).EndInit();
this.ResumeLayout(false);
this.PerformLayout();
}
}
As you can see there is some automatically generated code in this class. This is because it is possible to use Visual Studio's designer over the custom control if you define it in a separate file. I used the designer to change the places of the controls.
Next, you need to create a custom
EditRecurrenceDialog which uses the custom control defined above:
Finally, to put this classes in use, we need to handle the
RecurrenceEditDialogShowing event of
RadScheduler:
I hope you find this useful. Feel free to write back if you have any further questions.
All the best,
Ivan Todorov
the Telerik team
Q3’11 of RadControls for WinForms is available for
download (see
what's new).
Get it today.