/// <summary> /// Raises the <see cref="E:MeasureItem"/> event. /// </summary> /// <param name="e">The <see cref="MeasureStepListItemEventArgs"/> instance containing the event data.</param> protected virtual void OnMeasureItem(MeasureStepListItemEventArgs e) { var h = MeasureItem; 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; } int y = Padding.Top; WizardPageCollection pages = myParent.Pages; bool hit = false; for (int i = 0; i < pages.Count; i++) { var curPage = pages[i]; if (!curPage.Suppress) { Size 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; } bool 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; } } }
private void wizardControl1_MeasureStepListItem(object sender, AeroWizard.MeasureStepListItemEventArgs e) { e.ItemSize = new System.Drawing.Size(e.ItemSize.Width, (int)(TextRenderer.MeasureText("Wg", myFont).Height * 1.2)); }
private void list_MeasureItem(object sender, MeasureStepListItemEventArgs e) { OnMeasureStepListItem(e); }
/// <summary>Raises the <see cref="E:MeasureItem"/> event.</summary> /// <param name="e">The <see cref="MeasureStepListItemEventArgs"/> instance containing the event data.</param> protected virtual void OnMeasureItem(MeasureStepListItemEventArgs e) => MeasureItem?.Invoke(this, e);