Exemplo n.º 1
0
        public SVBitmapWindow()
        {
            InitializeComponent();

            _pixmapFile = new SVPixmapFile();

            //建立主节点
            _classNode = classTreeView.Nodes.Add("图标分类");
            _classNode.ExpandAll();
            _classNode.Nodes.Add("默认分类");

            _pixmapManage = new SVPixmapElementManage();
            _iconFile     = Path.Combine(SVProData.IconPath, "icon.proj");
            if (File.Exists(_iconFile))
            {
                _pixmapManage.loadElementFromFile(_iconFile);
                loadData();
            }

            //导入图片
            this.importPicBtn.Click            += new EventHandler(importPicBtn_Click);
            this.VisibleChanged                += new EventHandler(SVBitmapWindow_VisibleChanged);
            this.classTreeView.AfterSelect     += new TreeViewEventHandler(classTreeView_Click);
            this.classTreeView.AfterLabelEdit  += new NodeLabelEditEventHandler(classTreeView_AfterLabelEdit);
            this.listView.SelectedIndexChanged += new EventHandler(listView_TextChanged);
        }
Exemplo n.º 2
0
        public WPFWidgetBackGround()
        {
            InitializeComponent();

            this.lv.ItemsSource = typeof(Colors).GetProperties();

            String file = System.IO.Path.Combine(SVProData.IconPath, "icon.proj");

            if (!File.Exists(file))
            {
                return;
            }

            SVPixmapElementManage manage = new SVPixmapElementManage();

            manage.loadElementFromFile(file);

            Dictionary <String, List <String> > vDict = manage.getData();

            foreach (var item in vDict)
            {
                picList.AddRange(item.Value);
            }

            this.listViewPic.ItemsSource = picList;
        }
Exemplo n.º 3
0
        private void listViewPic_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            String str = this.listViewPic.SelectedItem as String;

            String infile = System.IO.Path.Combine(SVProData.IconPath, "icon.proj");
            SVPixmapElementManage manage = new SVPixmapElementManage();

            manage.loadElementFromFile(infile);

            String       file1  = System.IO.Path.Combine(SVProData.IconPath, manage.getFilePathFromName(str));
            SVPixmapFile pixmap = new SVPixmapFile();

            pixmap.readPixmapFile(file1);
            System.Drawing.Image  srcImg = System.Drawing.Image.FromStream(pixmap.Pixmap);
            System.Drawing.Bitmap bitmap = new System.Drawing.Bitmap(srcImg);

            BitmapImage source = BitmapToBitmapImage(bitmap);

            this.picture.Source = source;

            SVPageProperties attrib = this.DataContext as SVPageProperties;

            attrib.PicIconData.ShowName      = str;
            attrib.PicIconData.ImageFileName = manage.getFilePathFromName(str);
        }
Exemplo n.º 4
0
        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            if (value == null)
            {
                return(null);
            }

            String str = value as String;

            if (String.IsNullOrWhiteSpace(str))
            {
                return(null);
            }

            String infile = System.IO.Path.Combine(SVProData.IconPath, "icon.proj");
            SVPixmapElementManage manage = new SVPixmapElementManage();

            manage.loadElementFromFile(infile);

            String       file1  = System.IO.Path.Combine(SVProData.IconPath, manage.getFilePathFromName(str));
            SVPixmapFile pixmap = new SVPixmapFile();

            pixmap.readPixmapFile(file1);
            System.Drawing.Image  srcImg = System.Drawing.Image.FromStream(pixmap.Pixmap);
            System.Drawing.Bitmap bitmap = new System.Drawing.Bitmap(srcImg);

            return(BitmapToBitmapImage(bitmap));
        }