Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
 
  HOME    TRACKER    Visual Basic




Transparent Command Button


Is there some way to make a command button transparent so you only see the caption, but the colors from the screen it is on show through? I need to put a button on a screen that is actually one big Image with some fancy paterns on it that I would like to show in the button.




View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread
Transparent Command Button
I want to place an COMMAND BUTTON over an existing image and to be able to see the image through the COMMAND BUTTON. Is there a way to make the COMMAND BUTTON transparand or invisible so I can see the image? Thanks in advance for any suggestions.

Making A Command Button Transparent?
Is there anyway to make a command button transparent. If there is i will be able to use a cheap way to prevent my listview columns from being resized.

Command Button Edges Transparent In Windows XP Style?
http://img17.photobucket.com/albums/...861/asdasd.png

How can i get rid of the white around my buttons? Is that possible?

How To Make The Back Of An Image In A Command Button As Transparent
I got several images as .GIF and .ICO

now when i set the .GIF image to the command button.... its transparent background becomes a black background.

The ICO image has a transparent background... but it is saved as 21 x 21... but the command button sizes it up to about 32 x 32 or bigger

what can i do to make these images transparent? Its not nice at all to have a button have all the image painted, and no transparent background at all!

How To Create Own Style Command Button The Command Button Properties Can Set By User?
how to create style command button the command button properties can set by user?

is it something related to .ocx file extension?

like caption can set by user
height,width can set by user
command button button can set by user...

Converting A Custom Command Button To A Standard VB Command Button
Hey there,
The task at hand is as follows: I have a large VB project with many forms that use a custom command button (it is the Gurhan Button, a freeware control available from PSC and other places). What I want to do is replace the Gurhan button en masse to the standard VB button.

What I have done is written a simple VB program that reads in the .frm files of the project as text, and made the appropriate replacements. This works fine except for the Picture property. In other words, a line like this:

Picture = "Form1.frx":11B4

causes problems in the converted project.
When I open the new form, I get the "There were errors, check log file for details" message. The log file message, not very useful, contains lines like this:
Line 12: Property Picture in GurhanButton1 could not be set.

Now, I am not an expert on frx files, but I would think that the reference to "Form1.frx":11B4 in the Picture property refers to its location in the file? And if so, the frx file is not being changed, so I am at a loss as to why VB cannot set the property. Any ideas?

Enabling Command Button By Clicking Another Command Button.
Hi again, i was just helped on this site majorly thankyou ! I have one more question:

See the image below. I want to make for example; when you click "dan" and "kwan" it enables you to click the things valued at "dan" and "kwan" i.e. "dario hat" for example. Also, how to make it so "dario hat" is valued at "dankwan". If your curious, we had to make our own currency lol.

Transparent Button
Hi,

I was wondering if it is possible to have the backcolor of a command button transparent? If so, how?

Thanks!

Transparent Button?
Hello again..

What I need to do is make a button invisible on a form but still be able to use it. I know in VBA you can do this by making it transparent. Unfortunately I am using VB 6. Essentially, I want a hidden button with full functionality for anyone who knows where it is. How do I do it?

Thanks for your help!



~Elizabeth~

"A computer lets you make more mistakes faster than any invention in human history - with the possible exceptions of handguns and tequila "

Transparent Button ?
I have a form containing some buttons and a picture in the background. I'd like my buttons to be transparent so that you could see the picture through them. Is that possible to do and if so, how ?

Transparent Command Buttons.
Is it possible to make transparent buttons like you can labels? Reason being I have made this lovely textured form and would like to show it off.

Command Button Event Occurs Only When The Button Is Double Clicked !
Hai,

I am using a MonthView Control and Two Command Buttons (Ok & Cancel) inside a Frame, Its designed as the MonthView Control will display 2 Columns and 1 Row. Now what happens is when i change a date in the MonthView Control, then i need to double click the Command Button, then only the Command Event occurs (Either its Ok or Cancel Button). If i didn't change the Date in the Monthview Control, then i am able to do the CommandButton Event work with the single MouseClick. I think if i change Date in the Calendar (i.e MonthView Control), then there is some thing affected in the Focus of the Command Button, after I change the date and press the command button, the button seems to be selected (marked) but the event didn't occured. I tried with the BreakPoint also. Can any one help me regarding this.

Thankyou,
Chock.

