From 0ca3590be75167b95c8974cd7103dd9be5c30ed1 Mon Sep 17 00:00:00 2001 From: Alexander Seeliger Date: Fri, 16 Feb 2024 18:57:37 +0100 Subject: [PATCH] feat(preview): remove windows media player component --- src/SmartPreview/SmartPreview.csproj | 3 +- src/SmartPreview/frmSmartPreview.cs | 499 ++++++++++--------- src/SmartPreview/frmSmartPreview.designer.cs | 269 +++++----- src/SmartPreview/frmSmartPreview.resx | 61 +-- 4 files changed, 408 insertions(+), 424 deletions(-) diff --git a/src/SmartPreview/SmartPreview.csproj b/src/SmartPreview/SmartPreview.csproj index 3d7fb28..fccdab7 100644 --- a/src/SmartPreview/SmartPreview.csproj +++ b/src/SmartPreview/SmartPreview.csproj @@ -12,6 +12,7 @@ false true true + true true x64 Debug;Release @@ -46,7 +47,6 @@ - @@ -64,7 +64,6 @@ - diff --git a/src/SmartPreview/frmSmartPreview.cs b/src/SmartPreview/frmSmartPreview.cs index 5304a18..43df4a1 100644 --- a/src/SmartPreview/frmSmartPreview.cs +++ b/src/SmartPreview/frmSmartPreview.cs @@ -12,295 +12,310 @@ // See the License for the specific language governing permissions and // limitations under the License. -using Humanizer; using System; using System.Drawing; using System.Windows.Forms; +using System.Windows.Forms.Integration; +using Humanizer; using static Brightbits.BSH.Engine.Win32Stuff; -namespace SmartPreview +namespace SmartPreview; + +public partial class frmSmartPreview { - public partial class frmSmartPreview + private ElementHost elementHost; + private System.Windows.Controls.MediaElement mediaPlayer; + + public void InitMediaPlayer() { - private void lblClose_Click(object sender, EventArgs e) - { - phhcMain.Unload(); - phhcMain.Dispose(); - Close(); - Dispose(); - } + elementHost = new ElementHost(); + elementHost.Dock = DockStyle.Fill; + elementHost.Visible = false; + + plContent.Controls.Add(elementHost); - private void frmSmartPreview_KeyUp(object sender, KeyEventArgs e) + mediaPlayer = new System.Windows.Controls.MediaElement(); + mediaPlayer.Focusable = true; + mediaPlayer.KeyDown += MediaPlayer_KeyDown; + elementHost.Child = mediaPlayer; + } + + private void MediaPlayer_KeyDown(object sender, System.Windows.Input.KeyEventArgs e) + { + if (e.Key == System.Windows.Input.Key.Space) { - if (e.KeyCode == Keys.Space) + if (e.KeyboardDevice.Modifiers == System.Windows.Input.ModifierKeys.Shift) { - if (e.Shift) - { - lblMax_Click(sender, null); - } - else - { - lblClose_Click(sender, null); - } - - e.SuppressKeyPress = false; + lblMax_Click(sender, null); + } + else + { + lblClose_Click(sender, null); } } + } - public void lblMax_Click(object sender, EventArgs e) + private void lblClose_Click(object sender, EventArgs e) + { + phhcMain.Unload(); + phhcMain.Dispose(); + Close(); + Dispose(); + } + + private void frmSmartPreview_KeyUp(object sender, KeyEventArgs e) + { + if (e.KeyCode == Keys.Space) { - if (WindowState == FormWindowState.Maximized) + if (e.Shift) { - FormBorderStyle = FormBorderStyle.Sizable; - WindowState = FormWindowState.Normal; - TopMost = false; - plContent.BackColor = Color.FromArgb(64, 64, 64); - Panel1.BackColor = Color.FromArgb(64, 64, 64); - lblMax.Text = "1"; + lblMax_Click(sender, null); } else { - TopMost = true; - FormBorderStyle = FormBorderStyle.None; - WindowState = FormWindowState.Maximized; - plContent.BackColor = Color.Black; - Panel1.BackColor = Color.Black; - lblMax.Text = "2"; + lblClose_Click(sender, null); } + + e.SuppressKeyPress = false; } + } - public bool ShowPreview(string fileName, bool showFailed = false) + public void lblMax_Click(object sender, EventArgs e) + { + if (WindowState == FormWindowState.Maximized) { - try - { - string fileExt = System.IO.Path.GetExtension(fileName).ToLower(); - - switch (fileExt ?? "") - { - // pictures - case ".jpg": - case ".gif": - case ".bmp": - case ".png": - case ".jpeg": - case ".wmf": - { - var previewItem = new PictureBox(); - previewItem.Image = Image.FromFile(fileName); - if (previewItem.Image.Width > Width || previewItem.Height > Height) - { - previewItem.SizeMode = PictureBoxSizeMode.Zoom; - } - else - { - previewItem.SizeMode = PictureBoxSizeMode.CenterImage; - } + FormBorderStyle = FormBorderStyle.Sizable; + WindowState = FormWindowState.Normal; + TopMost = false; + plContent.BackColor = Color.FromArgb(64, 64, 64); + Panel1.BackColor = Color.FromArgb(64, 64, 64); + lblMax.Text = "1"; + } + else + { + TopMost = true; + FormBorderStyle = FormBorderStyle.None; + WindowState = FormWindowState.Maximized; + plContent.BackColor = Color.Black; + Panel1.BackColor = Color.Black; + lblMax.Text = "2"; + } + } - plContent.Controls.Add(previewItem); - previewItem.Dock = DockStyle.Fill; - break; - } + public bool ShowPreview(string fileName, bool showFailed = false) + { + try + { + string fileExt = System.IO.Path.GetExtension(fileName).ToLower(); - case ".psd": + switch (fileExt ?? "") + { + // pictures + case ".jpg": + case ".gif": + case ".bmp": + case ".png": + case ".jpeg": + case ".wmf": + { + var previewItem = new PictureBox(); + previewItem.Image = Image.FromFile(fileName); + if (previewItem.Image.Width > Width || previewItem.Height > Height) { - var previewItem = new PictureBox(); - var psd = new SimplePsd.CPSD(); - psd.Load(fileName); - previewItem.Image = Image.FromHbitmap(psd.GetHBitmap()); previewItem.SizeMode = PictureBoxSizeMode.Zoom; - plContent.Controls.Add(previewItem); - previewItem.Dock = DockStyle.Fill; - psd = null; - break; } - - // documents - case ".txt": - case ".rtf": - case ".ini": - case ".inf": + else { - var previewItem = new RichTextBox(); - previewItem.LoadFile(fileName, (fileExt == ".txt" || fileExt == ".ini" || fileExt == ".inf") ? RichTextBoxStreamType.PlainText : RichTextBoxStreamType.RichText); previewItem.ReadOnly = true; - previewItem.BackColor = Color.White; - plContent.Controls.Add(previewItem); - previewItem.Dock = DockStyle.Fill; - break; + previewItem.SizeMode = PictureBoxSizeMode.CenterImage; } - // websites etc. - case ".xml": - case ".xps": - case ".config": - case ".psq": - case ".htm": - case ".html": - { - var previewItem = new WebBrowser(); - previewItem.Navigate(fileName); - plContent.Controls.Add(previewItem); - previewItem.Dock = DockStyle.Fill; - previewItem.WebBrowserShortcutsEnabled = false; - break; - } + plContent.Controls.Add(previewItem); + previewItem.Dock = DockStyle.Fill; + break; + } - // video media - case ".avi": - case ".wmv": - case ".wma": - case ".mp3": - case ".mpg": - case ".mpeg": - case ".mp4": - case ".m4v": - case ".m4a": - { - wmp.Visible = true; - wmp.Dock = DockStyle.Fill; - wmp.URL = fileName; - wmp.Ctlcontrols.play(); + case ".psd": + { + var previewItem = new PictureBox(); + var psd = new SimplePsd.CPSD(); + psd.Load(fileName); + previewItem.Image = Image.FromHbitmap(psd.GetHBitmap()); + previewItem.SizeMode = PictureBoxSizeMode.Zoom; + plContent.Controls.Add(previewItem); + previewItem.Dock = DockStyle.Fill; + psd = null; + break; + } - break; - } + // documents + case ".txt": + case ".rtf": + case ".ini": + case ".inf": + { + var previewItem = new RichTextBox(); + previewItem.LoadFile(fileName, (fileExt == ".txt" || fileExt == ".ini" || fileExt == ".inf") ? RichTextBoxStreamType.PlainText : RichTextBoxStreamType.RichText); previewItem.ReadOnly = true; + previewItem.BackColor = Color.White; + plContent.Controls.Add(previewItem); + previewItem.Dock = DockStyle.Fill; + break; + } - // source code - case ".vb": - { - var previewItem = new WebBrowser(); - var code = new Manoli.Utils.CSharpFormat.VisualBasicFormat(); - string rdr = System.IO.File.ReadAllText(fileName); - previewItem.DocumentText = "\r\n" + code.FormatCode(rdr); - plContent.Controls.Add(previewItem); - previewItem.Dock = DockStyle.Fill; - previewItem.WebBrowserShortcutsEnabled = false; - break; - } + // websites etc. + case ".xml": + case ".xps": + case ".config": + case ".psq": + case ".htm": + case ".html": + { + var previewItem = new WebBrowser(); + previewItem.Navigate(fileName); + plContent.Controls.Add(previewItem); + previewItem.Dock = DockStyle.Fill; + previewItem.WebBrowserShortcutsEnabled = false; + break; + } - case ".cs": - { - var previewItem = new WebBrowser(); - var code = new Manoli.Utils.CSharpFormat.CSharpFormat(); - string rdr = System.IO.File.ReadAllText(fileName); - previewItem.DocumentText = "\r\n" + code.FormatCode(rdr); - plContent.Controls.Add(previewItem); - previewItem.Dock = DockStyle.Fill; - previewItem.WebBrowserShortcutsEnabled = false; - break; - } + // video media + case ".avi": + case ".wmv": + case ".wma": + case ".mp3": + case ".mpg": + case ".mpeg": + case ".mp4": + case ".m4v": + case ".m4a": + { + elementHost.Visible = true; + mediaPlayer.Source = new Uri(fileName); + mediaPlayer.Play(); + break; + } - case ".sql": - { - var previewItem = new WebBrowser(); - var code = new Manoli.Utils.CSharpFormat.TsqlFormat(); - string rdr = System.IO.File.ReadAllText(fileName); - previewItem.DocumentText = "\r\n" + code.FormatCode(rdr); - plContent.Controls.Add(previewItem); - previewItem.Dock = DockStyle.Fill; - previewItem.WebBrowserShortcutsEnabled = false; - break; - } + // source code + case ".vb": + { + var previewItem = new WebBrowser(); + var code = new Manoli.Utils.CSharpFormat.VisualBasicFormat(); + string rdr = System.IO.File.ReadAllText(fileName); + previewItem.DocumentText = "\r\n" + code.FormatCode(rdr); + plContent.Controls.Add(previewItem); + previewItem.Dock = DockStyle.Fill; + previewItem.WebBrowserShortcutsEnabled = false; + break; + } - case ".js": - { - var previewItem = new WebBrowser(); - var code = new Manoli.Utils.CSharpFormat.JavaScriptFormat(); - string rdr = System.IO.File.ReadAllText(fileName); - previewItem.DocumentText = "\r\n" + code.FormatCode(rdr); - plContent.Controls.Add(previewItem); - previewItem.Dock = DockStyle.Fill; - previewItem.WebBrowserShortcutsEnabled = false; - break; - } + case ".cs": + { + var previewItem = new WebBrowser(); + var code = new Manoli.Utils.CSharpFormat.CSharpFormat(); + string rdr = System.IO.File.ReadAllText(fileName); + previewItem.DocumentText = "\r\n" + code.FormatCode(rdr); + plContent.Controls.Add(previewItem); + previewItem.Dock = DockStyle.Fill; + previewItem.WebBrowserShortcutsEnabled = false; + break; + } + + case ".sql": + { + var previewItem = new WebBrowser(); + var code = new Manoli.Utils.CSharpFormat.TsqlFormat(); + string rdr = System.IO.File.ReadAllText(fileName); + previewItem.DocumentText = "\r\n" + code.FormatCode(rdr); + plContent.Controls.Add(previewItem); + previewItem.Dock = DockStyle.Fill; + previewItem.WebBrowserShortcutsEnabled = false; + break; + } - default: + case ".js": + { + var previewItem = new WebBrowser(); + var code = new Manoli.Utils.CSharpFormat.JavaScriptFormat(); + string rdr = System.IO.File.ReadAllText(fileName); + previewItem.DocumentText = "\r\n" + code.FormatCode(rdr); + plContent.Controls.Add(previewItem); + previewItem.Dock = DockStyle.Fill; + previewItem.WebBrowserShortcutsEnabled = false; + break; + } + + default: + { + try { - try + phhcMain.FilePath = fileName; + phhcMain.Dock = DockStyle.Fill; + phhcMain.Visible = true; + + if (!phhcMain.HasHandler) { - phhcMain.FilePath = fileName; - phhcMain.Dock = DockStyle.Fill; - phhcMain.Visible = true; + plFileDetails.Visible = true; + plFileDetails.Dock = DockStyle.Fill; + + // read file details + try + { + lblFileName.Text = System.IO.Path.GetFileName(fileName); + picIcon.Image = Icon.ExtractAssociatedIcon(fileName).ToBitmap(); + + // retrieve file type + var shFi = new SHFILEINFO(); + SHGetFileInfo(fileName, 0, out shFi, (uint)System.Runtime.InteropServices.Marshal.SizeOf(shFi), (uint)SHGFI.SHGFI_TYPENAME); + + lblFileType.Text = shFi.szTypeName; - if (!phhcMain.HasHandler) + // retrieve file info + var FileInfo = new System.IO.FileInfo(fileName); + Label TmpLabel; + + // creation date + TmpLabel = new Label(); + TmpLabel.AutoSize = true; + TmpLabel.Text = "Erstellt am: " + FileInfo.CreationTime.ToString("dd. MMM yyyy 'um' HH:mm"); + flpFileDetails.Controls.Add(TmpLabel); + TmpLabel.Dock = DockStyle.Fill; + + // last modified date + TmpLabel = new Label(); + TmpLabel.AutoSize = true; + TmpLabel.Text = "Geändert am: " + FileInfo.LastWriteTime.ToString("dd. MMM yyyy 'um' HH:mm"); + flpFileDetails.Controls.Add(TmpLabel); + TmpLabel.Dock = DockStyle.Fill; + + // file size + TmpLabel = new Label(); + TmpLabel.AutoSize = true; + TmpLabel.Text = "Größe: " + FileInfo.Length.Bytes().Humanize(); + flpFileDetails.Controls.Add(TmpLabel); + TmpLabel.Dock = DockStyle.Fill; + } + catch { - plFileDetails.Visible = true; - plFileDetails.Dock = DockStyle.Fill; - - // read file details - try - { - lblFileName.Text = System.IO.Path.GetFileName(fileName); - picIcon.Image = Icon.ExtractAssociatedIcon(fileName).ToBitmap(); - - // retrieve file type - var shFi = new SHFILEINFO(); - SHGetFileInfo(fileName, 0, out shFi, (uint)System.Runtime.InteropServices.Marshal.SizeOf(shFi), (uint)SHGFI.SHGFI_TYPENAME); - - lblFileType.Text = shFi.szTypeName; - - // retrieve file info - var FileInfo = new System.IO.FileInfo(fileName); - Label TmpLabel; - - // creation date - TmpLabel = new Label(); - TmpLabel.AutoSize = true; - TmpLabel.Text = "Erstellt am: " + FileInfo.CreationTime.ToString("dd. MMM yyyy 'um' HH:mm"); - flpFileDetails.Controls.Add(TmpLabel); - TmpLabel.Dock = DockStyle.Fill; - - // last modified date - TmpLabel = new Label(); - TmpLabel.AutoSize = true; - TmpLabel.Text = "Geändert am: " + FileInfo.LastWriteTime.ToString("dd. MMM yyyy 'um' HH:mm"); - flpFileDetails.Controls.Add(TmpLabel); - TmpLabel.Dock = DockStyle.Fill; - - // file size - TmpLabel = new Label(); - TmpLabel.AutoSize = true; - TmpLabel.Text = "Größe: " + FileInfo.Length.Bytes().Humanize(); - flpFileDetails.Controls.Add(TmpLabel); - TmpLabel.Dock = DockStyle.Fill; - } - catch - { - // ignore error - } - - Height = 480; - return default; + // ignore error } - } - catch - { - // ignore error - } - break; + Height = 480; + return default; + } + } + catch + { + // ignore error } - } - } - catch - { - // ignore error - } - return default; + break; + } + } } - - private void wmp_PreviewKeyDown(object sender, PreviewKeyDownEventArgs e) + catch { - if (e.KeyCode == Keys.Space) - { - if (e.Shift) - { - lblMax_Click(sender, null); - } - else - { - lblClose_Click(sender, null); - } - } + // ignore error } + + return default; } } \ No newline at end of file diff --git a/src/SmartPreview/frmSmartPreview.designer.cs b/src/SmartPreview/frmSmartPreview.designer.cs index a62fc2a..82167b8 100644 --- a/src/SmartPreview/frmSmartPreview.designer.cs +++ b/src/SmartPreview/frmSmartPreview.designer.cs @@ -29,182 +29,163 @@ protected override void Dispose(bool disposing) [DebuggerStepThrough()] private void InitializeComponent() { - System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(frmSmartPreview)); - this.Panel1 = new System.Windows.Forms.Panel(); - this.lblMax = new System.Windows.Forms.Label(); - this.lblClose = new System.Windows.Forms.Label(); - this.plContent = new System.Windows.Forms.Panel(); - this.plFileDetails = new System.Windows.Forms.Panel(); - this.flpFileDetails = new System.Windows.Forms.FlowLayoutPanel(); - this.lblFileType = new System.Windows.Forms.Label(); - this.lblFileName = new System.Windows.Forms.Label(); - this.picIcon = new System.Windows.Forms.PictureBox(); - this.phhcMain = new C4F.DevKit.PreviewHandler.PreviewHandlerHost.PreviewHandlerHostControl(); - this.wmp = new AxWMPLib.AxWindowsMediaPlayer(); - this.Panel1.SuspendLayout(); - this.plContent.SuspendLayout(); - this.plFileDetails.SuspendLayout(); - ((System.ComponentModel.ISupportInitialize)(this.picIcon)).BeginInit(); - ((System.ComponentModel.ISupportInitialize)(this.wmp)).BeginInit(); - this.SuspendLayout(); + Panel1 = new Panel(); + lblMax = new Label(); + lblClose = new Label(); + plContent = new Panel(); + plFileDetails = new Panel(); + flpFileDetails = new FlowLayoutPanel(); + lblFileType = new Label(); + lblFileName = new Label(); + picIcon = new PictureBox(); + phhcMain = new C4F.DevKit.PreviewHandler.PreviewHandlerHost.PreviewHandlerHostControl(); + Panel1.SuspendLayout(); + plContent.SuspendLayout(); + plFileDetails.SuspendLayout(); + ((System.ComponentModel.ISupportInitialize)picIcon).BeginInit(); + SuspendLayout(); // // Panel1 // - this.Panel1.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(64)))), ((int)(((byte)(64))))); - this.Panel1.Controls.Add(this.lblMax); - this.Panel1.Controls.Add(this.lblClose); - this.Panel1.Dock = System.Windows.Forms.DockStyle.Bottom; - this.Panel1.Location = new System.Drawing.Point(0, 746); - this.Panel1.Name = "Panel1"; - this.Panel1.Size = new System.Drawing.Size(803, 69); - this.Panel1.TabIndex = 1; + Panel1.BackColor = Color.FromArgb(64, 64, 64); + Panel1.Controls.Add(lblMax); + Panel1.Controls.Add(lblClose); + Panel1.Dock = DockStyle.Bottom; + Panel1.Location = new Point(0, 746); + Panel1.Name = "Panel1"; + Panel1.Size = new Size(803, 69); + Panel1.TabIndex = 1; // // lblMax // - this.lblMax.Anchor = System.Windows.Forms.AnchorStyles.Top; - this.lblMax.AutoSize = true; - this.lblMax.Cursor = System.Windows.Forms.Cursors.Hand; - this.lblMax.Font = new System.Drawing.Font("Marlett", 21.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(2))); - this.lblMax.ForeColor = System.Drawing.Color.White; - this.lblMax.Location = new System.Drawing.Point(355, 11); - this.lblMax.Name = "lblMax"; - this.lblMax.Size = new System.Drawing.Size(64, 44); - this.lblMax.TabIndex = 1; - this.lblMax.Text = "1"; - this.lblMax.Click += new System.EventHandler(this.lblMax_Click); + lblMax.Anchor = AnchorStyles.Top; + lblMax.AutoSize = true; + lblMax.Cursor = Cursors.Hand; + lblMax.Font = new Font("Marlett", 21.75F, FontStyle.Bold, GraphicsUnit.Point, 2); + lblMax.ForeColor = Color.White; + lblMax.Location = new Point(355, 11); + lblMax.Name = "lblMax"; + lblMax.Size = new Size(64, 44); + lblMax.TabIndex = 1; + lblMax.Text = "1"; + lblMax.Click += lblMax_Click; // // lblClose // - this.lblClose.Anchor = System.Windows.Forms.AnchorStyles.Top; - this.lblClose.AutoSize = true; - this.lblClose.Cursor = System.Windows.Forms.Cursors.Hand; - this.lblClose.Font = new System.Drawing.Font("Marlett", 21.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(2))); - this.lblClose.ForeColor = System.Drawing.Color.White; - this.lblClose.Location = new System.Drawing.Point(404, 11); - this.lblClose.Name = "lblClose"; - this.lblClose.Size = new System.Drawing.Size(64, 44); - this.lblClose.TabIndex = 0; - this.lblClose.Text = "r"; - this.lblClose.Click += new System.EventHandler(this.lblClose_Click); + lblClose.Anchor = AnchorStyles.Top; + lblClose.AutoSize = true; + lblClose.Cursor = Cursors.Hand; + lblClose.Font = new Font("Marlett", 21.75F, FontStyle.Bold, GraphicsUnit.Point, 2); + lblClose.ForeColor = Color.White; + lblClose.Location = new Point(404, 11); + lblClose.Name = "lblClose"; + lblClose.Size = new Size(64, 44); + lblClose.TabIndex = 0; + lblClose.Text = "r"; + lblClose.Click += lblClose_Click; // // plContent // - this.plContent.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(64)))), ((int)(((byte)(64))))); - this.plContent.Controls.Add(this.plFileDetails); - this.plContent.Controls.Add(this.phhcMain); - this.plContent.Controls.Add(this.wmp); - this.plContent.Dock = System.Windows.Forms.DockStyle.Fill; - this.plContent.Location = new System.Drawing.Point(0, 0); - this.plContent.Name = "plContent"; - this.plContent.Size = new System.Drawing.Size(803, 746); - this.plContent.TabIndex = 2; + plContent.BackColor = Color.FromArgb(64, 64, 64); + plContent.Controls.Add(plFileDetails); + plContent.Controls.Add(phhcMain); + plContent.Dock = DockStyle.Fill; + plContent.Location = new Point(0, 0); + plContent.Name = "plContent"; + plContent.Size = new Size(803, 746); + plContent.TabIndex = 2; // // plFileDetails // - this.plFileDetails.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(64)))), ((int)(((byte)(64))))); - this.plFileDetails.Controls.Add(this.flpFileDetails); - this.plFileDetails.Controls.Add(this.lblFileType); - this.plFileDetails.Controls.Add(this.lblFileName); - this.plFileDetails.Controls.Add(this.picIcon); - this.plFileDetails.Font = new System.Drawing.Font("Calibri", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.plFileDetails.ForeColor = System.Drawing.Color.White; - this.plFileDetails.Location = new System.Drawing.Point(12, 12); - this.plFileDetails.Name = "plFileDetails"; - this.plFileDetails.Size = new System.Drawing.Size(595, 395); - this.plFileDetails.TabIndex = 2; - this.plFileDetails.Visible = false; + plFileDetails.BackColor = Color.FromArgb(64, 64, 64); + plFileDetails.Controls.Add(flpFileDetails); + plFileDetails.Controls.Add(lblFileType); + plFileDetails.Controls.Add(lblFileName); + plFileDetails.Controls.Add(picIcon); + plFileDetails.Font = new Font("Calibri", 9.75F, FontStyle.Regular, GraphicsUnit.Point, 0); + plFileDetails.ForeColor = Color.White; + plFileDetails.Location = new Point(12, 12); + plFileDetails.Name = "plFileDetails"; + plFileDetails.Size = new Size(595, 395); + plFileDetails.TabIndex = 2; + plFileDetails.Visible = false; // // flpFileDetails // - this.flpFileDetails.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) - | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this.flpFileDetails.FlowDirection = System.Windows.Forms.FlowDirection.TopDown; - this.flpFileDetails.Font = new System.Drawing.Font("Calibri", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.flpFileDetails.Location = new System.Drawing.Point(92, 115); - this.flpFileDetails.Margin = new System.Windows.Forms.Padding(0, 3, 3, 10); - this.flpFileDetails.Name = "flpFileDetails"; - this.flpFileDetails.Size = new System.Drawing.Size(503, 280); - this.flpFileDetails.TabIndex = 3; + flpFileDetails.Anchor = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right; + flpFileDetails.FlowDirection = FlowDirection.TopDown; + flpFileDetails.Font = new Font("Calibri", 12F, FontStyle.Regular, GraphicsUnit.Point, 0); + flpFileDetails.Location = new Point(92, 115); + flpFileDetails.Margin = new Padding(0, 3, 3, 10); + flpFileDetails.Name = "flpFileDetails"; + flpFileDetails.Size = new Size(503, 280); + flpFileDetails.TabIndex = 3; // // lblFileType // - this.lblFileType.AutoSize = true; - this.lblFileType.Font = new System.Drawing.Font("Calibri", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.lblFileType.Location = new System.Drawing.Point(95, 67); - this.lblFileType.Name = "lblFileType"; - this.lblFileType.Size = new System.Drawing.Size(276, 29); - this.lblFileType.TabIndex = 2; - this.lblFileType.Text = "Microsoft Word Dokument"; + lblFileType.AutoSize = true; + lblFileType.Font = new Font("Calibri", 12F, FontStyle.Regular, GraphicsUnit.Point, 0); + lblFileType.Location = new Point(95, 67); + lblFileType.Name = "lblFileType"; + lblFileType.Size = new Size(276, 29); + lblFileType.TabIndex = 2; + lblFileType.Text = "Microsoft Word Dokument"; // // lblFileName // - this.lblFileName.AutoSize = true; - this.lblFileName.Font = new System.Drawing.Font("Calibri", 15.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.lblFileName.ForeColor = System.Drawing.Color.White; - this.lblFileName.Location = new System.Drawing.Point(93, 28); - this.lblFileName.Name = "lblFileName"; - this.lblFileName.Size = new System.Drawing.Size(300, 39); - this.lblFileName.TabIndex = 1; - this.lblFileName.Text = "Mein Dokument.docx"; + lblFileName.AutoSize = true; + lblFileName.Font = new Font("Calibri", 15.75F, FontStyle.Regular, GraphicsUnit.Point, 0); + lblFileName.ForeColor = Color.White; + lblFileName.Location = new Point(93, 28); + lblFileName.Name = "lblFileName"; + lblFileName.Size = new Size(300, 39); + lblFileName.TabIndex = 1; + lblFileName.Text = "Mein Dokument.docx"; // // picIcon // - this.picIcon.Location = new System.Drawing.Point(23, 32); - this.picIcon.Name = "picIcon"; - this.picIcon.Size = new System.Drawing.Size(64, 64); - this.picIcon.TabIndex = 0; - this.picIcon.TabStop = false; + picIcon.Location = new Point(23, 32); + picIcon.Name = "picIcon"; + picIcon.Size = new Size(64, 64); + picIcon.TabIndex = 0; + picIcon.TabStop = false; // // phhcMain // - this.phhcMain.FilePath = null; - this.phhcMain.Location = new System.Drawing.Point(136, 434); - this.phhcMain.Name = "phhcMain"; - this.phhcMain.Size = new System.Drawing.Size(159, 117); - this.phhcMain.TabIndex = 1; - this.phhcMain.Visible = false; - // - // wmp - // - this.wmp.Enabled = true; - this.wmp.Location = new System.Drawing.Point(628, 613); - this.wmp.Name = "wmp"; - this.wmp.OcxState = ((System.Windows.Forms.AxHost.State)(resources.GetObject("wmp.OcxState"))); - this.wmp.Size = new System.Drawing.Size(156, 119); - this.wmp.TabIndex = 0; - this.wmp.Visible = false; - this.wmp.PreviewKeyDown += new System.Windows.Forms.PreviewKeyDownEventHandler(this.wmp_PreviewKeyDown); + phhcMain.FilePath = null; + phhcMain.Location = new Point(136, 434); + phhcMain.Name = "phhcMain"; + phhcMain.Size = new Size(159, 117); + phhcMain.TabIndex = 1; + phhcMain.Visible = false; // // frmSmartPreview // - this.AutoScaleDimensions = new System.Drawing.SizeF(144F, 144F); - this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi; - this.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(224)))), ((int)(((byte)(224)))), ((int)(((byte)(224))))); - this.ClientSize = new System.Drawing.Size(803, 815); - this.ControlBox = false; - this.Controls.Add(this.plContent); - this.Controls.Add(this.Panel1); - this.DoubleBuffered = true; - this.KeyPreview = true; - this.MaximizeBox = false; - this.MinimizeBox = false; - this.Name = "frmSmartPreview"; - this.ShowIcon = false; - this.ShowInTaskbar = false; - this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; - this.Text = "Schnellansicht"; - this.TopMost = true; - this.KeyUp += new System.Windows.Forms.KeyEventHandler(this.frmSmartPreview_KeyUp); - this.Panel1.ResumeLayout(false); - this.Panel1.PerformLayout(); - this.plContent.ResumeLayout(false); - this.plFileDetails.ResumeLayout(false); - this.plFileDetails.PerformLayout(); - ((System.ComponentModel.ISupportInitialize)(this.picIcon)).EndInit(); - ((System.ComponentModel.ISupportInitialize)(this.wmp)).EndInit(); - this.ResumeLayout(false); - + AutoScaleDimensions = new SizeF(144F, 144F); + AutoScaleMode = AutoScaleMode.Dpi; + BackColor = Color.FromArgb(224, 224, 224); + ClientSize = new Size(803, 815); + ControlBox = false; + Controls.Add(plContent); + Controls.Add(Panel1); + DoubleBuffered = true; + KeyPreview = true; + MaximizeBox = false; + MinimizeBox = false; + Name = "frmSmartPreview"; + ShowIcon = false; + ShowInTaskbar = false; + StartPosition = FormStartPosition.CenterScreen; + Text = "Schnellansicht"; + TopMost = true; + KeyUp += frmSmartPreview_KeyUp; + Panel1.ResumeLayout(false); + Panel1.PerformLayout(); + plContent.ResumeLayout(false); + plFileDetails.ResumeLayout(false); + plFileDetails.PerformLayout(); + ((System.ComponentModel.ISupportInitialize)picIcon).EndInit(); + ResumeLayout(false); } public frmSmartPreview() @@ -214,6 +195,7 @@ public frmSmartPreview() InitializeComponent(); // Add any initialization after the InitializeComponent() call. + InitMediaPlayer(); } @@ -225,7 +207,6 @@ public frmSmartPreview() internal Label lblClose; internal Label lblMax; internal Panel plContent; - internal AxWMPLib.AxWindowsMediaPlayer wmp; internal C4F.DevKit.PreviewHandler.PreviewHandlerHost.PreviewHandlerHostControl phhcMain; internal Panel plFileDetails; internal PictureBox picIcon; diff --git a/src/SmartPreview/frmSmartPreview.resx b/src/SmartPreview/frmSmartPreview.resx index 6ffaee1..25bdb3a 100644 --- a/src/SmartPreview/frmSmartPreview.resx +++ b/src/SmartPreview/frmSmartPreview.resx @@ -1,17 +1,17 @@ - @@ -117,15 +117,4 @@ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - AAEAAAD/////AQAAAAAAAAAMAgAAAFdTeXN0ZW0uV2luZG93cy5Gb3JtcywgVmVyc2lvbj00LjAuMC4w - LCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPWI3N2E1YzU2MTkzNGUwODkFAQAAACFTeXN0 - ZW0uV2luZG93cy5Gb3Jtcy5BeEhvc3QrU3RhdGUBAAAABERhdGEHAgIAAAAJAwAAAA8DAAAAtwAAAAIB - AAAAAQAAAAAAAAAAAAAAAKIAAAAAAwAACAAAAAAABQAAAAAAAADwPwMAAAAAAAUAAAAAAAAAAAAIAAIA - AAAAAAMAAQAAAAsA//8DAAAAAAALAP//CAACAAAAAAADADIAAAALAAAACAAKAAAAZgB1AGwAbAAAAAsA - AAALAAAACwD//wsA//8LAAAACAACAAAAAAAIAAIAAAAAAAgAAgAAAAAACAACAAAAAAALAAAAIBAAAE0M - AAAL - - \ No newline at end of file