using DevExpress.XtraBars;
|
|
namespace HStation.WinFrmUI
|
{
|
public partial class PumpFullInfoViewDlg : XtraForm
|
{
|
private bool _isMaxWindowStatus = true;//最大化窗体覆盖任务栏
|
private PumpFullInfoCtrl thePumpCtrl = null;
|
|
#region 构造
|
|
public PumpFullInfoViewDlg()
|
{
|
InitializeComponent();
|
this._isMaxWindowStatus = true;//最大化窗体覆盖任务栏
|
this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.OnFrmClosing);
|
this.Load += new System.EventHandler(this.OnFrmLoad);
|
this.Shown += new System.EventHandler(this.OnFrmShown);
|
this.bbi下载BIM文件.Visibility = BarItemVisibility.Never;
|
this.bsiPromptInfo.Caption = "";
|
this.bsiPromptInfo.Caption = "";
|
}
|
|
private void OnFrmLoad(object sender, EventArgs e)
|
{
|
//手机页面
|
navBtn手机页面.Visible = false;
|
//bbi添加串并联.Visibility = BarItemVisibility.Never;//功能没有完成
|
LocationDialog();
|
SetNavTileControlMoveAble();
|
this.SetMaxWindowStatus();
|
}
|
|
public void SetBindindData(PumpMatchingViewModel pumpMatchingViewModel)
|
{
|
pumpFullInfoCtrl1.SetBindingData(pumpMatchingViewModel);
|
}
|
|
private void OnFrmShown(object sender, EventArgs e)
|
{
|
}
|
|
private void OnFrmClosing(object sender, FormClosingEventArgs e)
|
{
|
}
|
|
private void LocationDialog()
|
{
|
}
|
|
#endregion 构造
|
|
#region 按钮显示设置
|
|
//窗体尺寸:注意默认是不显示的
|
public void IsDispBtn窗体尺寸(bool isDisp)
|
{
|
navBtnMin.Visible = navBtnbutton9.Visible = navBtnbutton10.Visible = isDisp;
|
//设置tileNav可移动
|
if (isDisp == true)
|
SetNavTileControlMoveAble();
|
}
|
|
//设置界面可移动
|
protected void SetNavTileControlMoveAble()
|
{
|
this.tileNavPaneTop.OptionsPrimaryDropDown.CloseOnOuterClick = DevExpress.Utils.DefaultBoolean.False;
|
this.tileNavPaneTop.MouseDown += new System.Windows.Forms.MouseEventHandler(this.tileNavPane_MouseDown);
|
this.tileNavPaneTop.MouseMove += new System.Windows.Forms.MouseEventHandler(this.tileNavPane_MouseMove);
|
this.tileNavPaneTop.MouseUp += new System.Windows.Forms.MouseEventHandler(this.tileNavPane_MouseUp);
|
this.tileNavPaneTop.DoubleClick += new System.EventHandler(this.tileNavPane_DoubleClick);
|
}
|
|
#endregion 按钮显示设置
|
|
private void navBtn导出_ElementClick(object sender, DevExpress.XtraBars.Navigation.NavElementEventArgs e)
|
{
|
this.popupMenu1.ShowPopup(MousePosition);
|
}
|
|
private void bbi导出安装图_ItemClick(object sender, ItemClickEventArgs e)
|
{
|
}
|
|
private void bbi导出性能曲线_ItemClick(object sender, ItemClickEventArgs e)
|
{
|
}
|
|
private void bbi下载BIM文件_ItemClick(object sender, ItemClickEventArgs e)
|
{
|
}
|
|
private void bbi导出属性表_ItemClick(object sender, ItemClickEventArgs e)
|
{
|
}
|
|
private void navBtn选型报告_ElementClick(object sender, DevExpress.XtraBars.Navigation.NavElementEventArgs e)
|
{
|
}
|
|
private void navBtn手机页面_ElementClick(object sender, DevExpress.XtraBars.Navigation.NavElementEventArgs e)
|
{
|
}
|
|
private void navBtn寿命成本计算_ElementClick(object sender, DevExpress.XtraBars.Navigation.NavElementEventArgs e)
|
{
|
}
|
|
#region 最大最小按钮操作
|
|
private void tileNavPane1_MouseDown(object sender, MouseEventArgs e)
|
{
|
if (e.Button == System.Windows.Forms.MouseButtons.Right)
|
{
|
}
|
}
|
|
private void navBtnClose_ElementClick(object sender, DevExpress.XtraBars.Navigation.NavElementEventArgs e)
|
{
|
this.Close();
|
}
|
|
private void navBtnSize_ElementClick(object sender, DevExpress.XtraBars.Navigation.NavElementEventArgs e)
|
{
|
if (_isMaxWindowStatus)
|
{
|
this.SetNormalWindowStatus();
|
}
|
else
|
{
|
this.SetMaxWindowStatus();
|
}
|
}
|
|
private void navBtnMin_ElementClick(object sender, DevExpress.XtraBars.Navigation.NavElementEventArgs e)
|
{
|
this.WindowState = FormWindowState.Minimized;
|
}
|
|
//设置窗体最大化,全屏
|
private void SetMaxWindowStatus()
|
{
|
this.WindowState = FormWindowState.Maximized;
|
this.navBtnbutton9.Glyph = HStation.WinFrmUI.Xhs.Core.Properties.Resources.SizeNormal32;
|
(this.navBtnbutton9.SuperTip.Items[0] as DevExpress.Utils.ToolTipItem).Text = "向下还原";
|
this._isMaxWindowStatus = true;//最大化窗体状态
|
this.Location = new Point(0, 0);
|
//Rectangle rect = System.Windows.Forms.SystemInformation.VirtualScreen;
|
//this.Size = new System.Drawing.Size(rect.Width, rect.Height - 35);
|
this.Size = new System.Drawing.Size(System.Windows.Forms.Screen.PrimaryScreen.WorkingArea.Width, System.Windows.Forms.Screen.PrimaryScreen.WorkingArea.Height);
|
}
|
|
//设置窗体(小窗)
|
private void SetNormalWindowStatus()
|
{
|
this.WindowState = FormWindowState.Normal;
|
this.navBtnbutton9.Glyph = HStation.WinFrmUI.Xhs.Core.Properties.Resources.Square32;
|
(this.navBtnbutton9.SuperTip.Items[0] as DevExpress.Utils.ToolTipItem).Text = "最大化";
|
this._isMaxWindowStatus = false;
|
var sq_width = System.Windows.Forms.Screen.PrimaryScreen.WorkingArea.Width / 8;
|
var sq_height = System.Windows.Forms.Screen.PrimaryScreen.WorkingArea.Height / 8;
|
this.Location = new Point(sq_width, sq_height);
|
this.Size = new System.Drawing.Size(sq_width * 6, sq_height * 6);
|
//this.Location = new Point(0, 0);
|
//this.Size = new System.Drawing.Size(900,600);//rect.Width/2, rect.Height/2);
|
}
|
|
#endregion 最大最小按钮操作
|
|
#region 鼠标操作
|
|
private static Point downPosition; //记录鼠标按下时的坐标
|
private bool isMouseDown = false; //判断鼠标是状态 True:按下 False:抬起
|
|
private void tileNavPane_MouseDown(object sender, MouseEventArgs e)
|
{
|
if (this._isMaxWindowStatus)
|
return;
|
downPosition = new Point(e.X, e.Y);
|
isMouseDown = true;
|
}
|
|
private void tileNavPane_MouseMove(object sender, MouseEventArgs e)
|
{
|
if (isMouseDown && e.Button == System.Windows.Forms.MouseButtons.Left)
|
{
|
if (this._isMaxWindowStatus)
|
return; //此处还需要更多的考虑,这一句是为了当窗体最大化时拖拽标题栏可以切换到Normal状态,但是效果不是很理想
|
Point currentPosition = Control.MousePosition;
|
currentPosition.Offset(-downPosition.X, -downPosition.Y);
|
this.Location = currentPosition;
|
}
|
}
|
|
private void tileNavPane_MouseUp(object sender, MouseEventArgs e)
|
{
|
isMouseDown = false;
|
}
|
|
private void tileNavPane_DoubleClick(object sender, EventArgs e)
|
{
|
if (_isMaxWindowStatus)
|
{
|
this.SetNormalWindowStatus();
|
}
|
else
|
{
|
this.SetMaxWindowStatus();
|
}
|
}
|
|
#endregion 鼠标操作
|
|
#region 可拖动缩放
|
|
private const int WM_NCHITTEST = 0x0084;
|
private const int HTLEFT = 10; //左边界
|
private const int HTRIGHT = 11; //右边界
|
private const int HTTOP = 12; //上边界
|
private const int HTTOPLEFT = 13; //左上角
|
private const int HTTOPRIGHT = 14; //右上角
|
private const int HTBOTTOM = 15; //下边界
|
private const int HTBOTTOMLEFT = 0x10; //左下角
|
private const int HTBOTTOMRIGHT = 17; //右下角
|
|
protected override void WndProc(ref System.Windows.Forms.Message m)
|
{
|
base.WndProc(ref m);
|
switch (m.Msg)
|
{
|
case WM_NCHITTEST:
|
{
|
Point vPoint = new Point((int)m.LParam & 0xFFFF, (int)m.LParam >> 16 & 0xFFFF);
|
vPoint = PointToClient(vPoint);
|
//判断:仅当当前窗体状态不是最大化时,相关鼠标事件生效
|
if (!this._isMaxWindowStatus)
|
{
|
if (vPoint.X < 10)
|
{
|
if (vPoint.Y < 10)
|
{
|
m.Result = (IntPtr)HTTOPLEFT;
|
}
|
else if (vPoint.Y > this.Height - 10)
|
{
|
m.Result = (IntPtr)HTBOTTOMLEFT;
|
}
|
else
|
{
|
m.Result = (IntPtr)HTLEFT;
|
}
|
}
|
else if (vPoint.X > this.Width - 10)
|
{
|
if (vPoint.Y < 10)
|
{
|
m.Result = (IntPtr)HTTOPRIGHT;
|
}
|
else if (vPoint.Y > this.Height - 10)
|
{
|
m.Result = (IntPtr)HTBOTTOMRIGHT;
|
}
|
else
|
{
|
m.Result = (IntPtr)HTRIGHT;
|
}
|
}
|
else if (10 < vPoint.X && vPoint.X < this.Width - 10)
|
{
|
if (vPoint.Y < 10)
|
{
|
m.Result = (IntPtr)HTTOP;
|
}
|
else if (vPoint.Y > this.Height - 10)
|
{
|
m.Result = (IntPtr)HTBOTTOM;
|
}
|
}
|
}
|
break;
|
}
|
}
|
}
|
|
#endregion 可拖动缩放
|
|
#region 功能点击事件
|
|
private void navButton询价_ElementClick(object sender, DevExpress.XtraBars.Navigation.NavElementEventArgs e)
|
{
|
}
|
|
private void bsiWindowInfo_ElementClick(object sender, DevExpress.XtraBars.Navigation.NavElementEventArgs e)
|
{
|
}
|
|
private void navBtnTitle_ElementClick(object sender, DevExpress.XtraBars.Navigation.NavElementEventArgs e)
|
{
|
this.popupMenu2.ShowPopup(MousePosition);
|
}
|
|
private void bbi复制泵型号文字_ItemClick(object sender, ItemClickEventArgs e)
|
{
|
}
|
|
private void ShowTipInfo(int delay_time, string info)
|
{
|
var alertControl1 = new DevExpress.XtraBars.Alerter.AlertControl();
|
alertControl1.AutoFormDelay = delay_time;//毫秒
|
alertControl1.AutoHeight = false;
|
alertControl1.AllowHtmlText = true;
|
alertControl1.Show(this, "tip", info);
|
}
|
|
#endregion 功能点击事件
|
|
public static event Action<PumpFullInfoCtrl> JumpPumpFullInfoCtrl;
|
|
//停靠
|
private void navBtnDock_ElementClick(object sender, DevExpress.XtraBars.Navigation.NavElementEventArgs e)
|
{
|
this.Close();
|
JumpPumpFullInfoCtrl.Invoke(this.pumpFullInfoCtrl1);
|
}
|
}
|
}
|