Using Return/Enter Keyboard Button Instead Of Command Button (RESOLVED)
I am entering data into 4 textboxes and then performing calcs on that data using a commandbutton.
Is there a way to use the keyboard's Enter button as a proxy for the commandbutton, if and only if the focus is on one of these 4 textboxes?

I hope that's clear.

Jim



Edited by - jimvt on 6/16/2004 4:12:28 AM

Command Button Event Occurs Only When The Button Is Double Clicked !
Hai,

      I am using a MonthView Control and Two Command Buttons (Ok & Cancel) inside a Frame, Its designed as the MonthView Control will display 2 Columns and 1 Row. Now what happens is when i change a date in the MonthView Control, then i need to double click the Command Button, then only the Command Event occurs (Either its Ok or Cancel Button). If i didn't change the Date in the Monthview Control, then i am able to do the CommandButton Event work with the single MouseClick. I think if i change Date in the Calendar (i.e MonthView Control), then there is some thing affected in the Focus of the Command Button, after I change the date and press the command button, the button seems to be selected (marked) but the event didn't occured. I tried with the BreakPoint also. Can any one help me regarding this.

Thankyou,
Chock.

Transparent Button Backgrounds
I am so frustrated with trying to make my button backgrounds transparent. I can only seem to do it if my button surface (unused) is white, which precludes me from using any white in my button pictures; not very practical. If someone can give me a heads-up on how to accomplish this little tidbit of programming magic, I would be willing to give them a shiny new quarter. TIA!

Command Button 1 Depends On Command Button 2
hi there! hope someone can give some time w/ my prob.! Actually, I have 2 command buttons: button 1 for extracting and button 2 for printing. By the way, i just used a macro for the print button. The situation is this, before the user can extract the file, he should print it first. So I included a msgbox for that.

My question is what can i possibly add to the codes below in order to cancel the msgbox and continue w/ the extraction if the user already printed the report???


Private Sub cmdOutExcel_Click()

If MsgBox("You have to print the report before proceeding", vbOKOnly + vbInformation + vbSystemModal, "Stop") = vbOK Then
Exit Sub
End If

If MsgBox("Extract this form? If no, this will extract the source AEW table.", vbYesNo + vbQuestion + vbSystemModal, "Choose") = vbYes Then
DoCmd.OutputTo acOutputForm, "Activity Effort Worksheet", acFormatXLS
Else
DoCmd.ApplyFilter "AEW", "BRUCode='" + CStr(bruc) + "'"
DoCmd.OutputTo acOutputTable, "AEW", acFormatXLS
End If

End Sub

How Do I Add A Wav File To A Command Button, Also Change The Color Of The Button When
I am having trouble with this. I am able to make a windows default soung by inserting the word beep, however if i want a different sound how to i define it. also i have forgotten exactly how to write the coding for changing the button color when it is selected. Any help would be greatly appreciated.

? Change The Font && Button Color Of A Command Button
Hi,

I would like to change the font & button color of my command buttons, Does anyone know how I can do this?

Also I am curious as how to change the color of input boxes & menu bars?

Any help is greatly appreciated! Thanks in advance!

Donna

TRANSPARENT The The Background Of GIF In Toolbar BUTTON...
Hi:

I have created some icon-like images from photoshop and wanted to export them(*.gif) to VB6. But then when i inserted them inside the toolbar button, the button background wasn't transparent but white instead.

Was it gone wrong with my saving gif file technique in photoshop or the gif file background won't look transparent if inserted in vb6??

Please help. Thanks!

Part Of Graphical Button Becomes Transparent
I have a button that is set for Graphical style so I can change the back color and button text when certain events occur. Some users intermittently have a problem when the back color is changed the inside of the button becomes transparent and you see whatever is behind the program. Is there anything that can be done to prevent this?

Thanks,

Randy

Transparent Checkbox, Option Button...
Hi!

Is there a way I can set a checkbox (or option button) to have a transparent background? Or is there any similar control?

Bostjan

Problem With Transparent Opt. Button Code
Hey everyone, will someone pLEASE, PLEASE, PLEASE! tell me why the following procedure calls wont execute in Form_Load()? They only work when i assign them to a clickable object: (this is from elitevb)


TransChkOpt opt1, True
TransChkOpt opt2, True


Code:
' *********************************************************************************
' Make control (optbutton, chkbox) transparent
' ---------------------------------------------
'
' Written by: Garrett Sever (aka "The Hand")
' Date: 8/26/01
'
' *********************************************************************************
' Feel free to use this source code as you wish in your projects, however
' if you publish it, either on a website, forum, book, etc. give credit where
' its due.
'
' If you post my code as your own on Planet-look-I-wrote-some-sourcecode I
' will spend the rest of my existence hunting you down and discrediting your
' every action. Punk.
' *********************************************************************************



