/// <summary> /// Evento para posionar a imagem do colaborador no centro do Appointment e o nome do mesmo embaixo da foto /// </summary> /// <param name="sender">object</param> /// <param name="e">CustomDrawObjectEventArgs</param> private void schedulerControl1_CustomDrawAppointment(object sender, CustomDrawObjectEventArgs e) { TimeLineAppointmentViewInfo time = e.ObjectInfo as TimeLineAppointmentViewInfo; if (time != null) { Image image = FotosColaboradores[new Guid(time.Appointment.Id.ToString())]; int width = time.InnerBounds.Width; int x = time.InnerBounds.X; e.Cache.Paint.DrawImage(e.Graphics, image, new Point(x + (width / 2) - (image.Width / 2), time.InnerBounds.Top)); string textColaborador = time.Appointment.Subject; if (FonteAppointment.Size >= 9) { if (textColaborador.Length > 15) { retanguloAppointment.X = x + (width / 2) - (image.Width) - textColaborador.Length - 14; } else { retanguloAppointment.X = x + (width / 2) - (image.Width) - textColaborador.Length + 3; } } else { textColaborador = textColaborador.Replace(" ", "\n"); } retanguloAppointment.X = x + (width / 2) - (image.Width / 2); retanguloAppointment.Y = time.InnerBounds.Top + image.Height + 5; e.Cache.DrawString(textColaborador, FonteAppointment, new SolidBrush(Color.Black), retanguloAppointment, StringFormat.GenericDefault); e.Handled = true; } }
/// <summary> /// Evento do hint /// </summary> /// <param name="sender">object</param> /// <param name="e">ToolTipControllerShowEventArgs</param> private void toolTipController1_BeforeShow(object sender, DevExpress.Utils.ToolTipControllerShowEventArgs e) { e.AllowHtmlText = DevExpress.Utils.DefaultBoolean.True; TimeLineAppointmentViewInfo info = e.SelectedObject as TimeLineAppointmentViewInfo; if (info != null) { e.Title = string.Format("{0} ({1} dias)", info.Appointment.Subject, info.Appointment.Duration.Days + 1); e.IconType = DevExpress.Utils.ToolTipIconType.Information; string[] properties = info.Appointment.Description.Split(','); System.Text.StringBuilder builder = new System.Text.StringBuilder(); builder.Append("- Inicio: ").Append(string.Format("{0:dd/MM/yyyy}", info.Appointment.Start.Date)).Append("\n"); builder.Append("- Término: ").Append(string.Format("{0:dd/MM/yyyy}", info.Appointment.End.Date)).Append("\n"); builder.Append("- Venda de férias: ").Append(properties[7]).Append("\n"); builder.Append("- Remunerado: ").Append(properties[8]).Append("\n"); builder.Append("- Situação: ").Append(properties[6]).Append("\n"); if (!string.IsNullOrEmpty(properties[4])) { builder.Append("- Planejado por: ").Append(properties[4]).Append("\n"); } if (!string.IsNullOrEmpty(properties[5])) { builder.Append("- Atualizado por: ").Append(properties[5]).Append("\n"); } e.ToolTip = builder.ToString(); } }
private void schedulerControl1_CustomDrawAppointment(object sender, CustomDrawObjectEventArgs e) { TimeLineAppointmentViewInfo tlvi = e.ObjectInfo as TimeLineAppointmentViewInfo; // This code works only for the Timeline View. if (tlvi != null) { Rectangle r = e.Bounds; r.X += 3; r.Y += 3; string[] s = tlvi.Appointment.Subject.Split(' '); for (int i = 0; i < s.Length; i++) { e.Cache.DrawString(s[i], tlvi.Appearance.Font, new SolidBrush(colorArray[i]), r, StringFormat.GenericDefault); SizeF shift = e.Graphics.MeasureString(s[i] + " ", tlvi.Appearance.Font); r.X += (int)shift.Width; } e.Handled = true; } }