📄 avform.cs
字号:
//
// gButton3
//
this.gButton3.Anchor = System.Windows.Forms.AnchorStyles.None;
this.gButton3.GBorderStyle = gowk.controls.GBorderStyle.Solid;
this.gButton3.IsRound = true;
this.gButton3.Location = new System.Drawing.Point(142, 10);
this.gButton3.Name = "gButton3";
this.gButton3.Size = new System.Drawing.Size(16, 16);
this.gButton3.TabIndex = 12;
//
// outvolume
//
this.outvolume.Anchor = System.Windows.Forms.AnchorStyles.None;
this.outvolume.Location = new System.Drawing.Point(38, 24);
this.outvolume.Name = "outvolume";
this.outvolume.Size = new System.Drawing.Size(100, 8);
this.outvolume.TabIndex = 11;
this.outvolume.MouseUp += new System.Windows.Forms.MouseEventHandler(this.outvolume_MouseUp);
this.outvolume.MouseMove += new System.Windows.Forms.MouseEventHandler(this.outvolume_MouseMove);
//
// btnoutvalume
//
this.btnoutvalume.Anchor = System.Windows.Forms.AnchorStyles.None;
this.btnoutvalume.GBorderStyle = gowk.controls.GBorderStyle.Solid;
this.btnoutvalume.IsRound = true;
this.btnoutvalume.Location = new System.Drawing.Point(14, 20);
this.btnoutvalume.Name = "btnoutvalume";
this.btnoutvalume.Size = new System.Drawing.Size(16, 16);
this.btnoutvalume.TabIndex = 10;
this.btnoutvalume.Click += new System.EventHandler(this.btnoutvalume_Click);
//
// btninvolume
//
this.btninvolume.Anchor = System.Windows.Forms.AnchorStyles.None;
this.btninvolume.GBorderStyle = gowk.controls.GBorderStyle.Solid;
this.btninvolume.IsRound = true;
this.btninvolume.Location = new System.Drawing.Point(14, 1);
this.btninvolume.Name = "btninvolume";
this.btninvolume.Size = new System.Drawing.Size(16, 16);
this.btninvolume.TabIndex = 9;
this.btninvolume.Click += new System.EventHandler(this.btninvolume_Click);
//
// involume
//
this.involume.Anchor = System.Windows.Forms.AnchorStyles.None;
this.involume.Location = new System.Drawing.Point(38, 5);
this.involume.Name = "involume";
this.involume.Size = new System.Drawing.Size(100, 8);
this.involume.TabIndex = 8;
this.involume.MouseUp += new System.Windows.Forms.MouseEventHandler(this.involume_MouseUp);
this.involume.MouseMove += new System.Windows.Forms.MouseEventHandler(this.involume_MouseMove);
//
// r
//
this.r.Dock = System.Windows.Forms.DockStyle.Top;
this.r.Image = ((System.Drawing.Image)(resources.GetObject("r.Image")));
this.r.Location = new System.Drawing.Point(0, 0);
this.r.Name = "r";
this.r.Size = new System.Drawing.Size(168, 124);
this.r.SizeMode = System.Windows.Forms.PictureBoxSizeMode.CenterImage;
this.r.TabIndex = 7;
this.r.TabStop = false;
//
// l
//
this.l.Dock = System.Windows.Forms.DockStyle.Bottom;
this.l.Image = ((System.Drawing.Image)(resources.GetObject("l.Image")));
this.l.Location = new System.Drawing.Point(0, 162);
this.l.Name = "l";
this.l.Size = new System.Drawing.Size(168, 128);
this.l.SizeMode = System.Windows.Forms.PictureBoxSizeMode.CenterImage;
this.l.TabIndex = 8;
this.l.TabStop = false;
//
// AVForm
//
this.AutoScaleBaseSize = new System.Drawing.Size(6, 14);
this.BackColor = System.Drawing.Color.Gray;
this.ClientSize = new System.Drawing.Size(168, 352);
this.Controls.Add(this.gPanel1);
this.Controls.Add(this.local);
this.Controls.Add(this.remote);
this.DockPadding.Top = 22;
this.Name = "AVForm";
this.StartPosition = System.Windows.Forms.FormStartPosition.Manual;
this.Text = "AVForm";
this.TransparencyKey = System.Drawing.Color.FromArgb(((System.Byte)(128)), ((System.Byte)(128)), ((System.Byte)(128)));
this.gPanel1.ResumeLayout(false);
this.gPanel2.ResumeLayout(false);
this.ResumeLayout(false);
}
#endregion
private void SetHeight()
{
int h=this.remote.Height+this.local.Height+40;
if(this.ImageTopLeft!=null)h+=this.ImageTopLeft.Height;
if(this.ImageBottomLeft!=null)h+=this.ImageBottomLeft.Height;
if(this.l.Visible)h+=l.Height;
if(this.r.Visible)h+=r.Height;
this.Height=h;
}
private void remote_Click(object sender, System.EventArgs e)
{
this.remote.GImage.ActiveImage=this.remote.GImage.PressedImage=this.remote.GImage.NormalImage=null;
if(this.r.Visible)
{
this.r.Hide();
this.remote.GImage.Image=this.downImage;
}
else
{
this.r.Show();
this.remote.GImage.Image=this.upImage;
}
SetHeight();
}
private void local_Click(object sender, System.EventArgs e)
{
this.local.GImage.ActiveImage=this.local.GImage.PressedImage=this.local.GImage.NormalImage=null;
if(this.l.Visible)
{
this.l.Hide();
this.local.GImage.Image=this.downImage;
}
else
{
this.l.Show();
this.local.GImage.Image=this.upImage;
}
SetHeight();
}
private void master_Move(object sender, EventArgs e)
{
this.XX();
}
private void master_VisibleChanged(object sender, EventArgs e)
{
this.Visible=this.master.Visible;
}
private void master_SizeChanged(object sender, EventArgs e)
{
this.XX();
}
protected override void OnLocationChanged(EventArgs e)
{
base.OnLocationChanged (e);
this.XX();
}
private bool contains(int value,int min,int max)
{
return value<max && value>min;
}
private void XX()
{
if(!this.Visible && !this.master.Visible)return;
if(this.WindowState==FormWindowState.Minimized ||this.master.WindowState==FormWindowState.Minimized)return;
Rectangle mb=this.master.Bounds;
Rectangle lb=this.Bounds;
int x=lb.X;
int y=lb.Y;
if(lb.Bottom<mb.Top)
{
y=mb.Top-lb.Height;
}
else if(lb.Top>mb.Bottom)
{
y=mb.Bottom;
}
if(lb.Right<mb.Left)
{
x=mb.Left-lb.Width;
}
else if(lb.Left>mb.Right)
{
x=mb.Right;
}
this.Location=new Point(x,y);
/* Rectangle track=this.master.Bounds;
Rectangle lb=this.Bounds;
track.Inflate(lb.Width,lb.Height);
track.Width-=lb.Width;
track.Height-=lb.Height;
// track.Offset(-5,-5);
int x=lb.X;
int y=lb.Y;
bool xc=this.contains(x,track.Left,track.Right);
bool yc=this.contains(y,track.Top,track.Bottom);
if(xc && !yc)
{
y=track.Top-x>x-track.Bottom?track.Bottom:track.Top;
}
else if(yc && !yc)
{
x=x-track.Left>track.Right-x?track.Right:track.Left;
}
else
{
x=x<track.Left?track.Left:track.Right;
y=y<track.Top?track.Top:track.Bottom;
}
this.Location=new Point(x,y);*/
}
private void outvolume_MouseUp(object sender, System.Windows.Forms.MouseEventArgs e)
{
if(e.X<0||e.X>this.outvolume.Width)return;
int v=(int)(e.X*this.outvolume.Maximum/this.outvolume.Width);
this.outdtl.Volume=v;
this.outvolume.Value=this.outdtl.Volume;
}
private void involume_MouseUp(object sender, System.Windows.Forms.MouseEventArgs e)
{
if(e.X<0||e.X>this.involume.Width)return;
int v=(int)(e.X*this.involume.Maximum/this.involume.Width);
this.indtl.Volume=v;
this.involume.Value=this.indtl.Volume;
}
private void involume_MouseMove(object sender, System.Windows.Forms.MouseEventArgs e)
{
if(this.involume.Capture)involume_MouseUp(sender,e);
}
private void outvolume_MouseMove(object sender, System.Windows.Forms.MouseEventArgs e)
{
if(this.outvolume.Capture)outvolume_MouseUp(sender,e);
}
private void btnoutvalume_Click(object sender, System.EventArgs e)
{
// this.outdtl.Mute=!this.outdtl.Mute;
}
private void btninvolume_Click(object sender, System.EventArgs e)
{
// this.indtl.Mute=!this.indtl.Mute;
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -