コード例 #1
0
        void listView_Click(object sender, EventArgs e)
        {
            ListViewItem item     = listView.SelectedItems[0];
            String       timeFile = _pixmapManage.getFilePathFromName(item.Text);
            String       file     = Path.Combine(SVProData.IconPath, timeFile);

            ///组织一个选中图元后的图片对象
            SvBitMap.ShowName      = item.Text;
            SvBitMap.ImageFileName = timeFile;

            //读文件数据
            SVPixmapFile pixmap = new SVPixmapFile();

            pixmap.readPixmapFile(file);
            Image srcImg = Image.FromStream(pixmap.Pixmap);

            this.pictureBox1.SizeMode = PictureBoxSizeMode.Zoom;
            this.pictureBox1.Image    = srcImg;

            String fileCreateTime = File.GetCreationTime(file).ToString();
            //显示信息
            String str = String.Format("显示名称: {0}\r\n\r\n文件: {1}\r\n\r\n宽度: {2}\r\n\r\n高度: {3}\r\n\r\n创建时间: {4}",
                                       item.Text, file, srcImg.Width, srcImg.Height, fileCreateTime);

            this.textBox1.Text = str;
        }
コード例 #2
0
        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            if (value == null)
            {
                return(null);
            }

            SVBitmap bitmap = value as SVBitmap;

            if (bitmap == null)
            {
                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(bitmap.ShowName));
            SVPixmapFile pixmap = new SVPixmapFile();

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

            return(BitmapToBitmapImage(oBitmap));
        }
コード例 #3
0
        void treeView_AfterSelect(object sender, TreeViewEventArgs e)
        {
            //获取分类名称
            String classText = treeView.SelectedNode.Text;

            listView.Items.Clear();
            textBox1.Clear();
            pictureBox1.Image = null;

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

            if (vDict.ContainsKey(classText))
            {
                foreach (var text in vDict[classText])
                {
                    //文件路径
                    String file = Path.Combine(SVProData.IconPath, _pixmapManage.getFilePathFromName(text));
                    if (!File.Exists(file))
                    {
                        return;
                    }

                    //读文件数据
                    SVPixmapFile pixmap = new SVPixmapFile();
                    pixmap.readPixmapFile(file);

                    imageList.Images.Add(text, pixmap.getBitmapFromData());
                    imageList1.Images.Add(text, pixmap.getBitmapFromData());

                    ListViewItem viewItem = listView.Items.Add(text);
                    viewItem.ImageKey = text;
                }
            }
        }
コード例 #4
0
 /// <summary>
 /// 获取24位BMP位图数据
 /// </summary>
 /// <param oldName="width">图片的宽度</param>
 /// <param oldName="height">图片的高度</param>
 /// <returns>实际二进制数据</returns>
 public byte[] bitmap24Data(int width, int height)
 {
     try
     {
         String       picFile = Path.Combine(SVProData.IconPath, ImageFileName);
         SVPixmapFile file    = new SVPixmapFile();
         file.readPixmapFile(picFile);
         Bitmap       bitmap = file.getBitmapObject(width, height, 24);
         SVBitmapHead head   = new SVBitmapHead(bitmap);
         return(head.data());
     }
     catch
     {
         return(null);
     }
 }
コード例 #5
0
        public Bitmap bitmap()
        {
            Bitmap result = null;

            try
            {
                String       file       = Path.Combine(SVProData.IconPath, ImageFileName);
                SVPixmapFile pixmapFile = new SVPixmapFile();
                pixmapFile.readPixmapFile(file);
                result = pixmapFile.getBitmapFromData();
            }
            catch
            {
                return(result);
            }

            return(result);
        }