private void DefaultDrawItem(DrawStepListItemEventArgs e) { Color fc = ForeColor, bc = BackColor; var level = GetStepTextIndentLevel(e.Item); var isRTL = RightToLeft == RightToLeft.Yes; var tffrtl = isRTL ? TextFormatFlags.Right : 0; Rectangle rect, prect; if (isRTL) { Split(e.Bounds, Width - bulletWidth, out rect, out prect); prect.X = e.Bounds.Width - (bulletWidth * (level + 1)); rect.Width = Width - (bulletWidth * (level + 1)); } else { Split(e.Bounds, bulletWidth, out prect, out rect); prect.X = bulletWidth * level; rect.X = bulletWidth * (level + 1); } if (!e.Completed) { fc = SystemColors.GrayText; } using (Brush br = new SolidBrush(bc)) e.Graphics.FillRectangle(br, Rectangle.Union(rect, prect)); TextRenderer.DrawText(e.Graphics, e.Completed ? (isRTL ? "3" : "4") : "a", ptrFont, prect, fc, defBulletTextFormat | tffrtl); TextRenderer.DrawText(e.Graphics, GetStepText(e.Item), e.Selected ? boldFont : Font, rect, fc, defStringTextFormat | tffrtl); }
/// <summary> /// Raises the <see cref="E:AeroWizard.StepWizardControl.DrawStepListItem" /> event. /// </summary> /// <param name="e">The <see cref="DrawStepListItemEventArgs"/> instance containing the event data.</param> protected virtual void OnDrawStepListItem(DrawStepListItemEventArgs e) { var h = DrawStepListItem; if (h != null) { h(this, e); } }
/// <summary> /// Raises the <see cref="E:System.Windows.Forms.Control.Paint" /> event. /// </summary> /// <param name="e">A <see cref="T:System.Windows.Forms.PaintEventArgs" /> that contains the event data.</param> protected override void OnPaint(PaintEventArgs e) { base.OnPaint(e); if (myParent == null) { return; } var y = Padding.Top; var pages = myParent.Pages; var hit = false; for (var i = 0; i < pages.Count; i++) { var curPage = pages[i]; if (!curPage.Suppress) { var itemSize = new Size(Width - Padding.Horizontal, defItemHeight); if (OwnerDraw) { var meArg = new MeasureStepListItemEventArgs(e.Graphics, Font, curPage, new Size(Width, defItemHeight)); OnMeasureItem(meArg); itemSize = meArg.ItemSize; } if (y + itemSize.Height > (Height - Padding.Bottom)) { break; } var isSelected = myParent.SelectedPage == curPage; if (isSelected) { hit = true; } var eArg = new DrawStepListItemEventArgs(e.Graphics, Font, new Rectangle(new Point(Padding.Left, y), itemSize), curPage, isSelected, hit); if (OwnerDraw) { OnDrawItem(eArg); } else { DefaultDrawItem(eArg); } y += itemSize.Height; } } }
/// <summary> /// Raises the <see cref="E:DrawItem"/> event. /// </summary> /// <param name="e">The <see cref="DrawStepListItemEventArgs"/> instance containing the event data.</param> protected virtual void OnDrawItem(DrawStepListItemEventArgs e) { DrawItem?.Invoke(this, e); }
private void list_DrawItem(object sender, DrawStepListItemEventArgs e) { OnDrawStepListItem(e); }