packages/Windows API Code Pack 1.1/source/Samples/DirectX/CS/Direct3D10/MeshBrowser/MeshBrowserForm.cs
/// <summary>
/// Handles the DrawItem event of the listBox control.
/// Displays file names only instead of full file paths for known meshes.
/// </summary>
/// <param name="sender">The source of the event.</param>
/// <param name="e">The <see cref="System.Windows.Forms.DrawItemEventArgs"/> instance containing the event data.</param>
Handles the DrawItem event of the listBox control.
Displays file names only instead of full file paths for known meshes.
Handles the DrawItem event of the listBox control . Displays file names only instead of full file paths for known meshes .
private void listBox_DrawItem(object sender, DrawItemEventArgs e)
        {
            ListBox lb = sender as ListBox;
            e.DrawBackground();
            e.Graphics.DrawString(Path.GetFileName((string)lb.Items[e.Index]),
                e.Font, myBrush, e.Bounds, System.Drawing.StringFormat.GenericDefault);
            e.DrawFocusRectangle();
        }
private void listBox_DrawItem ( object sender , DrawItemEventArgs e ) { ListBox lb = sender as ListBox ; e . DrawBackground ( ) ; e . Graphics . DrawString ( Path . GetFileName ( ( string ) lb . Items [ e . Index ] ) , e . Font , myBrush , e . Bounds , System . Drawing . StringFormat . GenericDefault ) ; e . DrawFocusRectangle ( ) ; }
Handles the DrawItem event of the listBox control.
Handles the DrawItem event of the listBox control .
sender
object
The source of the event.
The source of the event .
e
DrawItemEventArgs
The  instance containing the event data.
The instance containing the event data .