Exemple #1
0
        private void button3_Click(object sender, EventArgs e)
        {
            if (!m_bImageSupport)
            {
                return;
            }
            //textBox.TextChanged -= new System.EventHandler(this.richTextBox2_TextChanged);
            string filename = FileFolderHelper.BrowserFile(new string[] { "tga", "uitex" });

            if (filename == string.Empty)
            {
                return;
            }
            ImageDialog dlg     = new ImageDialog(filename);
            int         nFrame  = 0;
            int         nWidth  = 0;
            int         nHeight = 0;

            if (dlg.ShowDialog() == DialogResult.OK)
            {
                if (dlg.strFrame != string.Empty)
                {
                    nFrame = Int32.Parse(dlg.strFrame);
                }
                if (dlg.strWidth != string.Empty)
                {
                    nWidth = Int32.Parse(dlg.strWidth);
                }
                if (dlg.strHeight != string.Empty)
                {
                    nHeight = Int32.Parse(dlg.strHeight);
                }
            }

            string retRTF = RTFHelper.GetRTFFromTgaFile(filename, textBox, nFrame);

            textBox.SelectedRtf = retRTF;

            MarkArray[textBox.SelectionStart - 1] = ImageArray.Count + ImageMark;
            filename = filename.Substring(m_Root.Length, filename.Length - m_Root.Length);

            string strW = string.Empty;
            string strH = string.Empty;

            if (nWidth != 0)
            {
                strW = widthMark + nWidth.ToString();
            }
            if (nHeight != 0)
            {
                strH = heightMark + nHeight.ToString();
            }

            string strImageMark = imageMark + filename + frameMark + nFrame.ToString() + strW + strH + frameEndMark;

            ImageArray.Add(strImageMark);
            //textBox.TextChanged += new System.EventHandler(this.richTextBox2_TextChanged);
        }
Exemple #2
0
        private void button3_Click(object sender, EventArgs e)
        {
            if (!m_bImageSupport)
            {
                return;
            }
            //textBox.TextChanged -= new System.EventHandler(this.richTextBox2_TextChanged);
            string filename = FileFolderHelper.BrowserFile(new string[] { "tga", "uitex" });
            if (filename == string.Empty)
                return;
            ImageDialog dlg = new ImageDialog(filename);
            int nFrame = 0;
            int nWidth = 0;
            int nHeight = 0;
            if (dlg.ShowDialog() == DialogResult.OK)
            {
                if (dlg.strFrame != string.Empty)
                {
                    nFrame = Int32.Parse(dlg.strFrame);
                }
                if (dlg.strWidth != string.Empty)
                {
                    nWidth = Int32.Parse(dlg.strWidth);
                }
                if (dlg.strHeight != string.Empty)
                {
                    nHeight = Int32.Parse(dlg.strHeight);
                }
            }

            string retRTF = RTFHelper.GetRTFFromTgaFile(filename, textBox, nFrame);
            textBox.SelectedRtf = retRTF;

            MarkArray[textBox.SelectionStart - 1] = ImageArray.Count + ImageMark;
            filename = filename.Substring(m_Root.Length, filename.Length - m_Root.Length);

            string strW = string.Empty;
            string strH = string.Empty;

            if (nWidth != 0)
            {
                strW = widthMark + nWidth.ToString();
            }
            if (nHeight != 0)
            {
                strH = heightMark + nHeight.ToString();
            }

            string strImageMark = imageMark + filename + frameMark + nFrame.ToString() + strW + strH + frameEndMark;
            ImageArray.Add(strImageMark);
            //textBox.TextChanged += new System.EventHandler(this.richTextBox2_TextChanged);
        }