private void btn_min_MouseLeave(object sender, EventArgs e) { LayeredPanel thisButton = sender as LayeredPanel; thisButton.BackColor = Color.Transparent; layeredPanel_min.BackColor = thisButton.BackColor; layeredPanel_close.BackColor = thisButton.BackColor; layeredPanel_Set.BackColor = thisButton.BackColor; }
private DuiBaseControl getThisBaseControl(LayeredPanel lp, string controlName) { DuiBaseControl cb = null; foreach (DuiBaseControl item in lp.DUIControls) { if (item.Name == controlName) { cb = item; } } return(cb); }
private void btn_min_MouseHover(object sender, EventArgs e) { LayeredPanel thisButton = sender as LayeredPanel; switch (thisButton.Name) { case "layeredPanel_close": thisButton.BackColor = Color.FromArgb(255, 88, 88); break; default: thisButton.BackColor = Color.FromArgb(100, 234, 234, 234); break; } }
private void Control_MouseMove(object sender, MouseEventArgs e) { Size thisZ = new Size(); if (sender is LayeredPanel) { LayeredPanel lpn = sender as LayeredPanel; thisZ = lpn.Size; } else if (sender is DuiButton) { DuiButton btn_Resize = sender as DuiButton; thisZ = btn_Resize.Size; } else if (sender is LayeredBaseControl) { LayeredBaseControl lns = sender as LayeredBaseControl; thisZ = lns.Size; } //鼠标移动过程中,坐标时刻在改变 //当鼠标移动时横坐标距离窗体右边缘5像素以内且纵坐标距离下边缘也在5像素以内时,要将光标变为倾斜的箭头形状,同时拖拽方向direction置为MouseDirection.Declining //(e.Location.X <= 5 && e.Location.Y <= 5) || (e.Location.X >= thisZ.Width - 5 && e.Location.Y <= 5) || (e.Location.X <= 4 && e.Location.Y >= thisZ.Height - 5) if ((e.Location.X >= thisZ.Width - 5 && e.Location.Y >= thisZ.Height - 5)) { this.Cursor = Cursors.SizeNWSE; direction = MouseDirection.Declining; } ////当鼠标移动时横坐标距离窗体右边缘5像素以内时,要将光标变为倾斜的箭头形状,同时拖拽方向direction置为MouseDirection.Herizontal //else if (e.Location.X <= 5 || e.Location.X >= thisZ.Width - 5) //{ // this.Cursor = Cursors.SizeWE; // direction = MouseDirection.Herizontal; //} ////同理当鼠标移动时纵坐标距离窗体下边缘5像素以内时,要将光标变为倾斜的箭头形状,同时拖拽方向direction置为MouseDirection.Vertical //else if (e.Location.Y <= 5 || e.Location.Y >= thisZ.Height - 5) //{ // this.Cursor = Cursors.SizeNS; // direction = MouseDirection.Vertical; //} //否则,以外的窗体区域,鼠标星座均为单向箭头(默认) else { this.Cursor = Cursors.Arrow; } //设定好方向后,调用下面方法,改变窗体大小 ResizeWindow(); }
private void panel_min_MouseLeave(object sender, EventArgs e) { LayeredPanel thisButton = sender as LayeredPanel; thisButton.BackColor = Color.Transparent; }