public MenuObject(TextureObject texture) { textureObject = texture; posX = 0; posY = 0; streach = 1.0f; }
private void RightPanelAddTextureObject(object sender, RoutedEventArgs e) { OpenFileDialog myDialog = new OpenFileDialog(); myDialog.Filter = "Картинки(*.JPG;*.GIF;*.PNG)|*.JPG;*.GIF;*.PNG" + "|Все файлы (*.*)|*.* "; myDialog.CheckFileExists = true; myDialog.Multiselect = true; if (myDialog.ShowDialog() == true) { foreach (string fiilename in myDialog.FileNames) { TextureObject texobj = new TextureObject(); texobj.ImagePath = new Uri(fiilename, UriKind.Absolute); if (texobj.ImagePath.IsFile) { texobj.Name = System.IO.Path.GetFileNameWithoutExtension(texobj.ImagePath.LocalPath); } TextureObjects.Add(texobj); } } }
private void Image_MouseDown(object sender, MouseButtonEventArgs e) { image = e.Source as Image; ListBox lb = FindParent <ListBox>(image); ListBoxItem lbi = FindParent <ListBoxItem>(image); ((ListBoxItem)lbi).IsSelected = true; selectedTextureObject = (TextureObject)lb.SelectedItem; if (selectedTextureObject != null) { textBox.Text = selectedTextureObject.Name; } else { textBox.Text = "NULL"; } //textBox.Text = selectedTextureObject.ImagePath.ToString(); CreateDragDropWindow(image); DataObject data = new DataObject(typeof(ImageSource), image.Source); DragDrop.DoDragDrop(image, data, DragDropEffects.Copy); }
private void RightPanelLB_SelectionChanged(object sender, SelectionChangedEventArgs e) { selectedTextureObject = (TextureObject)RightPanelLB.SelectedItem; }