private void schedulerControl1_CustomDrawAppointmentBackground(object sender, CustomDrawObjectEventArgs e) { DevExpress.XtraScheduler.Drawing.AppointmentViewInfo aptViewInfo = e.ObjectInfo as DevExpress.XtraScheduler.Drawing.AppointmentViewInfo; if (aptViewInfo == null) { return; } if (aptViewInfo.Selected) { Rectangle r = e.Bounds; Brush brRect = aptViewInfo.Status.GetBrush(); e.Graphics.FillRectangle(brRect, r); e.Graphics.DrawRectangle(new Pen(Color.Blue, 2), r); e.Handled = true; } }
private void schedulerControl1_CustomDrawAppointmentBackground(object sender, DevExpress.XtraScheduler.CustomDrawObjectEventArgs e) { DevExpress.XtraScheduler.Drawing.AppointmentViewInfo aptViewInfo = e.ObjectInfo as AppointmentViewInfo; if (aptViewInfo != null) { AppearanceObject app = aptViewInfo.Appearance; DevExpress.XtraScheduler.Appointment appointment = aptViewInfo.Appointment; DataRowView rowView = (DataRowView)appointment.GetRow(schedulerControl1.Storage); if (rowView != null) { DataRow row = rowView.Row; if (ACMS.Convert.ToInt32(row["nStatusID"]) == 2) { app.BackColor = Color.Aqua; app.DrawBackground(e.Cache, e.Bounds); } else if (ACMS.Convert.ToInt32(row["nStatusID"]) == 5) { app.BackColor = Color.Yellow; app.DrawBackground(e.Cache, e.Bounds); } if (ACMS.Convert.ToInt32(row["nStatusID"]) == 2 || ACMS.Convert.ToInt32(row["nStatusID"]) == 5) { // // // DevExpress.Utils.AppearanceObject app2 = new DevExpress.Utils.AppearanceObject(); // Rectangle rect1 = new Rectangle(e.Bounds.X, e.Bounds.Y, e.Bounds.Width, e.Bounds.Height); // // System.Drawing.StringFormat strFormat = new StringFormat(); // strFormat.Alignment = StringAlignment.Near; // // app2.TextOptions.VAlignment = DevExpress.Utils.VertAlignment.Top; // app2.TextOptions.WordWrap = DevExpress.Utils.WordWrap.Wrap; // // System.Drawing.FontStyle fs = new FontStyle(); // fs |= FontStyle.Bold; // fs |= FontStyle.Underline; // // app2.Font = new Font(app2.Font.FontFamily, app2.Font.Size, fs); // app2.DrawString(e.Cache, // "M'ID:" + row["strMembershipID"].ToString() + ", S'Code: " + aptViewInfo.DisplayText, // rect1, strFormat); // // app.TextOptions.VAlignment = DevExpress.Utils.VertAlignment.Center; // app.TextOptions.WordWrap = DevExpress.Utils.WordWrap.Wrap; // // Rectangle rect2 = new Rectangle(e.Bounds.X, e.Bounds.Y + 5, e.Bounds.Width, e.Bounds.Height + 5); // // app.DrawString(e.Cache, aptViewInfo.DisplayDescription, rect2, app.TextOptions.GetStringFormat()); // // e.Handled = true; } } } }