473,387 Members | 1,771 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

creating custon buttons

hi, i was wondering how i could create my own buttons, like with unique
shapes and such. i kno theres a way but i dont kno how...
Nov 21 '05 #1
13 1182
iwdu

From an old message from Herfried, be aware that region only works on
24Kbits color setting and not on W98/Me.

\\\
Dim intDiameter As Integer = 300
Me.Height = intDiameter
Me.Width = intDiameter
Dim p As New Drawing2D.GraphicsPath()
p.AddEllipse(0, 0, intDiameter, intDiameter)
Me.Region = New Region(p)
Me.BackColor = Color.Red
///
I hope this helps,
Cor
Nov 21 '05 #2
that didnt create a button....i dunno if i explained myself rite but like,
create a button from scratch so i can use it in events and it can be any
shape and such
Nov 21 '05 #3
inherit the buttonbase class in a control, and if you need any standard
shapes look at the controlpaint class to draw things like 3D boarders,
glyphs (arrows, shapes, etc) that are common in windows
"iwdu15" <iw****@discussions.microsoft.com> wrote in message
news:84**********************************@microsof t.com...
that didnt create a button....i dunno if i explained myself rite but like,
create a button from scratch so i can use it in events and it can be any
shape and such

Nov 21 '05 #4
Iwdu15,

If you don't know how to create a button, than I would in your case wait
until that I know that very good before you start at a shaped button.

Class mybutton
inherits butoon
Public Sub New
Dim intDiameter As Integer = 300
Me.Height = intDiameter
Me.Width = intDiameter
Dim p As New Drawing2D.GraphicsPath()
p.AddEllipse(0, 0, intDiameter, intDiameter)
Me.Region = New Region(p)
Me.BackColor = Color.Red
End sub New
///

Just my idea

Cor
Nov 21 '05 #5
sorry, im a new programmer.....do u have any sample code or kno anywhere i
could find some?
Nov 21 '05 #6
i can create buttons easily from within my forms class, now i want to create
custom ones
Nov 21 '05 #7
Did you not see the sample that I made

However, here I made it complete in a form

\\\\
Private WithEvents butt As New mybutton
Private Sub Form1_Load(ByVal sender As Object, _
ByVal e As System.EventArgs) Handles MyBase.Load
Me.Controls.Add(butt)
End Sub
Private Sub butt_Click(ByVal sender As Object, _
ByVal e As System.EventArgs) Handles butt.Click
MessageBox.Show("Hello it is red")
End Sub
End Class
Class mybutton
Inherits Button
Public Sub New()
Dim intDiameter As Integer = 30
Me.Height = intDiameter
Me.Width = intDiameter
Dim p As New Drawing2D.GraphicsPath
p.AddEllipse(0, 0, intDiameter, intDiameter)
Me.Region = New Region(p)
Me.BackColor = Color.Red
End Sub
End Class
///

I hope this helps,

Cor
Nov 21 '05 #8
sorry, i did see the code but i didnt kno how to use it with a form, thanks a
ton for that!
Nov 21 '05 #9
umm i have a problem, if i change the coordinates from "0,0" to anything
else, it wont draw it, the program runs but nothings there
Nov 21 '05 #10
> umm i have a problem, if i change the coordinates from "0,0" to anything
else, it wont draw it, the program runs but nothings there


Can you show how you did that, don't than expect an answer today from me,
you get that than probably tomorrow.

Cor
Nov 21 '05 #11
sure, heres the code that relates to it:

Class mybutton

Inherits Button

Public Sub New()

Dim intDiameter As Integer = 55
Me.Height = intDiameter
Me.Width = intDiameter
Dim p As New Drawing2D.GraphicsPath
p.AddEllipse(100, 100, intDiameter, intDiameter)
Me.Region = New Region(p)
Me.BackColor = Color.Red

End Sub
End Class

Dim WithEvents butt As New mybutton 'ive tired using "Public" also, but i
prefer using dim

Me.Controls.Add(butt)
Nov 21 '05 #12
iwdu15 wrote:
sure, heres the code that relates to it:

Class mybutton

Inherits Button

Public Sub New()

Dim intDiameter As Integer = 55
Me.Height = intDiameter
Me.Width = intDiameter
Dim p As New Drawing2D.GraphicsPath
p.AddEllipse(100, 100, intDiameter, intDiameter)
Me.Region = New Region(p)
Me.BackColor = Color.Red

End Sub
End Class

Dim WithEvents butt As New mybutton 'ive tired using "Public" also, but i
prefer using dim

Me.Controls.Add(butt)


You don't want to change the placement of the ellipse, since that is
drawing in relation to the button, not the form. what you told it to do
is to start drawing the ellipse 100px left of the top of the button and
100px down from the top of the button, which is probably in no man's
land as far as the button is concerned. If you want to move the button,
you need to change the button's location.

Try:
Butt.Top = 100
Butt.Left = 100
Me.Controls.Add(butt)
Nov 21 '05 #13
awsome!!! thanks a ton!!!!
Nov 21 '05 #14

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Altramagnus | last post by:
I have 30 - 40 type of different window. For each type I need about 20 instances of the window. When I try to create them, I get "Error creating window handle" My guess is there is a maximum...
3
by: ree32 | last post by:
I am creating a page with the usual feature to access a DB and edit. I have the common delete command in the datalist. But I need to create a prompt to display and ask the user again if they...
10
by: Tor Inge Rislaa | last post by:
Creating Control Array How to create an array of buttons, with common procedures based on the index of the control. How would this Example from VB 6.0 be in VB.NET? Private Sub...
2
by: epigram | last post by:
I'm dynamically creating a number of radio buttons on my aspx page based upon data read from a db. Each radio button has autopostback turned on. I'm experiencing two problems. 1) I am reading...
5
by: sam | last post by:
Hi all, I am dynamically creating a table rows and inerting radio buttons which are also dynamically created. Everything works fine in Firefox as expected. But I am not able to select radio...
0
by: ronlahav | last post by:
Dear all i wonser (the mile stones), how can i create a custom setup in which i can choose 3 setup options 1. server install 2. client install 3. other modules
4
by: Ron | last post by:
I want to create 10 buttons on a form at runtime, the code below is only creating one button labeled 1. Any idea what I am doing wrong? Public Class Form1 Public code(10) As String Public...
1
by: Chandrusekar | last post by:
Hi Everyone. My requirement is to create two Radio buttons in SSRS. The radio buttons need to be the parameters for the Stored Procedures pulling out the report. The Radio buttons will be for the...
5
by: Doc John | last post by:
I need to create several Windows Forms and I'm thinking of creating a base Form from which I can derive all Forms. Is it possible to include something in that Base Form so that all Forms I create...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.