コード例 #1
0
        public void AddThumbail(string filePath)
        {
            DesignerItem newItem = new DesignerItem();
            FreeImageAlgorithmsWPFImage uiElement = new FreeImageAlgorithmsWPFImage(filePath);

            uiElement.Stretch = Stretch.Fill;
            newItem.Selected += new System.Windows.RoutedEventHandler(OnDesignerItemSelected);

            uiElement.IsHitTestVisible = false;
            newItem.Content            = uiElement;

            newItem.Width  = uiElement.ThumbnailFib.Width;
            newItem.Height = uiElement.ThumbnailFib.Height;

            DesignerCanvas.SetLeft(newItem, startx);
            DesignerCanvas.SetTop(newItem, starty);

            startx += 10.0f;
            starty += 10.0f;

            this.Canvas.Children.Add(newItem);

            this.Canvas.DeselectAll();
            newItem.IsSelected = true;
        }
コード例 #2
0
        void OnDesignerItemSelected(object sender, System.Windows.RoutedEventArgs e)
        {
            DesignerItem item = sender as DesignerItem;

            FreeImageAlgorithmsWPFImage imObject = item.Content as FreeImageAlgorithmsWPFImage;

            if (imObject != null)
            {
                string fileName = System.IO.Path.GetFileNameWithoutExtension(imObject.FilePath);
                this.Text = "Manual Import " + fileName;
                item.BringToFront();
            }
        }