Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic Getting the dragging/layout status of an item during CustomDraw operations (Read 2685 times)
Achim
Junior Member
**
Offline


MindFusion rocks!

Posts: 70
Location: Bayreuth, Germany
Joined: Jun 28th, 2012
Getting the dragging/layout status of an item during CustomDraw operations
Oct 30th, 2012 at 8:41am
Print Post  
Hi there,

yeah, I'm diggin' deeper into custom drawing Smiley Today I have an issue happening when a custom drawn item is being moved while another item is dragged on the same resource. On the attached screenshot you can see what happens while dragging the other item: the small black/white arrow symbols appear, the custom drawn item disappears (which is the intended behavior) but the custom drawn text and icon are still there - a little bit weird positioned... Shocked

This is my code:

Code
Select All
calendar.CustomDraw |= CustomDrawElements.ResourceViewItem | CustomDrawElements.ItemMoveBand;
            calendar.ItemDrawing += delegate(object sender, DrawEventArgs args)
                {
                    if (args.Element == CustomDrawElements.ResourceViewItem)
                    {
                        var infoItem = args.Item as InfoItem;
                        if (infoItem != null)
                        {
                            args.Handled = true;
                            if (args.IsShadow) return;

                            var ds = getSet(infoItem.DisplayType);

                            var b = args.Bounds;
                            args.Graphics.FillRectangle(ds.BackBrush, b);
                            args.Graphics.FillRectangle(ds.BorderBrush, b.Left, b.Top, b.Width, 3);
                            args.Graphics.FillRectangle(ds.BorderBrush, b.Left, b.Bottom -3, b.Width, 3);

                            var y = args.Bounds.Top+(args.Bounds.Height - ds.Symbol.Height)/2;
                            args.Graphics.DrawImage(ds.Symbol, args.Bounds.Left + 3, y, ds.Symbol.Width, ds.Symbol.Height);

                            var offsetW = ds.Symbol.Width + 5;
                            var textBounds = new Rectangle(args.Bounds.X + offsetW, args.Bounds.Y,
                                                           args.Bounds.Width - offsetW, args.Bounds.Height);
                            args.Graphics.DrawString(args.Item.HeaderText,
                                args.Style.HeaderFont,
                                ds.TextBrush,
                                textBounds, ds.Format);
                        }
                    }
                };
 



I'm looking for a way to detect the status of the layout in the custom drawing routing. So if I knew the item is not visible because the layout is going to change I could just return doing nothing.

Thanks in advance for any help on this
Achim
  

Bildschirmfoto_2012-10-30_um_09_34_58.png (Attachment deleted)
Back to top
WWW  
IP Logged
 
Meppy
God Member
*****
Offline


MindFusion support

Posts: 1783
Joined: Jul 20th, 2005
Re: Getting the dragging/layout status of an item during CustomDraw operations
Reply #1 - Oct 30th, 2012 at 9:36am
Print Post  
Hi,

It appears that the ItemDrawing event is raised for out-of-the-view items with an empty Bounds as an argument. The following version should fix this:

https://mindfusion.eu/_temp/MindFusion.Scheduling.5.4.2.trial4.zip

Regards,
Meppy
  
Back to top
 
IP Logged
 
Achim
Junior Member
**
Offline


MindFusion rocks!

Posts: 70
Location: Bayreuth, Germany
Joined: Jun 28th, 2012
Re: Getting the dragging/layout status of an item during CustomDraw operations
Reply #2 - Oct 30th, 2012 at 9:43am
Print Post  
YEP! It does Smiley

Best regards and happy halloween
Achim
  
Back to top
WWW  
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint