Exemplo n.º 1
0
        private void DrawBackGroup(PaintEventArgs e, BedInfo _bed)
        {
            if (SelectedBed != null && SelectedBed.Equals(_bed))
            {
                _BorderColor = Color.FromArgb(194, 126, 48);
                DrawRectangleBackGroup(e.Graphics, _rectContext,
                                       Color.FromArgb(243, 196, 98),
                                       Color.FromArgb(255, 228, 138),
                                       _BorderColor, 2);
            }
            else
            {
                _BorderColor = Color.DarkKhaki;
                DrawRectangleBackGroup(e.Graphics, _rectContext,
                                       Color.FromArgb(251, 250, 247),
                                       Color.FromArgb(181, 181, 154),
                                       _BorderColor, 2);
            }

            DrawFilter(_rectTitle, Color.FromArgb(241, 251, 252), Color.FromArgb(213, 221, 234), LinearGradientMode.Vertical, e.Graphics);

            e.Graphics.DrawRectangle(new Pen(_BorderColor), _rectTitle);
            e.Graphics.DrawLine(new Pen(_BorderColor), _rectTitle.Width, _rectTitle.Top,
                                _rectTitle.Width, _rectTitle.Height);
        }
Exemplo n.º 2
0
        void bed_MouseUp(object sender, MouseEventArgs e)
        {
            BedInfo Bed = ((BedItem)sender).Bed; //(BedInfo)((UserControl)sender).Tag;

            if (e.Button == MouseButtons.Left)
            {
                Graphics g = ((UserControl)sender).CreateGraphics();
                SetButtonStatus(g, pbNew, ButtonState.bsSelected, true, Bed);
            }
        }
Exemplo n.º 3
0
        /// <summary>
        /// 画护饮食种类
        /// </summary>
        /// <param name="e"></param>
        /// <param name="_bed"></param>
        private void DrawDietType(PaintEventArgs e, BedInfo _bed)
        {
            String sText;
            Brush  fontBrush = Brushes.White;
            Font   font      = new Font(Font.FontFamily, 9.0f, FontStyle.Bold);

            if (string.IsNullOrEmpty(_bed.DietType))
            {
                DrawRectangleBackGroup(e.Graphics, _rectDietType, ColorTranslator.FromHtml("#6188B5"), ColorTranslator.FromHtml("#6188B5"), _BorderColor, 1);
                sText = "普食";
            }
            else
            {
                switch (_bed.DietType)
                {
                case "1":
                    DrawRectangleBackGroup(e.Graphics, _rectDietType, ColorTranslator.FromHtml("#6188B5"), ColorTranslator.FromHtml("#6188B5"), _BorderColor, 1);
                    sText = "普食";
                    break;

                case "2":
                    DrawRectangleBackGroup(e.Graphics, _rectDietType, ColorTranslator.FromHtml("#cd5502"), ColorTranslator.FromHtml("#cd5502"), _BorderColor, 1);
                    sText = "半流质";
                    break;

                case "3":
                    DrawRectangleBackGroup(e.Graphics, _rectDietType, ColorTranslator.FromHtml("#f8ac59"), ColorTranslator.FromHtml("#f8ac59"), _BorderColor, 1);
                    sText     = "流质";
                    fontBrush = Brushes.White;
                    break;

                case "4":
                    DrawRectangleBackGroup(e.Graphics, _rectDietType, ColorTranslator.FromHtml("#638c0b"), ColorTranslator.FromHtml("#638c0b"), _BorderColor, 1);
                    sText = "治疗食";
                    break;

                case "5":
                    DrawRectangleBackGroup(e.Graphics, _rectDietType, ColorTranslator.FromHtml("#c34953"), ColorTranslator.FromHtml("#c34953"), _BorderColor, 1);
                    sText = "禁食";
                    break;

                default:
                    DrawRectangleBackGroup(e.Graphics, _rectDietType, ColorTranslator.FromHtml("#6188B5"), ColorTranslator.FromHtml("#6188B5"), _BorderColor, 1);
                    sText = "普食";
                    break;
                }
            }
            SizeF fontsize = e.Graphics.MeasureString(sText, font);

            e.Graphics.DrawString(sText, font, fontBrush,
                                  _rectDietType.Left + (int)Math.Ceiling((_rectDietType.Width - fontsize.Width) / 2),
                                  _rectDietType.Top + (int)Math.Ceiling((_rectDietType.Height - fontsize.Height) / 2 + 1));
        }
