I need help in changing the shape of a command button to a circle. This is my 1st time using VB. what i am doing is making a stand along program that looks like the control panel of the machine I work on. This is to train operators in a classroom. I have completed half of the program but dont like the 4 sided cmd button.
Any help will be great.
Creating elipictical shaped buttons is a bit advanced if you are new to vb.
There are thrid party controls that can do this for you very easily.
If you really want to try it, you can simulate one easier by using images and
a picturebox control. One image for up, one for down, and one for disabled,
etc. Then in each event, switch the images to correspond to the event,
Mouse_Down, Mouse_Up, Command_Click, etc.
HTH
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum.
I've done this sample for someone ages ago but I gues it just comes handy once in awhile. It clearly demonstrates what Rob suggested with images.
It's a quick sample and should treated as one.
The cmb button shape did not work for me so i tried this.
made a label transperent and placed a circle shape on top with Backcolor yellow.
setup code so.
Private sub label5_click()
shape1.Backcolor = &HFF00&
Endsub
This works great it changes from yellow to green but how can i get it to toggle between the 2 colors every time i click the label.
Dim flag As Boolean
flag=true
shape1.Backcolor = vbyellow
Private Sub label5_click()
If flag=true Then
shape1.Backcolor = &HFF00&
flag=false
Else
shape1.Backcolor = vbyellow
flag=true
endif
Exit Sub
Thanks for the help but with the code you all showed I kept getting errors.
So after a good drink i fixed it like so.
Private Sub label5_click()
If Shape1.BackColor = &HFFFF& Then
Shape1.BackColor = &HFF00&
Else: Shape1.BackColor = &HFFFF&
End If
End Sub
As the name states I am a newbie. Just picked up a book Beginning VB6 by Peter Wright a week ago and am trying to make a interactive operators manual to help me train operators on the machinery i install.
I might have bitten of more than i can chew but you got to start some where.
THANK FOR THE HELP.
There will be more questions as i progress
Last edited by newbie 2 vb; Jan 3rd, 2005 at 02:17 AM.
Reason: Resolved
you might want to move the label too if you want it to look realistic (only if 3d type button), but you'll have to use public vars for original label position because using, for example, label1.left = label1.left + 10 for down event and label1.left = label1.left - 10 for up event might cause problems. Should be for down event
VB Code:
originallabel1left = label1.left
label1.left = label1.left + 10
and
label1.left = originallabel1left
for up event. Same for .top to move it up and down
Here is a quick sample that i did. paste it in, after deleting all code.
The first line is above everything else, and will go in the General Declarations section of the form.
Public Flag As Boolean
Private Sub btnSwitch_Click()
If Flag = True Then
lblMessage.BackColor = vbWhite
lblMessage.ForeColor = vbRed
lblMessage.Caption = "This it False"
Flag = False
Else
lblMessage.BackColor = vbBlack
lblMessage.ForeColor = vbWhite
lblMessage.Caption = "This it True"
Flag = True
End If
End Sub
Private Sub Form_Load()
lblMessage.BackColor = vbBlack
lblMessage.ForeColor = vbWhite
lblMessage.Caption = "This it True"
Flag = True
End Sub