#4 p3can
Problem je, ze v praci mam VS2008 kde nemozem pouzit NET4.0.
Příspěvky odeslané z IP adresy 2a00:12a8:8007:1000:ad1e:...–
Tomas
Tomas
#4 p3can
Tu je kod pre ContextMenu:
MouseRightButtonUp += new System.Windows.Input.MouseButtonEventHandler(myRectangleAndEllipse_MouseRightButtonUp);
}
void myRectangleAndEllipse_MouseRightButtonUp(object sender, System.Windows.Input.MouseButtonEventArgs e)
{
ContextMenu contextMenu = new ContextMenu();
MenuItem deleteMenuItem = new MenuItem();
deleteMenuItem.Header = "Delete";
deleteMenuItem.Click += deleteMenuItem_Click;
contextMenu.Items.Add(deleteMenuItem);
MenuItem zIndexUpMenuItem = new MenuItem();
zIndexUpMenuItem.Header = "ZIndex Up to: " + (Canvas.GetZIndex(this) + 1).ToString();
zIndexUpMenuItem.Click += zIndexUpMenuItem_Click;
contextMenu.Items.Add(zIndexUpMenuItem);
MenuItem zIndexDownMenuItem = new MenuItem();
zIndexDownMenuItem.Header = "ZIndex Down to: " + (Canvas.GetZIndex(this) - 1).ToString();
zIndexDownMenuItem.Click += zIndexDownMenuItem_Click;
contextMenu.Items.Add(zIndexDownMenuItem);
this.ContextMenu = contextMenu;
}
void zIndexDownMenuItem_Click(object sender, RoutedEventArgs e)
{
int zIndex = Canvas.GetZIndex(this);
if (zIndex > 0)
Canvas.SetZIndex(this, --zIndex);
}
Tomas
#4 p3can
Prisiel som na to, ze sa to chova uplne divne. Tie stvorce co vidis, tak to je moja vlastna trieda, ktora dedi od Shape. V triede mam definovane ContextMenu kde nastavujem tiez ZIndex a takto to funguje. Ale ak zavoiam metodu, ktora nastavuje ZIndex z vonku, tak to blbne.