From 385954f90f8f0f36c765bc6560c61b20633a88f6 Mon Sep 17 00:00:00 2001 From: Brett Sanderson Date: Tue, 8 Mar 2016 00:19:33 -0500 Subject: [PATCH] stuff working --- KaraokePlayer/KaraokePlayer.csproj | 3 ++ KaraokePlayer/KaraokeVideoPlayer.Designer.cs | 17 ++++++++- KaraokePlayer/KaraokeVideoPlayer.cs | 17 ++++++++- KaraokePlayer/MainForm.cs | 2 + KaraokePlayer/OverlayForm.Designer.cs | 2 + KaraokePlayer/OverlayForm.cs | 26 ++++++++++--- KaraokePlayer/TransparentPanel.cs | 39 ++++++++++++++++++++ 7 files changed, 99 insertions(+), 7 deletions(-) create mode 100644 KaraokePlayer/TransparentPanel.cs diff --git a/KaraokePlayer/KaraokePlayer.csproj b/KaraokePlayer/KaraokePlayer.csproj index a8bf55d..db3e832 100644 --- a/KaraokePlayer/KaraokePlayer.csproj +++ b/KaraokePlayer/KaraokePlayer.csproj @@ -88,6 +88,9 @@ + + Component + KaraokeVideoPlayer.cs diff --git a/KaraokePlayer/KaraokeVideoPlayer.Designer.cs b/KaraokePlayer/KaraokeVideoPlayer.Designer.cs index f5cfffa..07183ff 100644 --- a/KaraokePlayer/KaraokeVideoPlayer.Designer.cs +++ b/KaraokePlayer/KaraokeVideoPlayer.Designer.cs @@ -29,7 +29,9 @@ private void InitializeComponent() { this.vlcPlayer = new Vlc.DotNet.Forms.VlcControl(); + this.panelVideo = new System.Windows.Forms.Panel(); ((System.ComponentModel.ISupportInitialize)(this.vlcPlayer)).BeginInit(); + this.panelVideo.SuspendLayout(); this.SuspendLayout(); // // vlcPlayer @@ -52,16 +54,28 @@ this.vlcPlayer.VlcLibDirectoryNeeded += new System.EventHandler(this.vlcPlayer_VlcLibDirectoryNeeded); this.vlcPlayer.Playing += new System.EventHandler(this.vlcPlayer_Playing); this.vlcPlayer.TimeChanged += new System.EventHandler(this.vlcPlayer_TimeChanged); + this.vlcPlayer.DoubleClick += new System.EventHandler(this.vlcPlayer_DoubleClick); + // + // panelVideo + // + this.panelVideo.Controls.Add(this.vlcPlayer); + this.panelVideo.Dock = System.Windows.Forms.DockStyle.Fill; + this.panelVideo.Location = new System.Drawing.Point(0, 0); + this.panelVideo.Name = "panelVideo"; + this.panelVideo.Size = new System.Drawing.Size(428, 330); + this.panelVideo.TabIndex = 2; // // KaraokeVideoPlayer // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.Controls.Add(this.vlcPlayer); + this.Controls.Add(this.panelVideo); this.Name = "KaraokeVideoPlayer"; this.Size = new System.Drawing.Size(428, 330); + this.DoubleClick += new System.EventHandler(this.KaraokeVideoPlayer_DoubleClick); this.ParentChanged += new System.EventHandler(this.KaraokeVideoPlayer_ParentChanged); ((System.ComponentModel.ISupportInitialize)(this.vlcPlayer)).EndInit(); + this.panelVideo.ResumeLayout(false); this.ResumeLayout(false); } @@ -69,5 +83,6 @@ #endregion private Vlc.DotNet.Forms.VlcControl vlcPlayer; + private System.Windows.Forms.Panel panelVideo; } } diff --git a/KaraokePlayer/KaraokeVideoPlayer.cs b/KaraokePlayer/KaraokeVideoPlayer.cs index fc6843d..3af0b75 100644 --- a/KaraokePlayer/KaraokeVideoPlayer.cs +++ b/KaraokePlayer/KaraokeVideoPlayer.cs @@ -55,7 +55,7 @@ namespace KaraokePlayer { if (ParentForm != null) { - _overlayForm = new OverlayForm(this); + _overlayForm = new OverlayForm(this); } } @@ -63,5 +63,20 @@ namespace KaraokePlayer { e.VlcLibDirectory = new DirectoryInfo(@"lib\vlc\"); } + + private void vlcPlayer_DoubleClick(object sender, EventArgs e) + { + + } + + private void KaraokeVideoPlayer_DoubleClick(object sender, EventArgs e) + { + + } + + private void panel1_DoubleClick(object sender, EventArgs e) + { + + } } } \ No newline at end of file diff --git a/KaraokePlayer/MainForm.cs b/KaraokePlayer/MainForm.cs index c05caba..7caec18 100644 --- a/KaraokePlayer/MainForm.cs +++ b/KaraokePlayer/MainForm.cs @@ -21,5 +21,7 @@ namespace KaraokePlayer { karaokeVideoPlayer1.Play(new Uri(@"D:\Karaoke\SF360 February 2016\SF360-01 - Charlie Puth - One Call Away\SF360-01 - Charlie Puth - One Call Away.mp3")); } + + } } diff --git a/KaraokePlayer/OverlayForm.Designer.cs b/KaraokePlayer/OverlayForm.Designer.cs index a1183c3..fe71fef 100644 --- a/KaraokePlayer/OverlayForm.Designer.cs +++ b/KaraokePlayer/OverlayForm.Designer.cs @@ -41,6 +41,7 @@ this.Graphic.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom; this.Graphic.TabIndex = 0; this.Graphic.TabStop = false; + this.Graphic.DoubleClick += new System.EventHandler(this.Graphic_DoubleClick); // // OverlayForm // @@ -50,6 +51,7 @@ this.Controls.Add(this.Graphic); this.Name = "OverlayForm"; this.Text = "OverlayForm"; + this.DoubleClick += new System.EventHandler(this.OverlayForm_DoubleClick); ((System.ComponentModel.ISupportInitialize)(this.Graphic)).EndInit(); this.ResumeLayout(false); diff --git a/KaraokePlayer/OverlayForm.cs b/KaraokePlayer/OverlayForm.cs index 8b3d1b0..76fbf11 100644 --- a/KaraokePlayer/OverlayForm.cs +++ b/KaraokePlayer/OverlayForm.cs @@ -12,7 +12,9 @@ namespace KaraokePlayer public OverlayForm(ContainerControl parent) { + InitializeComponent(); + Graphic.BackColor = Color.Transparent; _parent = parent; BackColor = Color.FromArgb(1, 1, 1); TransparencyKey = Color.FromArgb(1, 1, 1); @@ -21,17 +23,19 @@ namespace KaraokePlayer ShowInTaskbar = false; StartPosition = FormStartPosition.Manual; AutoScaleMode = AutoScaleMode.None; - Location = parent.PointToScreen(Point.Empty); - ClientSize = parent.ClientSize; Show(parent); parent.ParentForm.LocationChanged += Cover_LocationChanged; - parent.ClientSizeChanged += Cover_ClientSizeChanged; + parent.LocationChanged += Cover_LocationChanged; + parent.VisibleChanged += Cover_LocationChanged; + parent.ClientSizeChanged += Cover_ClientSizeChanged; // Disable Aero transitions, the plexiglass gets too visible if (Environment.OSVersion.Version.Major >= 6) { var value = 1; DwmSetWindowAttribute(parent.ParentForm.Handle, DwmwaTransitionsForcedisabled, ref value, 4); } + Location = parent.PointToScreen(Point.Empty); + ClientSize = parent.ClientSize; } public sealed override Color BackColor @@ -42,7 +46,7 @@ namespace KaraokePlayer private void Cover_LocationChanged(object sender, EventArgs e) { - Location = _parent.PointToScreen(Point.Empty); + Location = _parent.PointToScreen(Point.Empty); } private void Cover_ClientSizeChanged(object sender, EventArgs e) @@ -66,10 +70,22 @@ namespace KaraokePlayer protected override void OnActivated(EventArgs e) { // Always keep the owner activated instead - // BeginInvoke(new Action(() => Owner.Activate())); + BeginInvoke(new Action(() => Owner.Activate())); } [DllImport("dwmapi.dll")] private static extern int DwmSetWindowAttribute(IntPtr hWnd, int attr, ref int value, int attrLen); + + private void Graphic_DoubleClick(object sender, EventArgs e) + { + + } + + private void OverlayForm_DoubleClick(object sender, EventArgs e) + { + + } + + } } diff --git a/KaraokePlayer/TransparentPanel.cs b/KaraokePlayer/TransparentPanel.cs new file mode 100644 index 0000000..3c7282a --- /dev/null +++ b/KaraokePlayer/TransparentPanel.cs @@ -0,0 +1,39 @@ +using System; +using System.Collections.Generic; +using System.Drawing; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Forms; + +namespace KaraokePlayer +{ + class TransparentPanel : PictureBox + { + public TransparentPanel() + { + this.SetStyle(ControlStyles.DoubleBuffer | + ControlStyles.AllPaintingInWmPaint | + ControlStyles.UserPaint | + ControlStyles.Opaque, true); + + } + + protected override void OnPaintBackground(PaintEventArgs e) + { + + System.Drawing.SolidBrush myBrush = new System.Drawing.SolidBrush(System.Drawing.Color.Red); + e.Graphics.FillRectangle(myBrush, new Rectangle(0, 0, 200, 300)); + //base.OnPaintBackground(e); + } + + protected override void OnPaint(PaintEventArgs e) + { + System.Drawing.SolidBrush myBrush = new System.Drawing.SolidBrush(System.Drawing.Color.Red); + e.Graphics.FillRectangle(myBrush, new Rectangle(0, 0, 200, 300)); + //base.OnPaintBackground(e); + } + + + } +}