Option Explicit

' Declares for manipulation of the regions
'*****************************************
Private Const RGN_AND = 1 'Creates the intersection of the two combined regions.
Private Const RGN_COPY = 5 'Creates a copy of the region identified by hrgnSrc1.
Private Const RGN_OR = 2 'Creates the union of two combined regions.
Private Const RGN_XOR = 3 'Creates the union of two combined regions except for any overlapping areas.
Private Const RGN_DIFF = 4 'Combines the parts of hrgnSrc1 that are not part of hrgnSrc2.

Private Declare Function CreateRectRgn Lib "gdi32" (ByVal X1 As Long, ByVal Y1 As Long, ByVal X2 As Long, ByVal Y2 As Long) As Long
Private Declare Function CombineRgn Lib "gdi32" (ByVal hDestRgn As Long, ByVal hSrcRgn1 As Long, ByVal hSrcRgn2 As Long, ByVal nCombineMode As Long) As Long
Private Declare Function OffsetRgn Lib "gdi32" (ByVal hRgn As Long, ByVal X As Long, ByVal Y As Long) As Long
Private Declare Function SetWindowRgn Lib "user32" (ByVal hwnd As Long, ByVal hRgn As Long, ByVal bRedraw As Boolean) As Long
Private Declare Function DeleteObject Lib "gdi32" (ByVal hObject As Long) As Long

' Declares for color retrieval
'*****************************************
Private Declare Function GetDC Lib "user32" (ByVal hwnd As Long) As Long
Private Declare Function CreateCompatibleDC Lib "gdi32" (ByVal hdc As Long) As Long
Private Declare Function GetPixel Lib "gdi32" (ByVal hdc As Long, ByVal X As Long, ByVal Y As Long) As Long
Private Declare Function ReleaseDC Lib "user32" (ByVal hwnd As Long, ByVal hdc As Long) As Long
Private Const COLOR_BTNFACE = 15 'Button
Private Declare Function GetSysColor Lib "user32" (ByVal nIndex As Long) As Long

Private Sub TransChkOpt(aCtl As Control, trans As Boolean)

Dim X As Long 'Used to loop thru the pixels
Dim Y As Long 'Used to loop thru the pixels
Dim wid As Long 'Width of optButton - Used to loop thru the pixels
Dim hgt As Long 'Height of optButton - Used to loop thru the pixels

Dim rgnCtl As Long 'Region of the Button
Dim rgnPixel As Long 'Region of a pixel - used to subtract out tiny areas
Dim colPixel As Long 'Color of a pixel in the control's DC
Dim ctlDC As Long 'Temporary device context used to get pixel color info
Dim backColor As Long 'Background color of the option button

'Trans color for the button
backColor = GetSysColor(COLOR_BTNFACE)

'Calculate the size of the picture which we will fit the form to
wid = Me.ScaleX(aCtl.Width, Me.ScaleMode, vbPixels)
hgt = Me.ScaleX(aCtl.Width, Me.ScaleMode, vbPixels)

'Create a region the same size as our picture dimensions
rgnCtl = CreateRectRgn(0, 0, wid, hgt)
If Not trans Then GoTo TransChkOpt_SetRgn

'Capture the option button's DC so we can read the color information.
ctlDC = GetDC(aCtl.hwnd)

'Loop thru all pixels in the option button
For Y = 0 To hgt
For X = 0 To wid
' check the color of each pixel
colPixel = GetPixel(ctlDC, X, Y)
If colPixel = backColor Then
'If the color is our mask color (button face in this case) then
' create a tiny region for it and remove it from the picture
rgnPixel = CreateRectRgn(X, Y, X + 1, Y + 1)
CombineRgn rgnCtl, rgnCtl, rgnPixel, RGN_XOR
'Clean up our graphics resource
DeleteObject rgnPixel
End If
Next X
Next Y

'Release our control's DC
ReleaseDC aCtl.hwnd, ctlDC

TransChkOpt_SetRgn:
'Fit the button to the new region.
DeleteObject SetWindowRgn(aCtl.hwnd, rgnCtl, True)

End Sub

Please help me...its driving me crazy!

