void bed_Paint(object sender, PaintEventArgs e) { BedInfo _bed = ((BedItem)sender).Bed; //(BedInfo)((UserControl)sender).Tag; e.Graphics.SmoothingMode = SmoothingMode.HighQuality; DrawBackGroup(e, _bed); DrawContext(e, _bed); //画图标按钮 if (_bed.IsUsed == true && _selectedBed != null && _bed.Equals(_selectedBed)) //未使用状态, 在中间画标题 { DrawNurse(e, _bed); DrawButton(e.Graphics, _rectHeadPage, Resources.病案首页, ButtonState.bsNormal); DrawButton(e.Graphics, _rectTemperature, Resources.体温单, ButtonState.bsNormal); DrawButton(e.Graphics, _rectAdvice, Resources.医嘱, ButtonState.bsNormal); DrawButton(e.Graphics, _rectApply, Resources.特殊治疗, ButtonState.bsNormal); } }
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); }