Exemplo n.º 4
0
        /// <summary>
        /// 床头卡绘制事件
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        void bed_Paint(object sender, PaintEventArgs e)
        {
            BedInfo _bed = ((BedItem)sender).Bed; //(BedInfo)((UserControl)sender).Tag;

            e.Graphics.SmoothingMode = SmoothingMode.HighQuality;
            DrawBackGroup(e, _bed);
            DrawTitle(e, _bed);
            if (!_Simple)
            {
                DrawContext(e, _bed);
            }
            DrawBottom(e, _bed);
        }
Exemplo n.º 5
0
        void bed_MouseDown(object sender, MouseEventArgs e)
        {
            if (e.Button == MouseButtons.Left || e.Button == MouseButtons.Right)
            {
                BedInfo Bed = ((BedItem)sender).Bed;               //(BedInfo)((UserControl)sender).Tag;
                _selectedBedIndex    = ((BedItem)sender).BedIndex; //放SelectedBed的前面
                SelectedBed          = Bed;
                lastSelectedBedIndex = flpBed.Controls.IndexOf((UserControl)sender);

                if (Bed.IsUsed)
                {
                    Graphics g = ((UserControl)sender).CreateGraphics();
                    SetButtonStatus(g, pbNew, ButtonState.bsButtonDown, false, Bed);
                }
            }
        }
Exemplo n.º 6
0
        /// <summary>
        /// 画病人情况  1病重-黄色-#f8ac59 4病危-红色-#e60012  蓝色-#3c649e 其他不需要
        /// </summary>
        /// <param name="e"></param>
        /// <param name="_bed"></param>
        private void DrawSituation(PaintEventArgs e, BedInfo _bed)
        {
            Color cSituation = ColorTranslator.FromHtml("#d0d7e5");

            if (_bed.Situation != null)
            {
                if (_bed.Situation.Contains("1"))
                {
                    cSituation = ColorTranslator.FromHtml("#f8ac59");
                }
                else if (_bed.Situation.Contains("4"))
                {
                    cSituation = ColorTranslator.FromHtml("#e60012");
                }
            }
            e.Graphics.DrawLine(new Pen(cSituation, 2), 0, _rectTitle.Height, _rectTitle.Width, _rectTitle.Height);
        }
Exemplo n.º 7
0
        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);
            }
        }
Exemplo n.º 8
0
        /// <summary>
        /// 画护理级别
        /// </summary>
        /// <param name="e"></param>
        /// <param name="_bed"></param>
        private void DrawNurse(PaintEventArgs e, BedInfo _bed)
        {
            if (string.IsNullOrEmpty(_bed.NursingLever))
            {
                return;
            }

            String sText;
            Brush  fontBrush = Brushes.White;
            Font   font      = new Font(Font.FontFamily, 9.0f, FontStyle.Bold);

            switch (_bed.NursingLever)
            {
            case "1":
                DrawEllipseBackGroup(e.Graphics, _rectNurse, ColorTranslator.FromHtml("#cd5502"), ColorTranslator.FromHtml("#cd5502"), ColorTranslator.FromHtml("#cd5502"), 1);
                sText = "Ⅰ";
                break;

            case "2":
                DrawEllipseBackGroup(e.Graphics, _rectNurse, ColorTranslator.FromHtml("#f8ac59"), ColorTranslator.FromHtml("#f8ac59"), ColorTranslator.FromHtml("#f8ac59"), 1);
                sText = "Ⅱ";
                break;

            case "3":
                DrawEllipseBackGroup(e.Graphics, _rectNurse, ColorTranslator.FromHtml("#6188b5"), ColorTranslator.FromHtml("#6188b5"), ColorTranslator.FromHtml("#6188b5"), 1);
                sText     = "Ⅲ";
                fontBrush = Brushes.White;
                break;

            case "4":
                DrawEllipseBackGroup(e.Graphics, _rectNurse, ColorTranslator.FromHtml("#c34953"), ColorTranslator.FromHtml("#c34953"), ColorTranslator.FromHtml("#c34953"), 1);
                sText = "特";
                break;

            default:
                return;
            }

            SizeF fontsize = e.Graphics.MeasureString(sText, font);

            e.Graphics.DrawString(sText, font, fontBrush,
                                  _rectNurse.Left + (int)Math.Ceiling((_rectNurse.Width - fontsize.Width) / 2),
                                  _rectNurse.Top + (int)Math.Ceiling((_rectNurse.Height - fontsize.Height) / 2 + 1));
        }
