Hi there,
yeah, I'm diggin' deeper into custom drawing
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...
This is my code:
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