How to change Appointments Size and Label Color
Hi,
1. Is there a way to make all appointments shown with the same size?
By default they are created with a progressive sizing. Appointments in the left are bigger and the appointments to the right they keep getting smaller.
Can we make all appointments the same size?
2. Is there a way to STOP the alphablending painting of the Appointment BackColor
Thank you.
Query 1: Can we make all appointments the same size?
Based on the information provided, we understand that you would like all appointments to be displayed with the same size. We are currently analyzing your reported scenario and require additional time for validation. We will provide an update on or before October 23, 2024.
This can be achieved by utilizing the DrawCellBackground event. In this event, you can fill the cell rectangle with a SolidColorBrush to prevent alpha blending effects. To assist you further, we have prepared a sample that demonstrates this approach. Please review the sample along with the accompanying code snippet, and let us know if it meets your requirements.
this.scheduleControl1.GetScheduleHost().DrawCellBackground += Form1_DrawCellBackground; private void Form1_DrawCellBackground(object sender, Syncfusion.Windows.Forms.Grid.GridDrawCellBackgroundEventArgs e) { if (e.Style.CellValue!= " " && e.Style.CellValue != "" && e.Style.CellType != "Header" ) { using (Brush backColorBrush = new SolidBrush(Color.FromArgb(255, e.Style.BackColor))) { // Fill the appointment rectangle with the solid color (no transparency) e.Graphics.FillRectangle(backColorBrush, e.ClipBounds); } } } |
Attachment: WinForms_ScheduleControl_Demo_f16e7601.zip
Thank you for the reply.
I am using Schedule Control version 20.4350.0.38
The sample provided does not work on CustomWeek or WorkWeek layouts.
I tried implementing the snipet in my code and still does not work. The appointments are still drawn with an alphablend background.
Can you please provide a sample code for that version.
Thank you.
We apologize for the inconvenience caused by the previous update. The issue arose when the view was changed while creating a new schedule view. To address this, it is essential to subscribe to the DrawCellBackground event within the ScheduleGridCreated event, which is triggered when the view changes. As a result, the alpha blending effects do not reflect when the view changes.
this.scheduleControl1.ScheduleGridCreated += ScheduleControl1_ScheduleGridCreated; private void ScheduleControl1_ScheduleGridCreated(object sender, ScheduleGridCreatedEventArgs e) { this.BeginInvoke((MethodInvoker)delegate { var scheduleHost = this.scheduleControl1.GetScheduleHost(); if (scheduleHost != null) { scheduleHost.DrawCellBackground += Form1_DrawCellBackground; } }); } |
Attachment: WinForms_ScheduleControl_4bd109f.zip
Hi,
I have tried your suggestion but still can't get it to work.
Can you please provide a working sample for CustomWeek or WorkWeek layout?
Thank you.
Hi
LV,
Based on the information provided, we understand that the alpha blending
effects are still present in your application, even after applying the provided
workaround. We have reviewed the previously submitted sample, and it worked
correctly on our end. For your convenience, we have attached a video reference
for your review.
To assist you
further, please provide the following information:
- Issue Confirmation: Could you please confirm whether you encountered an issue with the provided sample?
- Video or Screenshots: Please share a video or screenshots that demonstrate the issue after applying the provided workaround.
- Modifications: Have you made any customizations to your application? If so, please provide details.
- Modified
Sample: Please modify the attached sample to replicate the issue
on your end and share it with us.
This information will help us better understand the problem and work towards finding a solution promptly.
We apologize for any inconvenience caused. Regarding your first query, we require additional time for validation. We will provide an update on or before October 25, 2024. We appreciate your patience during this time.
Regards,
Malini Selvarasu
Attachment: WinForms_ScheduleControl_c377eaa6.zip
Hi,
I found out why your sample does not work on my project. I have the option ShowRoundedCorners set to True
With ShowRoundedCorners = True the Alphablend is still there.
Can you please provide sample code for this case?
Thank you.
Hi
LV,
Based on the information provided, when ShowRoundedCorners is set to true, the
suggested workaround did not work as expected. After analyzing the issue, we
have reviewed the feasibility of updating the background for rounded
rectangles. Currently, modifying the alpha blending effects for rounded
rectangles is not possible, and the default effects are applied to the
appointment labels. Thank you for your understanding.
As previously
mentioned, we will provide further details regarding Query 1 tomorrow. We
appreciate your patience in the meantime.
Regards,
Malini Selvarasu
We apologize for any inconvenience caused. Regarding your first query, we require additional time for validation. We will provide an update on or before October 29, 2024. We appreciate your patience during this time.
Malini Selvarasu
We have reviewed the feasibility of adjusting the appointment size in ScheduleControl, but due to the current structural design, this change is not possible. The appointment display relies on a covered range of cells, which prevents us from applying a uniform width across all cells. Although we attempted alternative methods to achieve consistent cell width, implementing this change would require a restructuring of the cell merging approach for loading appointments.
Consequently, we have acknowledged your request to "Support for change the Appointment label size in ScheduleControl" and have logged a feature request accordingly. We will implement this feature in any of our upcoming releases.
Thank you for the reply on both issues.
I understand the difficulty solving the appointment size and the Label Color alphablending issues and I thank you for your reply and efforts.
For the Label Color issue I have a possible solution, I need to find the related ScheduleAppointment object whilst overriding the DrawCellBackground routine. This way I could get the Label Color from the appointment Object and draw the rounded rectangle myself.
Is there a way to get that info from either the sender Object or the e EventArgs parameters?
Hi LV,
Based on the information you provided, we are currently analyzing your reported scenario. We need more time to validate it and will provide an update on or before November 4, 2024.
Thank you for your understanding and cooperation.
Best Regards,
Gokul S
Based on the information provided, we understand that you need to draw a RoundedRectangle within the `DrawGridCellBackground` event. Within this event, you have access to the Graphics object and its methods. We have partially achieved the requirement by using the `DrawRoundedRect` method within the `DrawCellBackground` event. However, as we mentioned earlier, we cannot fully achieve this scenario.
Attachment: WinForms_ScheduleControl_1ccfac3c.zip
Hello Malvini,
I had already achieved drawing the rounded rectangle but I thank you for the sample.
How can I access the correspoding ScheduleAppointment object?
Is it accessible using the sender Object or the e EventArgs parameters inside DrawCellBackground?
We have investigated the `DrawCellBackground` event to access the `ScheduleAppointment` object. However, the event arguments do not provide direct access to the appointment objects. To address this, we have implemented the `GetAppointment()` method, which retrieves all appointments in the `ScheduleControl`. We then call this method within the `DrawCellBackground` event, passing `e.Style.Text` to compare against the values contained in the appointments. If the values match, we return the corresponding appointment object. This approach effectively allows you to retrieve the appointment objects.
private void Form1_DrawCellBackground(object sender, Syncfusion.Windows.Forms.Grid.GridDrawCellBackgroundEventArgs e) { if (e.Style.CellValue != " " && e.Style.CellValue != "") { var appointmentObject = GetAppointment(e.Style.Text); } } public IScheduleAppointment GetAppointment(string cellValue) { var dataProvider = this.scheduleControl1.DataSource; ScheduleAppointmentList appointmentList = new ScheduleAppointmentList(); // Get the selected dates from the schedule control foreach (DateTime date in scheduleControl1.GetScheduleHost().Calendar.SelectedDates) { var appointmentsForDay = dataProvider.GetScheduleForDay(date); // Manually add each appointment to the appointmentList foreach (IScheduleAppointment appointment in appointmentsForDay) { appointmentList.Add(appointment); // Add each appointment one by one } } // Iterate over the list to find the matching appointment foreach (IScheduleAppointment item in appointmentList) { if (item.ToString().Equals(cellValue)) { return item; // Return the appointment if it matches the cell value } } return null; } |
Attachment: WinForms_ScheduleControl_96ec15b6.zip
- 14 Replies
- 3 Participants
-
LV LV
- Oct 19, 2024 07:24 PM UTC
- Nov 5, 2024 02:17 PM UTC