Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

DevExpress-Examples/winforms-scheduler-custom-draw-appointments

Folders and files

NameName
Last commit message
Last commit date

Latest commit

History

38 Commits

Repository files navigation

WinForms Scheduler - Customize the appearance of appointments

This example demonstrates the following techniques to customize the appearance of appointments:

  • HTML-inspired Text Formatting

    Random r = new Random();
    private void schedulerControl1_InitAppointmentDisplayText(object sender, AppointmentDisplayTextEventArgs e) {
     string[] stringArray = e.Text.Split(' ');
     StringBuilder builder = new StringBuilder();
     foreach(string str in stringArray)
     builder.Append(string.Concat("<color=", r.Next(0, 255), ",", r.Next(0, 255), ",", r.Next(0, 255), ">", str, " ", "</color>"));
     e.Text = builder.ToString();
    }
  • Custom Draw Appointments The CustomDrawAppointmentBackground event is handled to draw the border and invert the background color for selected appointments. In the Timeline View the subject is painted with different colors.

    private void schedulerControl1_CustomDrawAppointmentBackground(object sender, CustomDrawObjectEventArgs e) {
     AppointmentViewInfo aptViewInfo = e.ObjectInfo as AppointmentViewInfo;
     if(aptViewInfo == null)
     return;
     if(aptViewInfo.Selected) {
     Rectangle r = e.Bounds;
     Brush brRect = aptViewInfo.Status.GetBrush();
     e.Cache.FillRectangle(brRect, r);
     e.Cache.DrawRectangle(Pens.Blue, r);
     e.Handled = true;
     }
    }

The following screenshot shows the result:

WinForms Scheduler - Customize the appearance of appointments

Does this example address your development requirements/objectives?

(you will be redirected to DevExpress.com to submit your response)

AltStyle によって変換されたページ (->オリジナル) /