public FormDDSTGAPreviewRenderSurface(FormDDSTGARenderFrame Parent)
 {
     InitializeComponent();
     this.SetStyle(ControlStyles.AllPaintingInWmPaint | ControlStyles.Opaque, true);
     this.FormBorderStyle   = FormBorderStyle.None;
     this.TopLevel          = false;
     this.m_FormRenderFrame = Parent;
 }
 public FormDDSTGAPreviewRenderSurface(FormDDSTGARenderFrame Parent)
 {
     InitializeComponent();
       this.SetStyle(ControlStyles.AllPaintingInWmPaint | ControlStyles.Opaque, true);
       this.FormBorderStyle = FormBorderStyle.None;
       this.TopLevel = false;
       this.m_FormRenderFrame = Parent;
 }
Beispiel #3
0
        private void PreviewDDS(DataRow dataRow)
        {
            HidePreviewControls();
            try
            {
                Byte[] buffer = Utilities.InflateFile(dataRow);
                if ((buffer != null) && (buffer.Length > 0))
                {
                    String Name = (String)dataRow["Name"];

                    String path = Path.Combine(Path.GetTempPath(), Name.Replace("/", "\\").Substring(0, Name.LastIndexOf("/")));
                    String file = Name.Substring(Name.LastIndexOf("/") + 1);
                    String filename = Path.Combine(path, file);

                    if (!File.Exists(filename))
                    {
                        try
                        {
                            Directory.CreateDirectory(path);
                        }
                        catch
                        {
                        }

                        FileStream fileStream = new FileStream(filename, FileMode.Create, FileAccess.Write, FileShare.None);
                        fileStream.Write(buffer, 0, buffer.Length);
                        fileStream.Close();
                        this.m_FormNotifyIcon.m_TemporaryFiles.Add(filename);
                        this.m_FormNotifyIcon.m_TemporaryPaths.Add(path);
                    }

                    try
                    {
                        this.m_FormDDSTGARenderFrame = new FormDDSTGARenderFrame(filename, this.m_FormNotifyIcon);
                        this.m_FormDDSTGARenderFrame.VisibleChanged += new EventHandler(formRenderFrame_VisibleChanged);
                        this.m_FormDDSTGARenderFrame.TopLevel = false;
                        this.m_FormDDSTGARenderFrame.FormBorderStyle = FormBorderStyle.None;
                        this.m_FormDDSTGARenderFrame.Dock = DockStyle.Fill;
                        this.panelPreviewBackground.Controls.Add(m_FormDDSTGARenderFrame);
                        this.m_FormDDSTGARenderFrame.Show();
                        this.m_FormDDSTGARenderFrame.BringToFront();
                    }
                    catch
                    {
                        throw;
                    }
                }
            }
            catch
            {
                HidePreviewControls();
            }
        }