Exemplo n.º 9
0
        private void DrawNurse(PaintEventArgs e, BedInfo _bed)
        {
            if (string.IsNullOrEmpty(_bed.Nurse))
            {
                return;
            }

            String sText;
            Brush  fontBrush = Brushes.Black;

            switch (_bed.Nurse)
            {
            case "01":
                DrawRectangleBackGroup(e.Graphics, _rectNurse, Color.Coral, Color.Red, Color.Maroon, 1);
                sText = "Ⅰ";
                break;

            case "02":
                DrawRectangleBackGroup(e.Graphics, _rectNurse, Color.FromArgb(255, 255, 128), Color.Yellow, Color.Olive, 1);
                sText = "Ⅱ";
                break;

            case "03":
                DrawRectangleBackGroup(e.Graphics, _rectNurse, Color.DarkBlue, Color.Blue, Color.Navy, 1);
                sText     = "Ⅲ";
                fontBrush = Brushes.White;
                break;

            case "04":
                DrawRectangleBackGroup(e.Graphics, _rectNurse, Color.Lime, Color.Green, Color.DarkGreen, 1);
                sText = "特";
                break;

            default:
                return;
            }
            Font  font     = new Font(Font.FontFamily, 9.0f, FontStyle.Regular);
            SizeF fontsize = e.Graphics.MeasureString(sText, font);

            e.Graphics.DrawString(sText, font, fontBrush,
                                  _rectNurse.Left + (int)(_rectNurse.Width - fontsize.Width) / 2,
                                  _rectNurse.Top + (int)(_rectNurse.Height - fontsize.Height) / 2 + 1);
        }
Exemplo n.º 10
0
        /// <summary>
        /// 画底部
        /// </summary>
        /// <param name="e"></param>
        /// <param name="_bed"></param>
        private void DrawBottom(PaintEventArgs e, BedInfo _bed)
        {
            if (_bed.IsUsed == true)  //未使用状态,不需要画
            {
                e.Graphics.DrawLine(new Pen(_BorderColor), 0, BedHeight - _bottomHeight, BedWidth, BedHeight - _bottomHeight);
                //画图标
                int _imgHeight = _bottomHeight - 10;
                int _imgWidth  = _imgHeight;

                int _imgX     = 8;
                int _imgY     = BedHeight - _bottomHeight;
                int _iXMargin = 4;

                _rectDietType = new Rectangle(_imgX, (_imgY + (_bottomHeight - _imgHeight) / 2), (int)Math.Ceiling(_imgWidth * 2.5), (int)_imgHeight);
                _imgX         = _imgX + (int)Math.Ceiling(_imgWidth * 2.5) + _iXMargin + 2;
                _rectNurse    = new Rectangle(_imgX, (_imgY + (_bottomHeight - _imgHeight) / 2), (int)_imgWidth, (int)_imgHeight);
                _imgX         = _imgX + (int)_imgWidth + _iXMargin;
                _rectHeadPage = new Rectangle(_imgX, (_imgY + (_bottomHeight - _imgHeight) / 2), (int)_imgWidth, (int)_imgHeight);

                _imgX            = _imgX + (int)_imgWidth + _iXMargin;
                _rectAdvice      = new Rectangle(_imgX, (_imgY + (_bottomHeight - _imgHeight) / 2), (int)_imgWidth, (int)_imgHeight);
                _imgX            = _imgX + (int)_imgWidth + _iXMargin;
                _rectApply       = new Rectangle(_imgX, (_imgY + (_bottomHeight - _imgHeight) / 2), (int)_imgWidth, (int)_imgHeight);
                _imgX            = _imgX + (int)_imgWidth + _iXMargin;
                _rectTemperature = new Rectangle(_imgX, (_imgY + (_bottomHeight - _imgHeight) / 2), (int)_imgWidth, (int)_imgHeight);
                //画图标按钮
                //if (_bed.IsUsed == true && _selectedBed != null && _bed.Equals(_selectedBed))  //未使用状态, 在中间画标题
                //{
                DrawSituation(e, _bed);
                DrawDietType(e, _bed);
                DrawNurse(e, _bed);
                if (!_Simple)
                {
                    DrawButton(e.Graphics, _rectHeadPage, Resources.医嘱2, ButtonState.bsNormal);
                    DrawButton(e.Graphics, _rectTemperature, Resources.体温单2, ButtonState.bsNormal);
                    DrawButton(e.Graphics, _rectAdvice, Resources.病案首页2, ButtonState.bsNormal);
                    DrawButton(e.Graphics, _rectApply, Resources.特殊治疗2, ButtonState.bsNormal);
                }
                //}
            }
        }
