private void cardView1_CustomDrawCardCaption_1(object sender, CardCaptionCustomDrawEventArgs e) { CardView view = sender as CardView; bool isFocusedCard = e.RowHandle == view.FocusedRowHandle; //The brush to draw the background of card captions. Brush backBrush, foreBrush; Color color1 = Color.FromArgb(142, 57, 80); Color color2 = Color.FromArgb(240, 140, 40); Color color3 = Color.FromArgb(70, 55, 94); Color color4 = Color.FromArgb(144, 84, 84); if (isFocusedCard) { backBrush = e.Cache.GetGradientBrush(e.Bounds, color1, color2, LinearGradientMode.ForwardDiagonal); foreBrush = Brushes.White; } else { backBrush = e.Cache.GetGradientBrush(e.Bounds, color3, color4, LinearGradientMode.ForwardDiagonal); foreBrush = Brushes.Coral; } //XtraMessageBox.Show(view.GetRowCellValue(e.RowHandle, "KHMau").ToString()); //e.CardCaption = view.GetRowCellValue(e.RowHandle, "KHMau").ToString(); Rectangle r = e.Bounds; r.Inflate(1, 0); e.Cache.FillRectangle(backBrush, r); // Draw the text. e.Appearance.DrawString(e.Cache, view.GetRowCellValue(e.RowHandle, "KHMau").ToString(), r, foreBrush); // Disable default painting. e.Handled = true; }
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; } }
private void cardView_CustomDrawCardCaption(object sender, CardCaptionCustomDrawEventArgs e) { DevExpress.XtraGrid.Views.Card.CardView view = sender as DevExpress.XtraGrid.Views.Card.CardView; (e.CardInfo as DevExpress.XtraGrid.Views.Card.ViewInfo.CardInfo).CaptionInfo.CardCaption = view.GetRowCellDisplayText(e.RowHandle, view.Columns["Nombre"]); }
private void cardView_CustomDrawCardCaption(object sender, CardCaptionCustomDrawEventArgs e) { DevExpress.XtraGrid.Views.Card.CardView view = sender as DevExpress.XtraGrid.Views.Card.CardView; (e.CardInfo as DevExpress.XtraGrid.Views.Card.ViewInfo.CardInfo).CaptionInfo.CardCaption = view.GetRowCellDisplayText(e.RowHandle, view.Columns["Nombre"]); }