I've saw many many times lots of custom controls, so I decided to build mine.
I just don't know how :$
what do I need do to do to build a custom listbox control?
You could simply create a new control, then change the designer to inherit from the listbox control.
the designer code would then look something like this (vs2010):
<Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()> _ Partial Class UserControl1 Inherits ListBox 'UserControl overrides dispose to clean up the component list. <System.Diagnostics.DebuggerNonUserCode()> _ Protected Overrides Sub Dispose(ByVal disposing As Boolean) Try If disposing AndAlso components IsNot Nothing Then components.Dispose() End If Finally MyBase.Dispose(disposing) End Try End Sub 'Required by the Windows Form Designer Private components As System.ComponentModel.IContainer 'NOTE: The following procedure is required by the Windows Form Designer 'It can be modified using the Windows Form Designer. 'Do not modify it using the code editor. <System.Diagnostics.DebuggerStepThrough()> _ Private Sub InitializeComponent() components = New System.ComponentModel.Container() End Sub End Class
To see the designer code, select "Show All Files" (button at the top of your solution explorer). Then expand the new control node in your solution explorer to see a file named something like this:
That's where you will change the line:
you will also have to delete the line:
Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font
Hope that helps.
Sure it helped, but... to use custom images ?
I was thinking on a listbox with a custom scrollbar, is that possible?
Ahh, so you want to skin a scrollbar?
This is doable, though, it's not trivial.
Take a look at this article: http://www.codeproject.com/KB/miscctrl/customscrollbar.aspx
It's modifying a panel scrollbar, but the principle is still the same.You need to override the OnPaint event to catch when the listbox is going to draw the scrollbar. Then you can do your own.
The code is in C#, but should be easy enough to follow to get the idea.
I'll take a look at it, thanks.