Exemplo n.º 11
0
        /// <summary>
        /// 画背景色
        /// </summary>
        /// <param name="e"></param>
        /// <param name="_bed"></param>
        private void DrawBackGroup(PaintEventArgs e, BedInfo _bed)
        {
            //选中时床卡颜色
            if (SelectedBed != null && SelectedBed.Equals(_bed))
            {
                //蓝色:8DEEEE
                //浅黄:fff7eb
                //浅黄+1:fdedd5
                //浅蓝:e4f1ff
                DrawRectangleBackGroup(e.Graphics, _rectTitle,
                                       ColorTranslator.FromHtml("#fff7eb"),
                                       ColorTranslator.FromHtml("#fdedd5"),
                                       _BorderColor, 0);
                DrawRectangleBackGroup(e.Graphics, _rectContext,
                                       ColorTranslator.FromHtml("#fff7eb"),
                                       ColorTranslator.FromHtml("#fdedd5"),
                                       _BorderColor, 2);
            }
            //
            else
            {
                DrawRectangleBackGroup(e.Graphics, _rectTitle,
                                       Color.White,
                                       ColorTranslator.FromHtml("#e4f1ff"),
                                       _BorderColor, 0);
                DrawRectangleBackGroup(e.Graphics, _rectContext,
                                       Color.White,
                                       ColorTranslator.FromHtml("#e4f1ff"),
                                       _BorderColor, 2);
            }

            //DrawFilter(_rectTitle, Color.FromArgb(241, 251, 252), Color.FromArgb(213, 221, 234), LinearGradientMode.Vertical, e.Graphics);

            e.Graphics.DrawRectangle(new Pen(_BorderColor), _rectTitle);
            //e.Graphics.DrawLine(new Pen(_BorderColor), _rectTitle.Width, _rectTitle.Top, _rectTitle.Width, _rectTitle.Height);
        }
