public static void DrawBackgroundWeekDayCell(long storeid, StoreDay storeday, EmployeeDay epd, GraphicsCache cache, Rectangle rect, long storeworldid, bool bFocused, int? long_absence_color) { Rectangle drawrect = Rectangle.Inflate(rect, 1, 1); if (bFocused) { Pen pen = cache.GetPen (Color.Black ); cache.FillRectangle(Painters.FOCUSED_COLOR , drawrect); cache.DrawRectangle(pen, drawrect); } else { Color color = Color.White; if (storeday.Feast) color = Painters.FEAST_COLOR; if (storeday.ClosedDay) color = Painters.CLOSEDDAY_COLOR ; if (epd.CountDailyAdditionalCharges > 0) color = Painters.ADDITIONAL_CHARGES_COLOR; if (epd.StoreWorldId != storeworldid || epd.HasLongAbsence || !epd.HasRelation || storeid != epd.StoreId) { color = Painters.DISABLE_COLOR; if (epd.HasLongAbsence) { if (long_absence_color.HasValue) color = Color.FromArgb(long_absence_color.Value); } } cache.FillRectangle(color, drawrect); } }
void VotesPanel_Paint(object sender, PaintEventArgs e) { var perLeft = Helpers.GetPercent(VotesCountLeft, VotesCountTotal); var perRight = Helpers.GetPercent(VotesCountRight, VotesCountTotal); if (perLeft == 0 && perRight == 0) { return; } Rectangle bounds = ((Control)sender).ClientRectangle; GraphicsCache cache = new GraphicsCache(e); if (perLeft > 0) { Rectangle dem = bounds; dem.Width = (int)(Math.Round(dem.Width * perLeft)); cache.FillRectangle(cache.GetSolidBrush(ColorLeft), dem); } if (perRight > 0) { Rectangle rep = bounds; rep.Width = (int)(Math.Round(rep.Width * perRight)); rep.X = bounds.Right - rep.Width; cache.FillRectangle(cache.GetSolidBrush(ColorRight), rep); } Rectangle divider = bounds; divider.X += (int)(bounds.Width * 0.5m) - 1; divider.Width = 3; cache.FillRectangle(cache.GetSolidBrush(Color.FromArgb(200, Color.White)), divider); }
void DrawBackGroundCore(GraphicsCache cache, Rectangle bounds, double completenessRatio) { Brush brush1 = new SolidBrush(Color.Green); Brush brush2 = new SolidBrush(Color.Orange); cache.FillRectangle(brush1, new Rectangle(bounds.X, bounds.Y, (int)(bounds.Width * completenessRatio), bounds.Height)); cache.FillRectangle(brush2, new Rectangle(bounds.X + (int)(bounds.Width * completenessRatio), bounds.Y, (int)(bounds.Width * (1 - completenessRatio)), bounds.Height)); }
private void DrawArea(GraphicsCache cache, Rectangle area) { area.Inflate(1, 1); using (Brush brush = new TextureBrush(even ? EvenPicture : OddPicture)) { cache.FillRectangle(brush, area); } }
protected override void DrawBackground(GraphicsCache cache) { var info = GetCaptionInfo(); var ee = info as ObjectInfoArgs; var formBorderColor = GetFormBorderColor(); cache.FillRectangle(new SolidBrush(formBorderColor), ee.Bounds); }
void FillGradient(GraphicsCache cache, Rectangle r, Color c1, Color c2, int angle) { if (r.Width <= 0 || r.Height <= 0) { return; } using (LinearGradientBrush br = new LinearGradientBrush(r, c1, c2, angle)) { cache.FillRectangle(br, r); } }
public static void DrawBackgroundWeekDayCell(long storeid, StoreDay storeday, EmployeeDay epd, GraphicsCache cache, Rectangle rect, long storeworldid, bool bFocused, int?long_absence_color) { Rectangle drawrect = Rectangle.Inflate(rect, 1, 1); if (bFocused) { Pen pen = cache.GetPen(Color.Black); cache.FillRectangle(Painters.FOCUSED_COLOR, drawrect); cache.DrawRectangle(pen, drawrect); } else { Color color = Color.White; if (storeday.Feast) { color = Painters.FEAST_COLOR; } if (storeday.ClosedDay) { color = Painters.CLOSEDDAY_COLOR; } if (epd.CountDailyAdditionalCharges > 0) { color = Painters.ADDITIONAL_CHARGES_COLOR; } if (epd.StoreWorldId != storeworldid || epd.HasLongAbsence || !epd.HasRelation || storeid != epd.StoreId) { color = Painters.DISABLE_COLOR; if (epd.HasLongAbsence) { if (long_absence_color.HasValue) { color = Color.FromArgb(long_absence_color.Value); } } } cache.FillRectangle(color, drawrect); } }
void CustomDrawAppointmentFlyoutSubject(Appointment appointment, AppointmentBandDrawerViewInfoBase viewInfo) { GraphicsCache cache = viewInfo.Cache; StringFormat stringFormat = new StringFormat(viewInfo.View.Appearance.GetStringFormat()); stringFormat.Alignment = stringFormat.LineAlignment = StringAlignment.Center; try { // Draw status Rectangle statusRect = GetStatusBounds(viewInfo); cache.FillRectangle(viewInfo.View.Status.GetBrush(), statusRect); if (viewInfo.View.Status.Type == AppointmentStatusType.Free) { // Draw a warning cache.DrawImage(GetWarningIcon(new Size(statusRect.Height, statusRect.Height)), statusRect.Location); cache.DrawString("Status is unacceptable", fontStorage.StatusFont, Brushes.Red, statusRect, stringFormat); } // Draw subject cache.DrawString(appointment.Subject, fontStorage.SubjectFont, Brushes.Black, GetSubjectBounds(viewInfo), stringFormat); } finally { stringFormat.Dispose(); } }
protected override void DrawFrameCore(GraphicsCache cache, SkinElementInfo info, FrameKind kind) { var formBorderColor = GetFormBorderColor(); cache.FillRectangle(formBorderColor, info.Bounds); }
void DrawBackground(GraphicsCache graphicsCache) { graphicsCache.FillRectangle(graphicsCache.GetSolidBrush(transparentColor), ClientRectangle); //graphicsCache.DrawRectangle(graphicsCache.GetPen(Color.Black), ClientRectangle); }
protected void DrawCustomBackground(GraphicsCache graphicsCache) { graphicsCache.FillRectangle(Color.FromArgb(60, 70, 90), ClientRectangle); }