Transparent BackColor Option Button
Is it possible to set the BackColor of an OptionButton to transparent. I have used a background image on the form and it looks bad without the BackColor been transparent.

Can't find out how to do it, is there some code I could use?
Cheers!

Using A Command Button To Click Other Command Buttons? Please Help
Hi
I am creating a program and I want to make it so if I click one command button VB automatically click other command buttons

i.e.
Clicking command 4 runs
command 1
command 2
command 3
in that order

Please help

Thanks

Transparent Button, Overlay Mswebdvd Control
I have searched and read until my head hurts.

what I need to do is make a transparent button on top of
the mswebdvd control. Problem is, I can't get anything that's
transparent to appear on top. image boxes always appear
under it, etc, etc

I can get a command button to stay over it, as well as a picturebox, but I need them transparent so I can execute a command when the region is clicked.

Can anyone help ?

Please ! I'm dying here.

A Menu Button Linked To A Command Button?
i have a command button which contains a heap of code. I also have a menu button that does the same thing as the command button. At the moment, when i edit the command button code, i just copy and paste that code to the menu item.

How would i go about linking the menu button to the command button?

Command Button And Option Button Question
Player X clicks the X option button when it is his/her turn. Then player X clicks the command button of choice which will display an X. How do I write the code when a command button has been clicked? It is a noughts and crosses game.

Simulating A Button Press On A Command Button
OK, here we go...

I have a command button that starts a database search. I have set an animation control to show a searchlight while the search is being performed, but want this to appear on the button.

The animation control has been placed over the button, but of course this stops the button being pressed. I have added in the 'click' procedure for the animation, a call to the 'click' procedure for the button, so it functions, but I want the button to look pressed for the duration of the mouse button press on the animation control.

Is there anybody who knows how?

Thanks in advance...

Argh! Cannot Make Option Button Caption Transparent
Hi all,