Exemplo n.º 12
0
        private void DrawContext(PaintEventArgs e, BedInfo _bed)
        {
            e.Graphics.SmoothingMode = SmoothingMode.HighQuality;
            Font  font     = new Font(Font.FontFamily, 10.5f, FontStyle.Bold);
            SizeF fontsize = e.Graphics.MeasureString(_bed.BedNo, font);

            if (_bed.IsUsed == false)  //未使用状态, 在中间画标题
            {
                //重新计算标题栏的位置
                _rectBed = new Rectangle((int)(_rectTitle.Width - 40) / 2,
                                         1, 40, _rectTitle.Height - 2);
                e.Graphics.DrawString(_bed.BedNo, font,
                                      Brushes.Black,
                                      _rectBed.Left + (40 - fontsize.Width) / 2,
                                      _rectBed.Top + (_rectBed.Height - fontsize.Height) / 2 + 1);
                return;
            }

            _rectBed = new Rectangle(1, 1, 30 + 26, _rectTitle.Height - 2);
            //包床标志时,需要绘制包床背景
            if (_bed.Group)
            {
                DrawRectangleBackGroup(e.Graphics, _rectBed, Color.Lime, Color.Green, Color.DarkGreen, 0);
            }

            e.Graphics.DrawString(_bed.BedNo, font, Brushes.Black,
                                  _rectBed.Left + (_rectBed.Width - fontsize.Width + 20) / 2,
                                  _rectBed.Top + (_rectBed.Height - fontsize.Height) / 2 + 1);
            font = new Font(Font.FontFamily, 10f, FontStyle.Bold);
            //显示男女图标
            //ResourceManager rm = new ResourceManager(typeof(BedCardControl));
            Rectangle rect = new Rectangle(_rectTitle.Left + 2, _rectTitle.Top + (_rectTitle.Height - 20) / 2 + 1, 24, 20);

            if (_bed.Sex == "男")
            {
                e.Graphics.DrawImage(Resources.PatientMale, rect,
                                     new Rectangle(0, 0, Resources.PatientMale.Width, Resources.PatientMale.Height), GraphicsUnit.Pixel);
            }
            else if (_bed.Sex == "女")
            {
                e.Graphics.DrawImage(Resources.PatientFemale, rect,
                                     new Rectangle(0, 0, Resources.PatientFemale.Width, Resources.PatientFemale.Height), GraphicsUnit.Pixel);
            }

            //显示姓名和年龄
            String sText = _bed.PatientName + "  " + _bed.Age;

            if (sText.Length > 0)
            {
                fontsize = e.Graphics.MeasureString(sText, Font);
                e.Graphics.DrawString(sText, font,
                                      (_bed.Step >= 8) ? Brushes.Red : (_bed.Step == 6) ? Brushes.DodgerBlue : Brushes.Black,
                                      new Rectangle(_rectBed.Left + _rectBed.Width + 3,
                                                    _rectBed.Top + (_rectBed.Height - (int)fontsize.Height) / 2,
                                                    _rectTitle.Width - _rectBed.Width - 6, (int)fontsize.Height));
                e.Graphics.DrawLine(new Pen(_BorderColor),
                                    _rectBed.Width, _rectTitle.Top,
                                    _rectBed.Width, _rectTitle.Height);
            }



            //画图标

            float _imgWidth  = 20;
            float _imgHeight = 20;
            int   _imgX      = _rectContext.Width - 25;

            int _imgY = _rectContext.Top + 5;

            _rectNurse       = new Rectangle(_imgX + 3, _imgY + 3, (int)_imgWidth - 6, (int)_imgHeight - 6);
            _imgY            = _imgY + (int)_imgHeight;
            _rectHeadPage    = new Rectangle(_imgX, _imgY, (int)_imgWidth, (int)_imgHeight);
            _imgY            = _imgY + (int)_imgHeight;
            _rectTemperature = new Rectangle(_imgX, _imgY, (int)_imgWidth, (int)_imgHeight);
            _imgY            = _imgY + (int)_imgHeight;
            _rectAdvice      = new Rectangle(_imgX, _imgY, (int)_imgWidth, (int)_imgHeight);
            _imgY            = _imgY + (int)_imgHeight;
            _rectApply       = new Rectangle(_imgX, _imgY, (int)_imgWidth, (int)_imgHeight);

            //护理级别
            //DrawNurse(e, _bed);

            //显示卡片内容
            int lastfRowHeight = _rectContext.Top + 2;

            for (int i = 0; i < BedContextFields.Count; i++)
            {
                string fname  = BedContextFields[i].FieldName + ":";
                string fvalue = Tools.ToString(_bed.GetType().GetProperty(BedContextFields[i].DataPropertyName).GetValue(_bed, null));
                //标题的宽度
                int iContextLeft = (int)(e.Graphics.MeasureString(fname, BedContextFields[i].fieldFontHead).Width) + 4;
                //内容的宽度
                int iContextWidth = _rectContext.Width - iContextLeft - 10;
                int iRowTop       = lastfRowHeight;

                if (i > 0)//如果上一行内容超过一行,Y向下移
                {
                    string _fvalue = Tools.ToString(typeof(BedInfo).GetProperty(BedContextFields[i - 1].DataPropertyName).GetValue(_bed, null));
                    _fvalue = _fvalue == "" ? "测试" : _fvalue;
                    SizeF _fontsize   = e.Graphics.MeasureString(_fvalue, BedContextFields[i - 1].fieldFontContext);
                    float _frowheight = ((int)(_fontsize.Width / iContextWidth) + 1) * _fontsize.Height;
                    iRowTop = lastfRowHeight + (int)_frowheight;
                }

                lastfRowHeight = iRowTop;

                //如果本行内容超过一行,画的高度变成内容的高度
                SizeF _fontsizeC   = e.Graphics.MeasureString(fvalue, BedContextFields[i].fieldFontContext);
                float _frowheightC = ((int)(_fontsizeC.Width / iContextWidth) + 1) * _fontsizeC.Height;
                int   _fRowHeight  = (int)_frowheightC;

                e.Graphics.DrawString(fname, BedContextFields[i].fieldFontHead, BedContextFields[i].fontBrushHead, 3, iRowTop);
                if (BedFormatStyleEvent != null)
                {
                    System.Drawing.Font  _font  = (Font)BedContextFields[i].fieldFontContext.Clone();
                    System.Drawing.Brush _brush = (Brush)BedContextFields[i].fontBrushContext.Clone();
                    BedFormatStyleEvent(_bed, BedContextFields[i].DataPropertyName, ref _font, ref _brush);

                    e.Graphics.DrawString(fvalue, _font, _brush, new Rectangle(iContextLeft, iRowTop, iContextWidth, _fRowHeight));
                }
                else
                {
                    e.Graphics.DrawString(fvalue, BedContextFields[i].fieldFontContext, BedContextFields[i].fontBrushContext, new Rectangle(iContextLeft, iRowTop, iContextWidth, _fRowHeight));
                }
            }
        }
