void updateText() { foreach (GameObject go in pointButtons) { PointButton pb = go.GetComponent <PointButton>(); if (pb != null) { for (int j = 0; j < pb.transform.childCount; j++) { GameObject childChild = pb.transform.GetChild(j).gameObject; TextMesh tm = childChild.GetComponent <TextMesh>(); if (tm != null) { if (!isSave(pb.index) && !saveExists(pb.index)) { tm.text = ""; } else { tm.text = "" + (getSlot(pb.index) + 1); } } } } } }
private void SetButtonStatus(Graphics g, PointButton button, ButtonState state, bool bFireEvent, BedInfo _bed) { //ResourceManager rm = new ResourceManager(typeof(BedCardControl)); BedCardClickEventArgs eventargs = new BedCardClickEventArgs(_bed.BedNo, _bed.PatientID); switch (button) { case PointButton.pbTitle: { Font font = new Font(Font.FontFamily, 10.5f, FontStyle.Bold); DrawButton(g, _rectBed, _bed.BedNo, font, state); if (bFireEvent && BedTitleClick != null) { eventargs.CommandParameter = "床位号"; BedTitleClick(this, eventargs); } break; } case PointButton.pbHeadPage: DrawButton(g, _rectHeadPage, Resources.病案首页, state); if (bFireEvent && HeadPageClick != null) { eventargs.CommandParameter = "病历首页"; HeadPageClick(this, eventargs); } break; case PointButton.pbTemperature: DrawButton(g, _rectTemperature, Resources.体温单, state); if (bFireEvent && TemperatureClick != null) { eventargs.CommandParameter = "体温单"; TemperatureClick(this, eventargs); } break; case PointButton.pbAdvice: DrawButton(g, _rectAdvice, Resources.医嘱, state); if (bFireEvent && AdviceClick != null) { eventargs.CommandParameter = "住院医嘱"; AdviceClick(this, eventargs); } break; case PointButton.pbApply: DrawButton(g, _rectApply, Resources.特殊治疗, state); if (bFireEvent && ApplyFormClick != null) { eventargs.CommandParameter = "特殊治疗"; ApplyFormClick(this, eventargs); } break; } }
// Use this for initialization void Start() { for (int i = 0; i < gameObject.transform.childCount; i++) { GameObject child = gameObject.transform.GetChild(i).gameObject; PointButton pb = child.GetComponent <PointButton>(); if (pb != null) { pointButtons[pb.index] = child; pb.picker = this; } } setCategory("All", 0); }
public void select(GameObject handOb, float maxDist = 100F, GameObject ignored = null) { handObLoc = handOb.transform.position; dir = handOb.transform.forward; hitOb = false; RaycastHit hit = new RaycastHit(); RaycastHit[] hits = Physics.RaycastAll(getRayStart(), dir, maxDist); distance = maxDist; for (int i = 0; i < hits.Length; i++) { if (hits[i].distance < distance && (ignored == null || PropHandler.getOldestParent(hits[i].collider.gameObject) != ignored) ) { hitOb = true; hit = hits[i]; distance = hit.distance; //break; } } if (hitOb) { if (button != null) { Renderer renderer = button.GetComponent <Renderer>(); if (renderer != null) { renderer.material = GameInitializer.instance.clearMat; } } selected = PropHandler.getOldestParent(hit.collider.gameObject).GetComponent <Prop>(); button = hit.collider.gameObject.GetComponent <PointButton>(); if (button != null && !button.canSelect()) { button = null; } hitGameObject = hit.collider.gameObject; if (button != null) { Renderer renderer = button.GetComponent <Renderer>(); if (renderer != null) { renderer.material = GameInitializer.instance.outlineMat; } } } }
void bed_MouseMove(object sender, MouseEventArgs e) { BedInfo Bed = ((BedItem)sender).Bed; //(BedInfo)((UserControl)sender).Tag; Graphics g = ((UserControl)sender).CreateGraphics(); PointButton _pbNew = PointButton.pbNone; if (Bed.IsUsed && _selectedBed != null && Bed.Equals(_selectedBed)) { if (MouseInRect(e.X, e.Y, _rectHeadPage)) { _pbNew = PointButton.pbHeadPage; } else if (MouseInRect(e.X, e.Y, _rectTemperature)) { _pbNew = PointButton.pbTemperature; } else if (MouseInRect(e.X, e.Y, _rectAdvice)) { _pbNew = PointButton.pbAdvice; } else if (MouseInRect(e.X, e.Y, _rectApply)) { _pbNew = PointButton.pbApply; } } if (Bed.IsUsed) { _rectBed = new Rectangle(1, 1, 30 + 26, _rectTitle.Height - 2); } else { _rectBed = new Rectangle((int)(_rectTitle.Width - 40) / 2, 1, 40, _rectTitle.Height - 2); } if (MouseInRect(e.X, e.Y, _rectBed)) { _pbNew = PointButton.pbTitle; } //鼠标指向的按钮没有变化 if (pbNew != _pbNew) { if (pbNew != PointButton.pbNone) { if (pbNew == PointButton.pbTitle) { ((UserControl)sender).Invalidate(_rectBed); } else if (pbNew == PointButton.pbHeadPage) { ((UserControl)sender).Invalidate(_rectHeadPage); } else if (pbNew == PointButton.pbTemperature) { ((UserControl)sender).Invalidate(_rectTemperature); } else if (pbNew == PointButton.pbAdvice) { ((UserControl)sender).Invalidate(_rectAdvice); } else if (pbNew == PointButton.pbApply) { ((UserControl)sender).Invalidate(_rectApply); } } pbNew = _pbNew; SetButtonStatus(g, pbNew, ButtonState.bsSelected, false, Bed); } //床号变亮 //SetButtonStatus(g, PointButton.pbTitle, ButtonState.bsSelected, false, Bed); }
private void Form1_KeyPress(object sender, KeyPressEventArgs e) { switch (e.KeyChar.ToString()) { case ("0"): ZeroButton.PerformClick(); break; case ("1"): OneButton.PerformClick(); break; case ("2"): TwoButton.PerformClick(); break; case ("3"): ThreeButton.PerformClick(); break; case ("4"): FourButton.PerformClick(); break; case ("5"): FiveButton.PerformClick(); break; case ("6"): SixButton.PerformClick(); break; case ("7"): SevenButton.PerformClick(); break; case ("8"): EightButton.PerformClick(); break; case ("9"): NineButton.PerformClick(); break; case ("\r"): EqualsButton.PerformClick(); break; case ("."): PointButton.PerformClick(); break; case ("/"): DivideButton.PerformClick(); break; case ("*"): TimesButton.PerformClick(); break; case ("-"): MinusButton.PerformClick(); break; case ("+"): PlusButton.PerformClick(); break; } }
/// <summary> /// 床头卡鼠标移动事件 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> void bed_MouseMove(object sender, MouseEventArgs e) { BedInfo Bed = ((BedItem)sender).Bed; //(BedInfo)((UserControl)sender).Tag; Graphics g = ((UserControl)sender).CreateGraphics(); PointButton _pbNew = PointButton.pbNone; if (Bed.IsUsed && _selectedBed != null && Bed.Equals(_selectedBed)) //if (Bed.IsUsed) { Point flpBedPoint = flpBed.PointToClient(Control.MousePosition); //鼠标相对于容器左上角的坐标 if (MouseInRect(e.X, e.Y, _rectHeadPage)) { _pbNew = PointButton.pbHeadPage; toolTip1.Show("病案首页", this, flpBedPoint.X + _rectHeadPage.Width, flpBedPoint.Y - _rectHeadPage.Height, 2000); } else if (MouseInRect(e.X, e.Y, _rectTemperature)) { _pbNew = PointButton.pbTemperature; toolTip1.Show("体温单", this, flpBedPoint.X + _rectTemperature.Width, flpBedPoint.Y - _rectTemperature.Height, 2000); } else if (MouseInRect(e.X, e.Y, _rectAdvice)) { _pbNew = PointButton.pbAdvice; toolTip1.Show("医嘱", this, flpBedPoint.X + _rectAdvice.Width, flpBedPoint.Y - _rectAdvice.Height, 2000); } else if (MouseInRect(e.X, e.Y, _rectApply)) { _pbNew = PointButton.pbApply; toolTip1.Show("特殊申请", this, flpBedPoint.X + _rectApply.Width, flpBedPoint.Y - _rectApply.Height, 2000); } } if (Bed.IsUsed || !_UnUseBedNo) { _rectBed = new Rectangle(1, 1, _bedWidth, _rectTitle.Height - 2); } else { _rectBed = new Rectangle((int)(_rectTitle.Width - _bedWidth) / 2, 1, _bedWidth, _titleHeight - 2); } //_rectBed = new Rectangle(1, 1, _bedWidth, _rectTitle.Height - 2); if (MouseInRect(e.X, e.Y, _rectBed)) { _pbNew = PointButton.pbTitle; } //鼠标指向的按钮没有变化 if (pbNew != _pbNew) { if (pbNew != PointButton.pbNone) { if (pbNew == PointButton.pbTitle) { ((UserControl)sender).Invalidate(_rectBed); } else if (pbNew == PointButton.pbHeadPage) { ((UserControl)sender).Invalidate(_rectHeadPage); } else if (pbNew == PointButton.pbTemperature) { ((UserControl)sender).Invalidate(_rectTemperature); } else if (pbNew == PointButton.pbAdvice) { ((UserControl)sender).Invalidate(_rectAdvice); } else if (pbNew == PointButton.pbApply) { ((UserControl)sender).Invalidate(_rectApply); } } pbNew = _pbNew; SetButtonStatus(g, pbNew, ButtonState.bsSelected, false, Bed); } }