Ok, I wrote an ActiveX Control. My control includes 2 OptionButtons. The OptionButtons have captions (one says "AM", the other says "PM"). I have included code in my usercontrol to check to see if the Ambient property has been changed (specifically for the OptionButtons, I check to see if the ambient changed .BackColor - so I can automatically change the OptionButtons' .BackColor property to that of the ambient). So far great! Works just fine!

Until...

I set the Picture property on my Form... then I get this ugly, glaring, garish backcolor on my OptionButton captions, when the rest of my control is nice and transparent. (see pic I attached to this post)

I thought about using the TransparentBlt API to try to make the caption area transparent, however - OptionButtons don't have a device context property (hDC).

I thought about not using the OptionButton's caption, and resizing it to just show the circular selector area (using a Label for the caption portion), but there would still be little areas where the backcolor would show up.

Does anyone have any ideas what else I might be able to do? The only other thing that comes to mind would be to maybe use a Shape control (circle) with a Label for the caption area, and simulate the option button appearance... but that sounds kind of ugly...

Thanks for your help (and "listening" to me rant a little)...

Paul

Assigning A Run Command To A Command Button
How would I assign a simple run command (ie. start --> run) to a command button? So that when the button is clicked the window would pop up as if you had went start --> run and hit OK (ex: winipcfg or a targeted .exe).

Html Button- To -command Button HELP
i am trying to get a command button in vb to trigger a button on a web page. it is kind of a wierd button, but you can look at it here:

Buttons

i need those buttons to work if i press down on the similar button that i make in vb:

image of buttons in vb

can anyone help me with this?

Linking Opt Button To A Command Button
I was wondering how i would code, an option button to display a message but only when i hit the Display command button ? Here is my code


Private Sub cmdDisplay_Click()

lblcode.Caption = "Catalog Code: " & txtCode.Text
lblcode.Visible = True
lblNumber.Caption = "Page Number: " & txtPage.Text
lblNumber.Visible = True
lblPart.Caption = "Part Number: " & txtNumber.Text
lblPart.Visible = True

End Sub


Private Sub optCharge_Click()

If optCharge.Value = True Then lblPayment.Caption = "Payment Type: Charge "


End Sub

Private Sub optCOD_Click()
If optCOD.Value = True Then lblPayment.Caption = "Payment Type: COD "
End Sub

Private Sub optExpress_Click()

If optExpress.Value = True Then lblShip.Caption = "Shipping Method: Express"
End Sub

Private Sub optGround_Click()
If optGround.Value = True Then lblShip.Caption = "Shipping Method: Ground"
End Sub

Private Sub optMoneyOrder_Click()

If optMoneyOrder.Value = True Then lblPayment.Caption = "Payment Type: Money Order"
End Sub

Radio Button And Command Button
hi friends,
there are two radio buttons and two command buttons in my form. two radio buttons are grouped together using frame. when i click command button 1 radio button 1 must be selected similarly when i click command button 2 radio button 2 must be selected. how can i do this ?. thank you

Option Button And Command Button
Hay, guys i am back with new problem. On my form i am having two Option buttons, 2 Command buttons, 1 Label. Option1 says '2 Minutes' and Option2 says '5 Minutes' and Command1 says 'Start' when user choose option1 and click on Command1 after 2 minutes has done it will show Label1. I don't know how to do this because i am begainer, if any one help me, it'll be help full. Thank you.

Command Button
Hi:
Is there any way to make the picture in a Command button appear at the left of the text instead of on top of it? Or can anyone tell me where to get a Button Control (I preffer a free one that is capable of that?

Thanks

Command Button ~!!
How do i invinsible the command button box after inserted the Graphics(Picture)
wat i mean is the command button with Graphics(Picture) without the boxes behind of it ~

Command Button
Why is it that whenever I assign a bitmap to a command button there always seems to be a white border around it??
How do I get rid of this??

Command Button Help
Does anyone know how to lock a command button to a certain screen section, so that if the user scrolls down the spreadsheet the command button will remain in a locked location of the screen.

Need VB Command Button Help
If I have a report named "InventoryReport" in a Microsoft Access db named "Trains" on the "D" drive, what code would be entered in the Command1_Click() to view the report?

Thanks

Command Button
Making a command button launch apps

i have no idea how to do that

someone know how to do above ?

Command Button
How can I navigate record by record using a command button in visual basic

thanks

Command Button Help
I have tried searching before even joining and couldnt find the exact answer I was looking for. So I decided to join and seek help.

I am trying to create a command button on my excel sheet. I want the button to have a double feature. One would display "green" and fore ground color would be green. Two click or press it and it would display "red" and fore ground color becomes red as well. Can anyone guide me in the right direction??

Vb And Command Button Help!!!
hi, i kinda dont know how to word this but i have a problem with my command button and vb coding. The thing is i have an order system i created, which consist of an 'order' sheet and 'process orders' sheet. When an order is placed, i click on the command button named process which the first row in the 'order' sheet is automatically copied into the 'process orders' sheet and then deleted from the 'order' sheet (its suppose to do that lol). The thing is i need to construct the code so that the orders are processed one at a time by the click of the command button than all at once. Here is the code:

Code:
Worksheets("New Orders").Range("A2:G2").Copy Sheets("Processed orders").Range("A2")
Worksheets("New Orders").Range("A2:G2").ClearContents


Worksheets("New Orders").Range("A3:G3").Copy Sheets("Processed orders").Range("A3")
Worksheets("New Orders").Range("A3:G3").ClearContents

So my question is how can i construct a code that will allow me to process orders one by one than actually all at once? please help and sorry for the essay lol

p.s. i have attached the file in case anyone wants to test it or is confused lol



Edit by Moderator:
Please post Excel questions, in the Excel forum.

Please use the [vb][/vb] tags when you post your code. Edit or reply to this post to see how.

Thank you.

Command Button
I'm using user forms in an excel workbook. I'd like to put an underline in an specific letter in each command button in the userform so that I can use the button without using the mouse by pressing 'Alt' + the key.

In VB I learned to put a '&' before the letter, but this doesn't seem to work in VBA.

Does anybody know what should I do?

Thanks!

Command Button
Ok im in a Grade 11 Programming course so if this is a newby question sorry. Im using VB5 and im creating a simple calculator. For the Caption on one of my CommandButtons I want it to show a Square Root Symbol instead of "Sqr". Is this possible? I've already tried to paste the symbol in the caption but it displays "v".

Thanks

Command Button
when I enter this into the caption property of a command button: QueryT & P System



it displays this: QueryT_P System

is there any way to fix this??

Help With Command Button....
Hello
I am using this code:


Code:
Dim PathToMediaFile As String
Const QUOTE = """"
PathToMediaFile = Command
Text1.Text = Replace(PathToMediaFile, QUOTE, "")


And I want it so that when this happens it also refers to a command button (cmd_Play)

Can anyone help?
Thanks.

Command Button
Can I put an image in a command button?, HOW?

Copyright 2005-08 www.BigResource.com, All rights reserved