Exemplo n.º 13
0
        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);
        }
Exemplo n.º 14
0
        /// <summary>
        /// 画内容板
        /// </summary>
        /// <param name="e"></param>
        /// <param name="_bed"></param>
        private void DrawContext(PaintEventArgs e, BedInfo _bed)
        {
            e.Graphics.SmoothingMode = SmoothingMode.HighQuality;
            Font  font        = new Font(Font.FontFamily, 10.5f, FontStyle.Regular);
            SizeF fontsize    = e.Graphics.MeasureString(_bed.BedNo, font);
            int   iLeftMargin = 8;
            int   iTopMargin  = 5;
            int   iRow        = 0;

            if (_bed.IsUsed == true)  //未使用状态,不需要画
            {
                //显示卡片内容
                int lastfRowHeight = _rectContext.Top + iTopMargin + iTopMargin;
                for (int i = 0; i < BedContextFields.Count; i++)
                {
                    string fvalue = Tools.ToString(_bed.GetType().GetProperty(BedContextFields[i].DataPropertyName).GetValue(_bed, null));
                    if (BedContextFields[i].FieldName.Contains("住院号"))
                    {
                        //如果本行内容超过一行,画的高度变成内容的高度
                        e.Graphics.DrawString(fvalue, BedContextFields[i].fieldFontContext, BedContextFields[i].fontBrushContext, iLeftMargin, lastfRowHeight);
                    }
                    else if (BedContextFields[i].FieldName.Replace(" ", "").Contains("科室"))
                    {
                        //科室内容的宽度
                        int iDeptWidth = (int)(e.Graphics.MeasureString(fvalue, BedContextFields[i].fieldFontHead).Width) + 4;
                        e.Graphics.DrawString(fvalue, BedContextFields[i].fieldFontContext, BedContextFields[i].fontBrushContext, BedWidth - iDeptWidth, lastfRowHeight);
                    }
                    else
                    {
                        iRow += 1;
                        string fname = BedContextFields[i].FieldName + ":";
                        //标题的宽度
                        int iNameWidth = (int)(e.Graphics.MeasureString(fname, BedContextFields[i].fieldFontHead).Width) + 4;
                        //内容的宽度
                        int iValueWidth = _rectContext.Width - iNameWidth;
                        int iRowTop     = lastfRowHeight;

                        if (iRow > 0)//如果上一行内容超过一行,Y向下移
                        {
                            string _fvalue = Tools.ToString(typeof(BedInfo).GetProperty(BedContextFields[i - 1].DataPropertyName).GetValue(_bed, null));
                            _fvalue = _fvalue == "" ? "测试" : _fvalue;
                            SizeF _fontsize = e.Graphics.MeasureString(_fvalue, BedContextFields[i - 1].fieldFontContext);
                            //每个值都只占一行,所以这里的计算间隔可暂时忽略
                            float _frowheight = 1 * _fontsize.Height;//((int)(_fontsize.Width / iValueWidth) + 1) * _fontsize.Height;
                            iRowTop = lastfRowHeight + (int)_frowheight + iTopMargin;
                        }
                        lastfRowHeight = iRowTop;

                        //如果本行内容超过一行,画的高度变成内容的高度
                        SizeF _fontsizeC = e.Graphics.MeasureString(fvalue, BedContextFields[i].fieldFontContext);
                        int   iRowCount  = (int)Math.Ceiling(_fontsizeC.Width / iValueWidth);
                        if (iRowCount > 1)
                        {
                            fvalue = fvalue.Substring(0, fvalue.Length / iRowCount - 1) + "..";
                        }
                        float _frowheightC = iRowCount * _fontsizeC.Height;
                        int   _fRowHeight  = (int)_frowheightC;

                        e.Graphics.DrawString(fname, BedContextFields[i].fieldFontHead, BedContextFields[i].fontBrushHead, iLeftMargin, iRowTop);
                        if (BedFormatStyleEvent != null)
                        {
                            System.Drawing.Font  _font  = (Font)BedContextFields[i].fieldFontContext.Clone();
                            System.Drawing.Brush _brush = (Brush)BedContextFields[i].fontBrushContext.Clone();
                            BedFormatStyleEvent(_bed, BedContextFields[i].DataPropertyName, ref _font, ref _brush);

                            e.Graphics.DrawString(fvalue, _font, _brush, new Rectangle(iNameWidth, iRowTop, iValueWidth, _fRowHeight));
                        }
                        else
                        {
                            e.Graphics.DrawString(fvalue, BedContextFields[i].fieldFontContext, BedContextFields[i].fontBrushContext, new Rectangle(iNameWidth, iRowTop, iValueWidth, _fRowHeight));
                        }
                    }
                }
            }
            else
            {
                if (SelectedBed != null && SelectedBed.Equals(_bed))
                {
                    int iUnUseHeight = BedHeight - _titleHeight;
                    int iLeft        = (BedWidth - Resources.空床图2.Width) / 2;
                    int iTop         = (iUnUseHeight - Resources.空床图2.Height) / 2 + _titleHeight;
                    //画空床
                    Rectangle rect = new Rectangle(iLeft, iTop, Resources.空床图2.Width, Resources.空床图2.Height);
                    e.Graphics.DrawImage(Resources.空床图2, rect,
                                         new Rectangle(0, 0, Resources.空床图2.Width, Resources.空床图2.Height), GraphicsUnit.Pixel);
                }
                else
                {
                    int iUnUseHeight = BedHeight - _titleHeight;
                    int iLeft        = (BedWidth - Resources.空床图.Width) / 2;
                    int iTop         = (iUnUseHeight - Resources.空床图.Height) / 2 + _titleHeight;
                    //画空床
                    Rectangle rect = new Rectangle(iLeft, iTop, Resources.空床图.Width, Resources.空床图.Height);
                    e.Graphics.DrawImage(Resources.空床图, rect,
                                         new Rectangle(0, 0, Resources.空床图.Width, Resources.空床图.Height), GraphicsUnit.Pixel);
                }
            }
        }
