DevExpress控件库----FlyoutPanel提示控件
DevExpress控件库----FlyoutPanel提示控件
第一步:拖一个FlyoutPanel控件到WinForm窗体上。名称为 flyoutPanel1
设置在什么控件上显示提示信息:
设置在 panelControl1控件上显示提示信息
flyoutPanel1.OwnerControl = panelControl1;
在鼠标移入panelControl1上时 显示提示信息:
private void panelControl1_MouseEnter(object sender, EventArgs e) { flyoutPanel1.ShowBeakForm(); }
如图:
在提示框中显示提示按钮的设置:
关闭按钮的事件:
private void flyoutPanel1_ButtonClick(object sender, DevExpress.Utils.FlyoutPanelButtonClickEventArgs e) { if (e.Button.Caption.Equals("关闭")) { flyoutPanel1.HideBeakForm(); } }
显示效果:
提示显示在控件的底部:
this.flyoutPanel1.OptionsBeakPanel.BeakLocation = DevExpress.Utils.BeakPanelBeakLocation.Top;
Point GetHotPoint(Control control) { Point pt = new Point(control.Width / 2, 0); if (flyoutPanel1.OptionsBeakPanel.BeakLocation==DevExpress.Utils.BeakPanelBeakLocation.Top) { pt.Y += control.Height; } return control.PointToScreen(pt); } private void panelControl1_MouseEnter(object sender, EventArgs e) { if (flyoutPanel1.FlyoutPanelState.IsActive) { return; } flyoutPanel1.ShowBeakForm(GetHotPoint(panelControl1)); }
显示效果图:
此文为自己学习笔记!!如果有什么错误的地方!请指正!!