Exemplo n.º 1
0
        private void müzikVideoToolStripMenuItem_Click(object sender, EventArgs e)
        {
            OpenFileDialog ofd_ac = new OpenFileDialog();

            ofd_ac.Title = "Müzik/Video Dosyası Aç";
            if (ofd_ac.ShowDialog() == DialogResult.OK)
            {
                try
                {
                    AxWMPLib.AxWindowsMediaPlayer ax_ac = new AxWMPLib.AxWindowsMediaPlayer();
                    this.Controls.Add(ax_ac);
                    ax_ac.BringToFront();
                    ax_ac.URL = ofd_ac.FileName;
                    ax_ac.Ctlcontrols.play();
                    ax_ac.Dock = DockStyle.Fill;
                    (this.Parent as Telerik.WinControls.UI.RadPageViewPage).ToolTipText = ofd_ac.FileName;

                    if (ofd_ac.FileName.Length >= 20)
                    {
                        (this.Parent as Control).Text = ofd_ac.FileName.Substring(0, 20) + "...";
                    }
                    else
                    {
                        (this.Parent as Control).Text = ofd_ac.FileName;
                    }
                    (this.Parent.Parent as Telerik.WinControls.UI.RadPageView).ControlRemoved += new ControlEventHandler((sender2, e2) => Usr_sayfa_ControlRemoved(sender2, e2, ax_ac, (this.Parent as Telerik.WinControls.UI.RadPageViewPage)));
                }
                catch
                {
                    MessageBox.Show("Bu Dosya Türü Desteklenmiyor.", "Uyarı", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
        }
Exemplo n.º 2
0
        private void btn_dosyaAc_Click(object sender, EventArgs e)
        {
            OpenFileDialog ofd_ac = new OpenFileDialog();

            if (ofd_ac.ShowDialog() == DialogResult.OK)
            {
                bool resimMi = false;
                bool videoMu = false;
                try
                {
                    string dosyaTuru = Path.GetExtension(ofd_ac.FileName);
                    for (int i = 0; i < resimDosyalari.Length; i++)
                    {
                        if (dosyaTuru.ToLower() == "." + resimDosyalari[i].ToLower())
                        {
                            resimMi = true;
                            break;
                        }
                    }

                    if (!resimMi)
                    {
                        for (int i = 0; i < videoDosyalari.Length; i++)
                        {
                            if (dosyaTuru.ToLower() == videoDosyalari[i].ToLower())
                            {
                                videoMu = true;
                                break;
                            }
                        }
                    }

                    if (resimMi)
                    {
                        PictureBox pcr_ac = new PictureBox();

                        pcr_ac.ImageLocation = ofd_ac.FileName;
                        pcr_ac.SizeMode      = PictureBoxSizeMode.AutoSize;
                        pcr_ac.InitialImage  = null;
                        pcr_ac.Cursor        = Cursors.Hand;
                        this.AutoScroll      = true;

                        for (int i = 0; i < this.Controls.Count; i++)
                        {
                            this.Controls[i].Hide();
                        }

                        this.Controls.Add(pcr_ac);
                        pcr_ac.BringToFront();
                        (this.Parent as Telerik.WinControls.UI.RadPageViewPage).ToolTipText = ofd_ac.FileName;

                        if (ofd_ac.FileName.Length >= 20)
                        {
                            (this.Parent as Control).Text = ofd_ac.FileName.Substring(0, 20) + "...";
                        }
                        else
                        {
                            (this.Parent as Control).Text = ofd_ac.FileName;
                        }
                        pcr_ac.DoubleClick += delegate
                        {
                            if (pcr_ac.SizeMode == PictureBoxSizeMode.AutoSize)
                            {
                                pcr_ac.SizeMode = PictureBoxSizeMode.StretchImage;
                                pcr_ac.Dock     = DockStyle.Fill;
                            }
                            else
                            {
                                pcr_ac.SizeMode = PictureBoxSizeMode.AutoSize;
                                pcr_ac.Dock     = DockStyle.None;
                            }
                        };
                    }
                    else if (videoMu)
                    {
                        try
                        {
                            AxWMPLib.AxWindowsMediaPlayer ax_ac = new AxWMPLib.AxWindowsMediaPlayer();
                            this.Controls.Add(ax_ac);
                            ax_ac.BringToFront();
                            ax_ac.URL = ofd_ac.FileName;
                            ax_ac.Ctlcontrols.play();
                            ax_ac.Dock = DockStyle.Fill;
                            (this.Parent as Telerik.WinControls.UI.RadPageViewPage).ToolTipText = ofd_ac.FileName;

                            if (ofd_ac.FileName.Length >= 20)
                            {
                                (this.Parent as Control).Text = ofd_ac.FileName.Substring(0, 20) + "...";
                            }
                            else
                            {
                                (this.Parent as Control).Text = ofd_ac.FileName;
                            }
                            (this.Parent.Parent as Telerik.WinControls.UI.RadPageView).ControlRemoved += new ControlEventHandler((sender2, e2) => Usr_sayfa_ControlRemoved(sender2, e2, ax_ac, (this.Parent as Telerik.WinControls.UI.RadPageViewPage)));
                        }
                        catch
                        {
                            MessageBox.Show("Bu Dosya Türü Desteklenmiyor.", "Uyarı", MessageBoxButtons.OK, MessageBoxIcon.Error);
                        }
                    }
                    else
                    {
                        p = Process.Start(ofd_ac.FileName);
                        p.StartInfo.RedirectStandardOutput = true;
                        p.StartInfo.RedirectStandardInput  = true;
                        p.StartInfo.UseShellExecute        = true;
                        p.StartInfo.CreateNoWindow         = true;
                        p.StartInfo.WindowStyle            = ProcessWindowStyle.Maximized;
                        p.WaitForInputIdle();
                        SetParent(p.MainWindowHandle, this.Handle);
                        if (p.MainWindowHandle == (IntPtr)0)
                        {
                            throw null;
                        }
                        try
                        {
                            SetWindowLong(p.MainWindowHandle, GWL_STYLE, WS_VISIBLE);
                        }
                        catch { }
                        MoveWindow(p.MainWindowHandle, 0, 0, this.Width, this.Height, true);
                        (this.Parent as Telerik.WinControls.UI.RadPageViewPage).ToolTipText = p.MainWindowTitle;
                        if (p.MainWindowTitle.Length >= 20)
                        {
                            (this.Parent as Control).Text = p.MainWindowTitle.Substring(0, 20) + "...";
                        }
                        else
                        {
                            (this.Parent as Control).Text = p.MainWindowTitle;
                        }
                    }
                }
                catch
                {
                    try
                    {
                        p.Kill();
                    }
                    catch { }
                    MessageBox.Show("Bu Dosya Türü Desteklenmiyor.", "Uyarı", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
        }