Exemplo n.º 15
0
        /// <summary>
        /// 画床位卡头 包床的床头卡背景为绿色   出院医嘱的病人名字红色
        /// </summary>
        /// <param name="e"></param>
        /// <param name="_bed"></param>
        private void DrawTitle(PaintEventArgs e, BedInfo _bed)
        {
            e.Graphics.SmoothingMode = SmoothingMode.HighQuality;
            Font  font     = new Font(Font.FontFamily, 10.5f, FontStyle.Bold);
            SizeF fontsize = e.Graphics.MeasureString(_bed.BedNo, font);

            int iX = 1;
            int iY = _rectBed.Top + (int)(((float)_rectBed.Height - fontsize.Height) / 2) + 1;

            if (_bed.IsUsed == false)  //未使用状态, 在中间画标题
            {
                //重新计算标题栏的位置
                if (_UnUseBedNo)
                {
                    _rectBed = new Rectangle((int)(_rectTitle.Width - _bedWidth) / 2, 1, _bedWidth, _titleHeight - 2);
                }
                else
                {
                    _rectBed = new Rectangle(iX, 1, _bedWidth, _rectTitle.Height - 2);
                }
                e.Graphics.DrawString(_bed.BedNo, font,
                                      Brushes.Black,
                                      _rectBed.Left + (_bedWidth - fontsize.Width) / 2,
                                      _rectBed.Top + (_rectBed.Height - fontsize.Height) / 2 + 1);
            }
            else
            {
                //1.画床位号
                _rectBed = new Rectangle(iX, 1, _bedWidth, _rectTitle.Height - 2);
                //包床标志时,需要绘制包床背景
                if (_bed.Group)
                {
                    DrawRectangleBackGroup(e.Graphics, _rectBed, ColorTranslator.FromHtml("#B4EEB4"), ColorTranslator.FromHtml("#B4EEB4"), Color.DarkGreen, 0);
                }
                //ColorTranslator.FromHtml("#B3EE3A")   Color.FromArgb(255, 244, 230) Color.FromArgb(255, 209, 146)
                //e.Graphics.DrawString(_bed.BedNo, font, Brushes.Black,
                //                _rectBed.Left + (_rectBed.Width - fontsize.Width) / 2,
                //                iY);
                e.Graphics.DrawString(_bed.BedNo, font, Brushes.Black,
                                      new Rectangle(_rectBed.Left + (int)(_rectBed.Width - fontsize.Width) / 2,
                                                    iY,
                                                    iX + (int)Math.Ceiling(fontsize.Width),
                                                    (int)fontsize.Height));

                font = new Font(Font.FontFamily, 10f, FontStyle.Bold);
                //2.画姓名
                iX = iX + _bedWidth + 3;
                String sName = _bed.PatientName;
                if (sName.Length > 0)
                {
                    fontsize = e.Graphics.MeasureString(sName, Font);
                    e.Graphics.DrawString(sName, font,
                                          (_bed.Step == 1) ? new SolidBrush(ColorTranslator.FromHtml("#c34953")) : Brushes.Black,
                                          new Rectangle(iX,
                                                        iY,
                                                        iX + (int)Math.Ceiling(fontsize.Width),
                                                        (int)fontsize.Height));
                    //e.Graphics.DrawLine(new Pen(_BorderColor),_rectBed.Width, _rectTitle.Top, _rectBed.Width, _rectTitle.Height);
                }

                if (!_Simple)
                {
                    //3.画年龄
                    String sAge = _bed.Age;
                    if (sAge.Length > 0)
                    {
                        fontsize = e.Graphics.MeasureString(sAge, Font);
                        e.Graphics.DrawString(sAge, font,
                                              Brushes.Black,
                                              new Rectangle(BedWidth - (int)Math.Ceiling(fontsize.Width) - 4,
                                                            iY,
                                                            (int)Math.Ceiling(fontsize.Width) + 4,
                                                            (int)fontsize.Height));
                        // e.Graphics.DrawLine(new Pen(_BorderColor), _rectBed.Width, _rectTitle.Top,_rectBed.Width, _rectTitle.Height);
                    }
                    //4.显示男女图标
                    int iImageSize = 14;
                    iX = (int)Math.Ceiling(fontsize.Width) + iImageSize;
                    Rectangle rect = new Rectangle(BedWidth - iX - 3,
                                                   iY,
                                                   iImageSize, iImageSize);
                    if (_bed.Sex == "男")
                    {
                        e.Graphics.DrawImage(Resources.男, rect,
                                             new Rectangle(0, 0, Resources.男.Width, Resources.男.Height), GraphicsUnit.Pixel);
                    }
                    else if (_bed.Sex == "女")
                    {
                        e.Graphics.DrawImage(Resources.女, rect,
                                             new Rectangle(0, 0, Resources.女.Width, Resources.女.Height), GraphicsUnit.Pixel);
                    }
                }
            }
        }
Exemplo n.º 16
0
        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;
            }
        }
Exemplo n.º 17
0
        /// <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);
            }
        }