How i can make custom controls

Do you need something made? then ask in here.
Forum rules
Please LOCK your topics once you have found the solution to your question so we know you no longer require help with your query.
7 posts Page 1 of 1
Contributors
User avatar
CleverBoy
VIP - Donator
VIP - Donator
Posts: 395
Joined: Mon Dec 06, 2010 8:29 pm

How i can make custom controls
CleverBoy
Guys i need help on how i can make custom control "User Control"
if you can make a tutorial or give me youtube link i will give you 5 credits
or if it was very advanced 10 credits

Thanks
Code'N'Stuff
OneTeam..OneDream
Join ABSplash Team & Earn $$
ABSplash Site - Workpad - (VB) Custom Buttons 2 ways
User avatar
mandai
Coding God
Coding God
Posts: 2585
Joined: Mon Apr 26, 2010 6:51 pm

Re: How i can make custom controls
mandai
User avatar
CleverBoy
VIP - Donator
VIP - Donator
Posts: 395
Joined: Mon Dec 06, 2010 8:29 pm

but how i make a button with codes like if i want to change text
Code: Select all
MyCustomButton1.text = "Button1"
and other codes like
Code: Select all
MyCustomButton1.enabled = true
MyCustomButton1.BackColor = Color.Black
etc;;
How i do this ?

+ how i make them in properties

Image

Uploaded with ImageShack.us
Code'N'Stuff
OneTeam..OneDream
Join ABSplash Team & Earn $$
ABSplash Site - Workpad - (VB) Custom Buttons 2 ways
User avatar
mandai
Coding God
Coding God
Posts: 2585
Joined: Mon Apr 26, 2010 6:51 pm

Re: How i can make custom controls
mandai
You can set the button's modifier to public.
User avatar
CleverBoy
VIP - Donator
VIP - Donator
Posts: 395
Joined: Mon Dec 06, 2010 8:29 pm

Thanks Mandai Alot you help me 50%
now how i set things in Properties like in the ScreanShot ?

-Sorry for my bad Eng
Code'N'Stuff
OneTeam..OneDream
Join ABSplash Team & Earn $$
ABSplash Site - Workpad - (VB) Custom Buttons 2 ways
User avatar
mandai
Coding God
Coding God
Posts: 2585
Joined: Mon Apr 26, 2010 6:51 pm

Re: How i can make custom controls
mandai
You can make a new property for the control with this:
Code: Select all
    Dim test As String = ""
    Public Property example() As String
        Get
            Return test
        End Get
        Set(ByVal value As String)
            test = value
        End Set
    End Property
User avatar
dj1437
VIP - Donator
VIP - Donator
Posts: 504
Joined: Tue Dec 21, 2010 2:02 am

Re: How i can make custom controls
dj1437
You will need a few resources, a up picture, down, and hover, then insert this code
Code: Select all
Imports System.Windows.Forms
Public Class The buttons name here
    Inherits Windows.Forms.Button
    Public Sub New()
        Me.Size = New System.Drawing.Point
        Me.FlatStyle = Windows.Forms.FlatStyle.Flat
        Me.FlatAppearance.BorderSize = 0
        Me.FlatAppearance.MouseDownBackColor = Drawing.Color.Transparent
        Me.FlatAppearance.MouseOverBackColor = Drawing.Color.Transparent
        Me.BackColor = System.Drawing.Color.Transparent
        Me.Text = ("ButtonNameHere")
        Me.ForeColor = Drawing.Color.White
        Me.BackgroundImage = My.Resources.Up
        Me.BackgroundImageLayout = ImageLayout.Stretch
    End Sub

    Private Sub Class1_MouseDown(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles Me.MouseDown
        Me.BackgroundImage = My.Resources.down
        Me.BackgroundImageLayout = ImageLayout.Stretch
    End Sub

    Private Sub Class1_MouseHover(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.MouseHover
        Me.BackgroundImage = My.Resources.hover
        Me.BackgroundImageLayout = ImageLayout.Stretch
    End Sub

    Private Sub Class1_MouseLeave(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.MouseLeave
        Me.BackgroundImage = My.Resources.Regular
        Me.BackgroundImageLayout = ImageLayout.Stretch
    End Sub

    Private Sub Class1_MouseUp(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles Me.MouseUp
        Me.BackgroundImage = My.Resources.up
        Me.BackgroundImageLayout = ImageLayout.Stretch
    End Sub
End Class
once edited this peice of code and stuff go to build project and it will make a .dll of the things name, also you can edit this thing so that it can be a toolstrip, progressbar, statusstrip, tab control or many other things :P
7 posts Page 1 of 1
Return to “Tutorial Requests”