Пример #1
0
        public SVExportTemplateForm()
        {
            InitializeComponent();

            //限制输入模板名称长度
            this.textBox.MaxLength = 32;

            this.textBox.KeyPress += new KeyPressEventHandler((sender, e) =>
            {
                //if (e.KeyChar == '\b')
                //    return;

                //String _iconList = this.textBox.Text + e.KeyChar;
                //if (!Regex.IsMatch(_iconList, "^[_a-zA-Z][_a-zA-Z0-9]*$"))
                //    e.Handled = true;
                //else
                //    e.Handled = false;
            });

            this.okBtn.Click += new EventHandler((sender, e) =>
            {
                if (String.IsNullOrEmpty(textBox.Text))
                {
                    SVMessageBox msgBox = new SVMessageBox();
                    msgBox.content(Resource.提示, Resource.模板名称不能为空);
                    msgBox.Show();

                    return;
                }

                String file = Path.Combine(SVProData.TemplatePath, textBox.Text);
                if (File.Exists(file))
                {
                    SVMessageBox msgBox = new SVMessageBox();
                    msgBox.content(Resource.提示, Resource.模板已经存在);
                    msgBox.Show();

                    return;
                }

                TemplateFile      = file;
                this.DialogResult = System.Windows.Forms.DialogResult.OK;
            });

            this.cancelBtn.Click += new EventHandler((sender, e) =>
            {
                this.DialogResult = System.Windows.Forms.DialogResult.No;
            });
        }
Пример #2
0
        /// <summary>
        /// 执行具体的移除分类操作
        /// </summary>
        /// <param oldName="sender"></param>
        /// <param oldName="e"></param>
        void removeClassItem_Click(object sender, EventArgs e)
        {
            ///如果当前没有选中分类节点,不做任何操作
            if (treeView.SelectedNode == null)
            {
                return;
            }

            ///如果当前分类不为空,不做任何操作
            if (!_pixmapManage.isEmptyClassfy(treeView.SelectedNode.Text))
            {
                SVMessageBox msgBox = new SVMessageBox();
                msgBox.content(Resource.提示, Resource.除图元分类);
                msgBox.ShowDialog();
                return;
            }

            _pixmapManage.removeClass(treeView.SelectedNode.Text);
            treeView.Nodes.Remove(treeView.SelectedNode);
            saveIconInfo();
        }
Пример #3
0
        public SVCreatePageForm()
        {
            InitializeComponent();

            //设置模板名称最大长度为32个字符
            this.textBox.MaxLength = 32;
            TemplatePath           = SVProData.TemplatePath;

            this.Shown += new EventHandler((sender, e) =>
            {
                ImageList imgList = new ImageList();
                imgList.Images.Add(Resource.page);
                listView.SmallImageList = imgList;

                DirectoryInfo TheFolder = new DirectoryInfo(TemplatePath);
                foreach (FileInfo NextFile in TheFolder.GetFiles())
                {
                    String pix = Path.GetExtension(NextFile.Name);
                    if (Path.GetExtension(NextFile.Name) == ".jpg")
                    {
                        continue;
                    }

                    ListViewItem item = this.listView.Items.Add(NextFile.Name);
                    item.ImageIndex   = 0;
                }
            });

            //this.textBox.KeyPress += new KeyPressEventHandler((sender, e)=>
            //{
            //    if (e.KeyChar == '\b')
            //        return;

            //    String _iconList = this.textBox.Text + e.KeyChar;
            //    if (!Regex.IsMatch(_iconList, "^[_a-zA-Z][_a-zA-Z0-9]*$"))
            //        e.Handled = true;
            //    else
            //        e.Handled = false;
            //});

            this.okBtn.Click += new EventHandler((sender, e) =>
            {
                PageName = this.textBox.Text.Trim();
                if (PageName == String.Empty)
                {
                    SVMessageBox msgBox = new SVMessageBox();
                    msgBox.content(" ", Resource.页面名称为空);
                    msgBox.Show();
                    return;
                }

                foreach (ListViewItem item in this.listView.SelectedItems)
                {
                    TemplateName = item.Text;
                }

                if (IsTempate && TemplateName == null)
                {
                    SVMessageBox msgBox = new SVMessageBox();
                    msgBox.content(" ", Resource.需要选择模板);
                    msgBox.Show();
                    return;
                }

                this.DialogResult = System.Windows.Forms.DialogResult.OK;
            });

            this.cancelBtn.Click += new EventHandler((sender, e) =>
            {
                this.DialogResult = System.Windows.Forms.DialogResult.No;
            });

            this.tempRadioBtn.CheckedChanged += new EventHandler((sender, e) =>
            {
                this.listView.Enabled = true;
                this.pictureBox.Show();
                IsTempate = true;
            });

            this.spaceRadioBtn.CheckedChanged += new EventHandler((sender, e) =>
            {
                this.listView.Enabled = false;
                this.pictureBox.Hide();
                IsTempate = false;
            });

            this.listView.SelectedIndexChanged += new EventHandler((sender, e) =>
            {
                foreach (ListViewItem item in this.listView.SelectedItems)
                {
                    String picFile = Path.Combine(TemplatePath, item.Text + ".jpg");
                    if (!File.Exists(picFile))
                    {
                        continue;
                    }

                    Image srcImg             = Image.FromFile(picFile);
                    this.pictureBox.SizeMode = PictureBoxSizeMode.Zoom;
                    this.pictureBox.Image    = srcImg;

                    //Bitmap img = new Bitmap(this.pictureBox.Width, this.pictureBox.Height);
                    //img.SetResolution(img.HorizontalResolution, img.VerticalResolution);

                    //Graphics grPhoto = Graphics.FromImage(img);
                    //grPhoto.CompositingMode = CompositingMode.SourceCopy;
                    //grPhoto.CompositingQuality = CompositingQuality.HighQuality;
                    //grPhoto.InterpolationMode = InterpolationMode.HighQualityBicubic;
                    //grPhoto.SmoothingMode = SmoothingMode.HighQuality;
                    //grPhoto.PixelOffsetMode = PixelOffsetMode.HighQuality;

                    //grPhoto.DrawImage(srcImg, new Rectangle(0, 0, pictureBox.Width, pictureBox.Height), new Rectangle(0, 0, srcImg.Width, srcImg.Height), GraphicsUnit.Pixel);
                }
            });
        }