private void loadBottomButtons() { // 新增 addButton = new XButton(); addButton.Size = new Size(80, 24); addButton.Text = "新增"; addButton.MouseClick += new MouseEventHandler(addButton_MouseClick); // 删除 deleteButton = new XButton(); deleteButton.Size = new Size(80, 24); deleteButton.Text = "删除"; deleteButton.MouseClick += new MouseEventHandler(deleteButton_MouseClick); // 保存 saveButton = new XButton(); saveButton.Size = new Size(80, 24); saveButton.Text = "保存"; saveButton.MouseClick += new MouseEventHandler(saveButton_MouseClick); cancelButton = new XButton(); cancelButton.Size = new Size(80, 24); cancelButton.Text = "取消"; cancelButton.MouseClick += new MouseEventHandler(cancelButton_MouseClick); this.AddRender_Btn(addButton, deleteButton, saveButton, cancelButton); }
public MouseSimulator XButtonDoubleClick(XButton buttonId) { var inputList = new InputBuilder().AddMouseXButtonDoubleClick(buttonId).ToArray(); SendSimulatedInput(inputList); return(this); }
/// <summary> /// 修改明细 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected virtual void btnEditDetail_Click(object sender, EventArgs e) { XButton btnEdit = sender as XButton; XGridEx gridEx = this.FindDetailGridEx(btnEdit.Parent as Janus.Windows.UI.Tab.UITabPage); XModelBase currentModel = this.GetCurrentModel(gridEx); if (currentModel == null) { XMessageBox.ShowError("请选择要修改的记录!"); return; } frmEditBase frm = this.GetEditDetailForm(sender, currentModel); if (frm != null) { if (frm.ShowDialog() == System.Windows.Forms.DialogResult.OK) { gridEx.Refresh(); } } else { XMessageBox.ShowError("未实现修改窗体方法!"); } }
/// <summary> /// 创建消息框按钮 /// </summary> /// <param name="text">按钮文本</param> /// <param name="shortcut"></param> /// <param name="dialogResult">按钮触发的消息框返回值</param> /// <returns>按钮实例</returns> private static XButton CreateButton(string text, char shortcut, DialogResult dialogResult) { XButton btn = new XButton { Text = text, Size = new Size(BUTTON_WIDTH, BUTTON_HEIGHT), Shortcut = shortcut, RoundedRectangleCornerRadius = 4, BorderColor = Color.White, BorderWidth = 0, StartColor = ButtonStartColor, EndColor = ButtonEndColor, ForeColor = ButtonForeColor, HoldingStartColor = ButtonHoldingStartColor, HoldingEndColor = ButtonHoldingEndColor, HoldingForeColor = ButtonHoldingForeColor }; btn.Click += (s1, e1) => { Form f = ((XButton)s1)?.FindForm(); if (f == null) { return; } f.DialogResult = dialogResult; }; return(btn); }
protected void Init() { // this.xapScrollBarPanel1.BackColor = Color.Pink; btnOk = new XButton(); btnOk.Text = "确认"; btnOk.MouseClick += new MouseEventHandler(btn_MouseClick); btnOk.Size = new System.Drawing.Size(90, 24); btnOk.Location = new Point(this.Location.X + (this.Size.Width - btnOk.Size.Width * 2 - 20) / 2, (this.Size.Height - btnOk.Size.Height) / 2); this.xapScrollBarPanel1.AddRender(btnOk); btnCancel = new XButton(); btnCancel.Text = "取消"; btnCancel.Size = new System.Drawing.Size(90, 24); btnCancel.MouseClick += new MouseEventHandler(btnCancel_MouseClick); btnCancel.Location = new Point(btnOk.Location.X + btnOk.Size.Width + 20, btnOk.Location.Y); this.xapScrollBarPanel1.AddRender(btnCancel); this.xapScrollBarPanel1.AddRender(cancel); cancel = new XOrderCancelButton(); cancel.MouseClick += new MouseEventHandler(cancel_MouseClick); this.xapScrollBarPanel1.RemoveRender(cancel); this.xapScrollBarPanel1.AddRender(cancel); this.xapScrollBarPanel1.SizeChanged += new EventHandler(xapScrollBarPanel1_SizeChanged); this.xapScrollBarPanel1.Paint += new PaintEventHandler(xapScrollBarPanel1_Paint); }
/// ------------------------------------------------------------------------------------ private void SetupScrollPanel() { // Create the panel that will hold the close button _panelScroll = new Panel(); _panelScroll.Width = 40; _panelScroll.Visible = true; _panelScroll.Dock = DockStyle.Right; _panelScroll.Paint += HandleLinePaint; _panelHdrBand.Controls.Add(_panelScroll); _panelScroll.Visible = false; _panelScroll.BringToFront(); int top = ((_panelHdrBand.Height - _panelHdrBand.Padding.Bottom - 18) / 2); // Create a left scrolling button. _buttonLeft = new SIL.Windows.Forms.Widgets.XButton(); _buttonLeft.DrawLeftArrowButton = true; _buttonLeft.Size = new Size(18, 18); _buttonLeft.Anchor = AnchorStyles.Right | AnchorStyles.Top; _buttonLeft.Click += m_btnLeft_Click; _buttonLeft.Location = new Point(4, top); _panelScroll.Controls.Add(_buttonLeft); // Create a right scrolling button. _buttonRight = new SIL.Windows.Forms.Widgets.XButton(); _buttonRight.DrawRightArrowButton = true; _buttonRight.Size = new Size(18, 18); _buttonRight.Anchor = AnchorStyles.Right | AnchorStyles.Top; _buttonRight.Click += m_btnRight_Click; _buttonRight.Location = new Point(22, top); _panelScroll.Controls.Add(_buttonRight); _tooltip.SetToolTip(_buttonLeft, LocalizationManager.GetString("MainWindow.ViewTabsScrollLeftToolTipText", "Scroll Left")); _tooltip.SetToolTip(_buttonRight, LocalizationManager.GetString("MainWindow.ViewTabsScrollRightToolTipText", "Scroll Right")); }
void LoadRender() { if (_btnClearLocalCache != null) { this.RemoveRender(_btnClearLocalCache); } _btnClearLocalCache = new XButton(); _btnClearLocalCache.Text = "清除【本地缓存】"; _btnClearLocalCache.Location = new Point(22, 10); _btnClearLocalCache.Size = new Size(630, 100); this.AddRender(_btnClearLocalCache); _btnClearLocalCache.MouseClick += _btnClearLocalCache_MouseClick; _btnClearRemoteCache = new XButton(); _btnClearRemoteCache.Text = "清除【一级缓存】"; _btnClearRemoteCache.Location = new Point(22, _btnClearLocalCache.Location.Y + _btnClearLocalCache.Size.Height + 10); _btnClearRemoteCache.Size = _btnClearLocalCache.Size; this.AddRender(_btnClearRemoteCache); _btnClearRemoteCache.MouseClick += _btnClearL1Cache_MouseClick; XButton btn = new XButton(); btn.Text = "清除【二级缓存】"; btn.Location = new Point(22, _btnClearRemoteCache.Location.Y + _btnClearRemoteCache.Size.Height + 10); btn.Size = _btnClearLocalCache.Size; this.AddRender(btn); btn.MouseClick += _btnClearL2Cache_MouseClick; }
/// <summary> /// 初始化表单控件 /// </summary> private void initXapFormControl() { //窗体中控件布局 xapFormControl = new XapFormControl { Location = Panel.Location, Width = Panel.Width, Height = Panel.Height }; xapFormControl.SetEditPolicy(true); Panel = xapFormControl; saveButton = new XButton { Size = new Size(75, 25), Text = "确定" }; cancelButton = new XButton { Size = new Size(75, 25), Text = "取消" }; this.saveButton.MouseClick += saveButton_MouseClick; this.cancelButton.MouseClick += cancelButton_MouseClick; saveButton.Enabled = bAllowEdit; // cancelButton.Enabled = bAllowEdit; Text = @"处置明细"; AddRender_Btn(saveButton, cancelButton); }
protected virtual void InitButtonEvent() { foreach (Janus.Windows.UI.Tab.UITabPage tagPage in this.tabDetail.TabPages) { foreach (Control control in tagPage.Controls) { if (control is XButton) { XButton btn = control as XButton; if (control.Name.StartsWith("btnAddNew")) { btn.Click += new System.EventHandler(this.btnAddNewDetail_Click); } else if (control.Name.StartsWith("btnEdit")) { btn.Click += new System.EventHandler(this.btnEditDetail_Click); } else if (control.Name.StartsWith("btnDelete")) { btn.Click += new System.EventHandler(this.btnDeleteDetail_Click); } } } } }
/// <summary> /// 构造窗体中的 UI 对象 /// </summary> private void constructControls() { // 创建表单容器 xapFormControl = new XapFormControl { Location = Panel.Location, Width = Panel.Width, Height = Panel.Height }; // 设置可编辑状态 xapFormControl.SetEditPolicy(true); // 将表单容器添加到对话框布局容器 Panel = xapFormControl; // 新建保存按钮以及取消按钮 saveButton = new XButton { Size = new Size(75, 25), Text = "确定" }; cancelButton = new XButton { Size = new Size(75, 25), Text = "取消" }; // 注册事件 saveButton.MouseClick += new MouseEventHandler(saveButton_MouseClick); cancelButton.MouseClick += new MouseEventHandler(cancelButton_MouseClick); Text = @"变动用药"; // 将保存按钮以及取消按钮添加到窗体中 AddRender_Btn(saveButton, cancelButton); }
/// <summary> /// 添加按钮,设置窗口名称 /// </summary> /// <param name="add">false为编辑,ture为新增</param> private void AddButtons(bool add) { saveButton = new XButton { Size = new Size(75, 25), Text = "确定" }; Text = @"患者信息核对"; AddRender_Btn(saveButton); }
/// <summary> /// If the button is pressed. /// </summary> /// <param name="but"> /// The button to check. /// </param> /// <returns> /// True if the button is within range and is pressed, otherwise false. /// </returns> public bool IsPressed(XButton but) { if (but < 0 || but >= XButton.COUNT) { return(false); } return(IsPressed((uint)but)); }
public void AddListener(CallBack callback, object param) { funCallBack = callback; message = param; if (myButton == null) { myButton = this.GetComponent <XButton>(); } }
private void intButten() { // 确定、打印病历、病历打印预览,取消(关闭)按钮 this.xBtnOK = new XButton(); this.xBtnPrint = new XButton(); this.xBtnPrintView = new XButton(); this.xBtnClose = new XButton(); this.xBtnSwitch = new XButton(); // 左右布局控件 展现按钮、图例 this.rightBaseCtrl = new XBaseControl(); this.xLayoutPanel = new XLayoutPanel(); this.SuspendLayout(); /// /// xLayoutPanel /// this.xLayoutPanel.Dock = System.Windows.Forms.DockStyle.Fill; /// /// rightBaseCtrl 按钮区域 /// this.xLayoutPanel.AddControl(this.rightBaseCtrl, ControlPosition.Right, 474); Size btnSize = new Size(86, 30); this.xBtnSwitch.Text = "切换"; this.xBtnSwitch.Size = new Size(86, 30); this.xBtnSwitch.Location = new Point(190, 8); this.xBtnSwitch.MouseClick += new MouseEventHandler(xBtnSwitch_MouseClick); this.rightBaseCtrl.AddRender(this.xBtnSwitch); /// /// xBtnInovke /// this.xBtnOK.Text = "确定"; this.xBtnOK.Size = new Size(86, 30); this.xBtnOK.Location = new Point(284, 8); this.xBtnOK.MouseClick += new MouseEventHandler(xBtnOK_MouseClick); this.rightBaseCtrl.AddRender(this.xBtnOK); /// /// xBtnClose /// this.xBtnClose.Text = "取消"; this.xBtnClose.Size = new Size(86, 30); this.xBtnClose.Location = new Point(378, 8); this.xBtnClose.MouseClick += new MouseEventHandler(xBtnClose_MouseClick); this.rightBaseCtrl.AddRender(this.xBtnClose); /// /// this /// this.BackColor = Color.FromArgb(245, 245, 245); this.Controls.Add(this.xLayoutPanel); this.ResumeLayout(false); }
/// <summary> /// Checks if any button has just been pressed. /// </summary> /// <returns> /// True if any buttons have just been pressed and false otherwise. /// </returns> public bool AnyJustReleased() { for (XButton b = 0; b < XButton.COUNT; b++) { if (JustReleased(b)) { return(true); } } return(false); }
/// <summary> /// Checks if any button is currently pressed. /// </summary> /// <returns> /// True if any buttons are currently pressed and false otherwise. /// </returns> public bool AnyPressed() { for (XButton b = 0; b < XButton.COUNT; b++) { if (IsPressed(b)) { return(true); } } return(false); }
public BaseButtonGroupView AddItem(EmsButtonViewCardItem item) { XButton btn = new XButton() { Text = item.GetTitle(), TipText = item.GetTitle(), Location = new Point(0, 0), Size = buttonSize, ValueObj = item.GetNmEvent() }; btn.MouseClick += OnMouseClick; this.emsButtonList.Add(btn); this.AddRender(btn); return(this); }
public InputBuilder AddMouseXButtonUp(XButton xButtonId) { _inputList.Add(new User32.Input { Type = User32.InputType.Mouse, Mouse = { Flags = User32.MouseFlag.XUp, MouseData = (uint)xButtonId } }); return(this); }
/// ------------------------------------------------------------------------------------ protected override void Dispose(bool disposing) { if (disposing) { UnsubscribeToGridEvents(); if (ContextMenuStrip != null && !ContextMenuStrip.IsDisposed) { ContextMenuStrip.Opening -= ContextMenuStrip_Opening; } App.RemoveMediatorColleague(this); if (!CIEOptionsButton.IsDisposed) { CIEOptionsButton.Dispose(); } if (!CIESimilarOptionsButton.IsDisposed) { CIESimilarOptionsButton.Dispose(); } if (m_image != null) { m_image.Dispose(); m_image = null; } if (m_resultView != null) { m_resultView.Dispose(); m_resultView = null; } if (m_btnClose != null) { var frm = FindForm(); if (frm != null) { frm.Controls.Remove(m_btnClose); } m_btnClose.Dispose(); m_btnClose = null; } SearchQuery = null; } base.Dispose(disposing); }
/// <summary> /// 添加按钮,设置窗口名称 /// </summary> /// <param name="add">false为编辑,ture为新增</param> private void AddButtons(bool add) { saveButton = new XButton { Size = new Size(75, 25), Text = "确定" }; cancelButton = new XButton { Size = new Size(75, 25), Text = "取消" }; saveButton.MouseClick += new MouseEventHandler(saveButton_MouseClick); cancelButton.MouseClick += new MouseEventHandler(cancelButton_MouseClick); Text = @"会诊审批"; AddRender_Btn(saveButton, cancelButton); }
public OrdTplDialog() { InitializeComponent(); this.Size = new Size(1164, 800); saveButton = new XButton(); saveButton.Size = new Size(80, 24); saveButton.Text = "确认"; saveButton.MouseClick += new MouseEventHandler(saveButton_MouseClick); cancelButton = new XButton(); cancelButton.Size = new Size(80, 24); cancelButton.Text = "取消"; cancelButton.MouseClick += new MouseEventHandler(cancelButton_MouseClick); this.AddRender_Btn(saveButton, cancelButton); this.Load += new EventHandler(OrdTplDialog_Load); }
public Button CreateButton(XButton button, Window root, int row) { var result = new Button(button.Text ?? "") { X = Pos.Left(root) + button.Left, Y = Pos.Top(root) + row }; if (button.Command != null) { var act = _binder.BindCommand(button.Command); result.Clicked += act; } return(result); }
void xapFormControl_FormCreated(object sender, EventArgs e) { object o = xapFormControl.GetUserRender("skinwarn", "skininfo"); XLabel label = xapFormControl.GetUserRender("skinwarn", "skininfo") as XLabel; label.IsMoreLine = true; label.ValueText = "患者于" + this.dt_act == null ? "" : this.dt_act.ToTarget.ToString("yyyy-MM-dd") + "发现对" + drug.Name_mm + "过敏!"; reason = xapFormControl.GetUserRender("skinwarn", "skinreson") as XLabelBaseUserRender; reason.NullFlag = false; XButton saveBtn = xapFormControl.GetUserRender("skinwarn", "savebtn") as XButton; saveBtn.MouseClick += new MouseEventHandler(saveBtn_MouseClick); XButton cancelBtn = xapFormControl.GetUserRender("skinwarn", "cancelbtn") as XButton; cancelBtn.MouseClick += new MouseEventHandler(cancelBtn_MouseClick); }
private void RenderButton(XButton button) { var result = new Button(button.Text ?? "") { X = Pos.Left(this) + button.Left, Y = Pos.Top(this) + _rowCounter, }; if (button.Command != null) { var act = _binder.BindCommand(button.Command); result.Clicked += act; } SetWidth(result, button); Add(result); }
protected override frmEditBase GetEditDetailForm(object sender, XModelBase currentModel) { XButton btnAddNew = sender as XButton; switch (btnAddNew.Name) { case "btnEditFile": return(new frmStandFilesMemoryEdit(currentModel)); case "btnEditEquipment": return(new frmStandEquipmentMemoryEdit(currentModel)); default: return(null); } }
protected override frmEditBase GetAddNewDetailForm(IList <XModelBase> gridList, object sender) { XButton btnAddNew = sender as XButton; switch (btnAddNew.Name) { case "btnAddNewFile": return(new frmStandFilesMemoryEdit(gridList)); case "btnAddNewEquipment": return(new frmStandEquipmentMemoryEdit(gridList)); default: return(null); } }
void SetSelect() { if (myButton != null) { Transform part = transform.parent; XButton[] testBut = part.GetComponentsInChildren <XButton>(); int length = testBut.Length; for (int i = 0; i < length; i++) { XButton mBut = testBut[i]; mBut.SetNormal(); } if (myButton != null) { myButton.SetHighlighted(); } } }
private void InitializeComponent() { this.orCom = new XBaseControl(); orCom.Size = new System.Drawing.Size(450, 75); saveButton = new XButton(); saveButton.Size = new System.Drawing.Size(75, 25); saveButton.Location = new Point(150, 0); saveButton.Text = "确认"; this.orCom.AddRender(saveButton); cancelButton = new XButton(); cancelButton.Size = new System.Drawing.Size(75, 25); cancelButton.Location = new Point(245, 0); cancelButton.Text = "取消"; this.orCom.AddRender(cancelButton); splitContainer1 = new XLayoutPanel(); this.splitContainer1.Size = new System.Drawing.Size(475, 190); this.Text = "MmForm"; }
public XButton AddButton(Layout <View> view, string value, Action onClicked = null) { var element = new XButton { Text = value, HeightRequest = 30, VerticalOptions = LayoutOptions.Center, }; if (onClicked != null) { element.Clicked += (sender, e) => { onClicked(); }; } view.Children.Add(element); return(element); }
public Doctoradvices() { this.Size = new Size(401, 451); this.Location = new Point(100, 10); this.DarkEdgeBrush = new SolidBrush(Color.FromArgb(0, 153, 229)); Twoflag = false; btnOk = new XButton(); btnOk.Text = "确认"; btnOk.Location = new Point(this.Width - btnOk.Size.Width * 2 - 50, this.Size.Height - btnOk.Size.Height - 6); btnCancel = new XButton(); btnCancel.Text = "取消"; btnCancel.Location = new Point(btnOk.Location.X + btnOk.Size.Width + 25, btnOk.Location.Y); this.AddRender(btnOk); this.AddRender(btnCancel); this.MouseClick += new MouseEventHandler(Doctoradvices_MouseClick); this.SizeChanged += new EventHandler(Doctoradvices_SizeChanged); }
/// <summary> /// Performs Mouse button up/down simulation. /// </summary> /// <param name="mouseEvent">The mouse opperation to simulate</param> /// <param name="xButton">When mouseEvent is either XDOWN or XUP, xButton refers to either XBUTTON1 or XBUTTON2</param> public static void SimulateMouseButton(MOUSEEVENTF mouseEvent, XButton xButton = XButton.None) { var input = new INPUT(); input.Type = (uint)InputType.MOUSE; input.Data.Mouse = new MOUSEINPUT(); input.Data.Mouse.dwFlags = mouseEvent; if (mouseEvent == MOUSEEVENTF.XDOWN || mouseEvent == MOUSEEVENTF.XUP) { switch (xButton) { case XButton.XBUTTON1: input.Data.Mouse.mouseData = (int)XButton.XBUTTON1; break; case XButton.XBUTTON2: input.Data.Mouse.mouseData = (int)XButton.XBUTTON2; break; default: input.Data.Mouse.mouseData = 0; break; } } else { input.Data.Mouse.mouseData = 0; } input.Data.Mouse.dx = 0; input.Data.Mouse.dy = 0; input.Data.Mouse.time = 0; input.Data.Mouse.dwExtraInfo = IntPtr.Zero; INPUT[] inputList = new INPUT[1]; inputList[0] = input; var numberOfSuccessfulSimulatedInputs = SendInput(1, inputList, Marshal.SizeOf(typeof(INPUT))); if (numberOfSuccessfulSimulatedInputs == 0) throw new Exception(string.Format("The mouse simulation for {0} was not successful.", mouseEvent.ToString())); }