Пример #1
0
        private void cardViewBedMapping_CustomDrawCardCaption(object sender, CardCaptionCustomDrawEventArgs e)
        {
            try
            {
                DataRow dr = cardViewBedMapping.GetDataRow(e.RowHandle);
                if (dr == null)
                {
                    return;
                }
                decimal syxh = CheckCurrentRow(dr);
                if (syxh != -1)
                {
                    e.Appearance.ForeColor = Color.White;
                    e.Appearance.Font      = new Font("宋体", 18F, FontStyle.Bold);
                    Brush    brushFocused = new System.Drawing.Drawing2D.LinearGradientBrush(e.Bounds, Color.LavenderBlush, Color.Navy, 270);
                    CardView cv           = sender as CardView;

                    Rectangle r = e.Bounds;
                    ControlPaint.DrawBorder3D(e.Graphics, r, Border3DStyle.RaisedInner);
                    r.Inflate(-1, -1);
                    e.Graphics.FillRectangle(brushFocused, r);
                    r.Inflate(-2, 0);
                    e.Appearance.DrawString(e.Cache, cv.GetCardCaption(e.RowHandle), r);
                    e.Graphics.FillRectangle(e.Appearance.GetBorderBrush(e.Cache), e.Bounds.X - 1, e.Bounds.Y - 1, 1, e.Bounds.Height);
                    e.Graphics.FillRectangle(e.Appearance.GetBorderBrush(e.Cache), e.Bounds.X - 1, e.Bounds.Y - 1, e.Bounds.Width + 1, 1);
                    e.Graphics.FillRectangle(e.Appearance.GetBorderBrush(e.Cache), e.Bounds.X + e.Bounds.Width, e.Bounds.Y - 1, 1, e.Bounds.Height);

                    Point StartPoint = new Point(e.Bounds.Location.X + 3, e.Bounds.Location.Y + 7);
                    int   PicNum     = 0;
                    if (!string.IsNullOrEmpty(dr[PatientWardField.Fieldbrxb].ToString()))
                    {
                        PicNum = Convert.ToInt32(dr[PatientWardField.Fieldbrxb]) - 1;
                    }
                    else if (!string.IsNullOrEmpty(dr[PatientWardField.Fieldcwlx].ToString()))
                    {
                        PicNum = Convert.ToInt32(dr[PatientWardField.Fieldcwlx]) - 1100 + 2;
                    }
                    if ((!string.IsNullOrEmpty(dr[PatientWardField.Fieldcwdm].ToString())) && (PicNum <= 3))
                    {
                        e.Graphics.DrawImageUnscaled(imageListcwdm.Images[PicNum], StartPoint);
                    }
                    e.Handled = true;
                }

                //画框架病人的卡片标题背景
                CardInfo ccvi = e.CardInfo as CardInfo;

                e.Appearance.ForeColor = Color.Black;
                if (Convert.ToString(dr[PatientWardField.Fieldjcbz]) == "0")
                {
                    ccvi.CaptionInfo.CardCaption = dr[PatientWardField.Fieldcwdm].ToString();
                }
                else if (Convert.ToString(dr[PatientWardField.Fieldjcbz]) == "1")
                {
                    string str;
                    if (((dr[PatientWardField.Fieldybqdm].ToString().Trim() != m_WardId) || (dr[PatientWardField.Fieldyksdm].ToString().Trim() != m_DeptId)) && (!string.IsNullOrEmpty(dr[PatientWardField.Fieldybqdm].ToString()) && !string.IsNullOrEmpty(dr[PatientWardField.Fieldyksdm].ToString())))
                    {
                        str = dr[PatientWardField.Fieldcwdm].ToString() + "借入";
                    }
                    else
                    {
                        str = dr[PatientWardField.Fieldcwdm].ToString() + "借出";
                    }
                    ccvi.CaptionInfo.CardCaption = str;
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }