コード例 #1
0
ファイル: Form1.cs プロジェクト: gokudo-graves/LSLEditor
        private void UploadScript()
        {
            //ShowWebBrowser("Upload", this.numberedTextBoxUC1.TextBox.UploadUrl);

            ArrayList pictures       = new ArrayList();
            Size      oldSize        = this.Size;
            int       intSelectedTab = this.tabControl1.SelectedIndex;

            this.Size = new Size(640, 480);

            Bitmap bitmap;

            ImageManipulation.GetBitmapFromControl helper = new ImageManipulation.GetBitmapFromControl();

            this.tabControl1.SelectedIndex = 0;
            bitmap = helper.GetOctreeQuantizedBitmap(this, false);
            string strTempFileName = Path.GetTempFileName() + ".gif";

            bitmap.Save(strTempFileName, ImageFormat.Gif);
            pictures.Add(strTempFileName);

            for (int intI = 1; intI < this.tabControl1.TabPages.Count; intI++)
            {
                if (this.tabControl1.TabPages[intI].Text.Contains("Compiler"))
                {
                    this.tabControl1.SelectedIndex = intI;
                    bitmap          = helper.GetOctreeQuantizedBitmap(this, false);
                    strTempFileName = Path.GetTempFileName() + ".gif";
                    bitmap.Save(strTempFileName, ImageFormat.Gif);
                    pictures.Add(strTempFileName);
                    break;
                }
            }
            this.tabControl1.SelectedIndex = intSelectedTab;
            this.Size = oldSize;

            UploadExamle u = new UploadExamle(
                Path.GetFileName(this.saveFileDialog1.FileName),
                this.numberedTextBoxUC1.TextBox.UploadUrl,
                this.numberedTextBoxUC1.TextBox.Text,
                pictures);

            u.ShowDialog(this);

            // cleanup
            foreach (string strFileName in pictures)
            {
                File.Delete(strFileName);
            }
        }
コード例 #2
0
ファイル: Form1.cs プロジェクト: gokudo-graves/LSLEditor
        void axWebBrowser1_DocumentCompleted(object sender, WebBrowserDocumentCompletedEventArgs e)
        {
            WebBrowser axWebBrowser1 = sender as WebBrowser;

            if (e.Url.ToString() == this.numberedTextBoxUC1.TextBox.UploadUrl)
            {
                HtmlElement element = axWebBrowser1.Document.GetElementById("SourceCode");
                if (element != null)
                {
                    //if(element.InnerText.Trim()=="")
                    element.InnerText = this.numberedTextBoxUC1.TextBox.Text;

                    // Makepictures
                    Size oldSize = this.Size;
                    this.Size = new Size(640, 480);

                    Bitmap bitmap;
                    ImageManipulation.GetBitmapFromControl helper = new ImageManipulation.GetBitmapFromControl();

                    this.tabControl1.SelectedIndex = 0;
                    bitmap = helper.GetOctreeQuantizedBitmap(this, false);
                    bitmap.Save(@"d:\temp\test1.gif", ImageFormat.Gif);

                    element = axWebBrowser1.Document.GetElementById("File1");
                    if (element != null)
                    {
                        element.SetAttribute("value", @"d:\temp\test1.gif");
                        element.OuterHtml = @"<input name=""File1"" type=""file"" id=""File1"" size=""80"" value=""test""/>";
                    }

                    if (this.tabControl1.TabPages[1].Text.Contains("Compiler"))
                    {
                        this.tabControl1.SelectedIndex = 1;
                        bitmap = helper.GetOctreeQuantizedBitmap(this, false);
                        bitmap.Save(@"d:\temp\test2.gif", ImageFormat.Gif);

                        element = axWebBrowser1.Document.GetElementById("File2");
                        if (element != null)
                        {
                            element.SetAttribute("value", @"d:\temp\test2.gif");
                        }
                    }

                    this.tabControl1.SelectedIndex = this.tabControl1.TabPages.Count - 1;
                    this.Size = oldSize;
                }
            }
        }