Hi,
I want to diplay a Multiline subject :
I used a customfilter to do that supplied earlier in this site.
How can i do that correctly ?
I want to apply a padding on the text displayed inside the appointment
Check the file result.png in the attached file to get an idea for the result i need.
thx
Thank you very much !
I took another look at your sample and I think I was confused. Your original post said
"I want to diplay a Multiline subject :
I used a customfilter to do that supplied earlier in this site."
So I assumed your sample was already doing this, but apparently, it's doing something else.
So I changed around the CreationFilter to more correctly size the AppointmentUIElement based on the text, accounting for the borders.
public void AfterCreateChildElements(UIElement parent) { if (parent is TextUIElement) { var textElement = (TextUIElement)parent;
if (textElHeight == -1) { textElHeight = textElement.Rect.Height; } var appointmentElement = textElement.GetAncestor(typeof(AppointmentUIElement)) as AppointmentUIElement;
if (appointmentElement == null || textElement.IsTextFullyVisible) return; SizeF size; using (Graphics g = textElement.Control.CreateGraphics()) { size = DrawUtility.MeasureString(g, textElement.Text, textElement.Control.Font); }
var borderWidths = DrawUtility.CalculateBorderWidths(appointmentElement.BorderStyle, appointmentElement.BorderSides); size.Width += borderWidths.Left + borderWidths.Right; size.Height += borderWidths.Top + borderWidths.Bottom;
int padding = 5; size.Width += padding; size.Height += padding;
appointmentElement.Rect = new Rectangle( appointmentElement.Rect.X, appointmentElement.Rect.X, (int)Math.Ceiling(size.Width), (int)Math.Ceiling(size.Height) );
textElement.Rect = appointmentElement.Rect; textElement.WrapText = true; textElement.MultiLine = true; } }
But as I mentioned early, what you are trying to do here is incredibly complex and difficult and this code is not going to work right. Already I can see a problem in your sample that the appointment on the bottom is running outside the borders of the owner. So that's an issue you would have to deal with and that's going to be very difficult. And this sample doesn't even have any adjacent or overlapping appointments, so that's going to make it even more complicated.
Frankly, even for someone who is intimately familiar with CreationFilters and UIElements, it would require a huge amount of time and effort to achieve what you want here.
Can you fix the problem in my example i sent you in the 1st post ?
it should help me a lot . to undersdand it correctly ;
best regards.
Okay... so what's the problem? The sample you attached here does that - doesn't it?
It doesn't do it very well, but that's for all the reasons I already listed above. You will need to deal with those issues in whatever way makes sense for your application based on whatever assumptions you can make in your application.
Thx !
To maked simple;
I want to resize the Height of the Appointment BAR to Fit the Text in the Subject of the appointment.
check the image in the attached file
Each line is separated by LineFeed.