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?

 Image_6018_1729365341135


2. Is there a way to STOP the alphablending painting of the Appointment BackColor

Image_7219_1729365483510


Thank you.


14 Replies

MS Malini Selvarasu Syncfusion Team October 21, 2024 02:20 PM UTC

Hi LV,

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.
 Query 2: Is there a way to stop the alpha blending of the appointment background color?

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.
Code Snippet:
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);
        }
    }
}
If there is any misunderstanding regarding your requirements, please provide more details so we can assist you further. Thank you for your understanding and cooperation.
Regards,
Malini Selvarasu

Attachment: WinForms_ScheduleControl_Demo_f16e7601.zip


LV LV October 21, 2024 03:30 PM UTC

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.




MS Malini Selvarasu Syncfusion Team October 22, 2024 01:58 PM UTC

Hi LV,

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.
We have modified the sample in the specified version and attached it for your review, along with the accompanying code snippet and video reference. Please take a moment to examine these materials and let us know if they meet your requirements.
Code Snippet:
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;
         }
     });
}

As previously mentioned, we will provide further details regarding Query 1 tomorrow. We appreciate your patience in the meantime.
Regards,
Malini Selvarasu

Attachment: WinForms_ScheduleControl_4bd109f.zip


LV LV October 23, 2024 08:52 AM UTC

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.



MS Malini Selvarasu Syncfusion Team October 23, 2024 02:18 PM UTC

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:
 

  1. Issue Confirmation: Could you please confirm whether you encountered an issue with the provided sample?
  2. Video or Screenshots: Please share a video or screenshots that demonstrate the issue after applying the provided workaround.
  3. Modifications: Have you made any customizations to your application? If so, please provide details.
  4. 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


LV LV October 23, 2024 04:04 PM UTC

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.









MS Malini Selvarasu Syncfusion Team October 24, 2024 02:22 PM UTC

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



MS Malini Selvarasu Syncfusion Team October 25, 2024 01:44 PM UTC

Hi LV,

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.

Regards,
Malini Selvarasu


MS Malini Selvarasu Syncfusion Team October 29, 2024 02:43 PM UTC

Hi LV,

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.
At the planning stage for every release cycle, we review all open features and identify features for implementation based on specific parameters including product vision, technological feasibility, and customer interest. We will let you know when this feature is implemented. We appreciate your patience until then.
Thank you for requesting this feature and helping us define it. We are always trying to make our products better and feature requests like yours are a key part of our product growth efforts.
If you have any more specifications/suggestions for the feature request, you can add them as a comment in the portal and cast your vote to make it count.
Regards,
Malini Selvarasu


LV LV October 30, 2024 10:17 AM UTC

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?





GS Gokul S Subramani Syncfusion Team October 31, 2024 12:36 PM UTC

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



MS Malini Selvarasu Syncfusion Team November 4, 2024 03:12 PM UTC

Hi LV,

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.
To assist you further, we have modified the sample and attached it for your review. Please take a moment to review the sample and let us know if it aligns with your requirements.
Thank you for your understanding.
Regards,
Malini Selvarasu

Attachment: WinForms_ScheduleControl_1ccfac3c.zip


LV LV November 5, 2024 05:07 AM UTC

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?




MS Malini Selvarasu Syncfusion Team November 5, 2024 02:17 PM UTC

Hi LV,

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.
To further assist you, we have prepared a sample that demonstrates this methodology. Please review the sample along with the accompanying code snippet."
Code Snippet:
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;
}

If we have misunderstood your request or if your requirements differ, please provide additional details. This will help us better understand the issue and offer a more suitable solution.
Thank you for your cooperation and understanding.
Regards,
Malini Selvarasu

Attachment: WinForms_ScheduleControl_96ec15b6.zip

Loader.
Up arrow icon