示例#1
0
        private void btnLoad_Click(object sender, EventArgs e)
        {
            if (m_svgFile == null)
            {
                m_svgFile = new svgFile();
            }
            OpenFileDialog dlg = new OpenFileDialog();

            dlg.Filter      = "SVG files (*.svg)|*.svg|All files (*.*)|*.*";
            dlg.FilterIndex = 1;
            DialogResult result = dlg.ShowDialog();

            if (result == DialogResult.OK)
            {
                m_strCurrentFilePath = dlg.FileName;
                m_svgFile.Load(m_strCurrentFilePath);
                UpdateDescription();
                this.Refresh();
                timer1.Enabled       = false;
                m_strCurrentFilePath = dlg.FileName;
                //we want to monitor the file for changes
                String strPathToWatch = new FileInfo(m_strCurrentFilePath).Directory.FullName;
                CreateFileWatcher(strPathToWatch);
            }
        }
示例#2
0
        private void btnExport_Click(object sender, EventArgs e)
        {
            svgFile svgFile = new svgFile();

            svgFile.Load(m_strSVGFilePath);
            if (exportSheet.Checked)
            {
                if (svgFile.WriteToSheet(sheetFilePath.Text, Convert.ToInt32(sheetRows.Text), Convert.ToInt32(sheetCols.Text), Convert.ToInt32(sheetPadding.Text)))
                {
                    string            message = "Sprite sheet exported successfully";
                    string            caption = "Export SVG";
                    MessageBoxButtons buttons = MessageBoxButtons.OK;
                    MessageBox.Show(message, caption, buttons);
                    this.Close();
                }
            }
            else if (exportAsPNG.Checked)
            {
                if (pngOutputPath.Text.Substring(pngOutputPath.Text.Length - 1) != "\\")
                {
                    pngOutputPath.Text += "\\";
                }
                if (svgFile.WriteToPNGs(fileNamePrefix.Text, pngOutputPath.Text))
                {
                    string            message = "PNG files exported successfully";
                    string            caption = "Export SVG";
                    MessageBoxButtons buttons = MessageBoxButtons.OK;
                    MessageBox.Show(message, caption, buttons);
                    this.Close();
                }
            }
            else if (exportAsGif.Checked)
            {
                if (svgFile.WriteToGif(gifFilePath.Text))
                {
                    string            message = "Animated GIF exported successfully";
                    string            caption = "Export SVG";
                    MessageBoxButtons buttons = MessageBoxButtons.OK;
                    MessageBox.Show(message, caption, buttons);
                    this.Close();
                }
            }
        }