Desidero aggiungere Percorso WPF a InkCanvas
e utilizzare la selezione per selezionare Percorso WPF. Quindi, io uso questo codice.Perché ActualWidth e ActualHeight iniziano da 0,0?
System.Windows.Shapes.Path path = drawCanvas.Children[i] as System.Windows.Shapes.Path;
drawCanvas.Children.RemoveAt(i);
inkCanvas.Children.Add(path);
Questa è l'uscita. Devo selezionare Percorso WPF da 0,0 perché Actualwidth
e ActualHeight
iniziano da 0,0.
Come faccio a selezionare il percorso assoluto WPF?
Grazie
Edit:
Ora, posso selezionare assolutamente utilizzando questo codice.
System.Windows.Shapes.Path path = drawCanvas.Children[i] as System.Windows.Shapes.Path;
drawCanvas.Children.RemoveAt(i);
path.Margin = new Thickness(-getMinX(path), -getMinY(path), 0, 0);
containPath.Children.Add(path);
containPath.Width = getMaxX(path) - getMinX(path);
containPath.Height = getMaxY(path) - getMinY(path);
containPath.Margin = new Thickness(getMinX(path), getMinY(path), 0, 0);
inkCanvas.Children.Add(containPath);
Non penso che UpdateLayout farà nulla. – NVM
Non abbiamo abbastanza codice per testare la teoria ma se 'UIElement.IsMeasureValid' è' false', non c'è speranza che 'ActualWidth' e' ActualHeight' siano corretti. –
Si prega di vedere la mia risposta. Nel mio precedente commento intendevo dire che UpdateLayout non farà nulla per un 'Path' – NVM