VBcoders Guest



Don't have an account yet? Register
 


Forgot Password?



changing the foreground color of a command button

by Adarsh. M (1 Submission)
Category: Custom Controls/Forms/Menus
Compatability: VB 6.0
Difficulty: Unknown Difficulty
Originally Published: Fri 11th January 2002
Date Added: Mon 8th February 2021
Rating: (1 Votes)

changing the foreground color of a command button

API Declarations


Private Declare Function GetDC Lib "user32" (ByVal hWnd As Long) As Long
Private Declare Function TextOut Lib "gdi32" Alias "TextOutA" (ByVal hdc As Long, ByVal x As Long, ByVal y As Long, ByVal lpString As String, ByVal nCount As Long) As Long
Private Declare Function SetBkMode Lib "gdi32" (ByVal hdc As Long, ByVal nBkMode As Long) As Long

Dim i As Integer
Dim j As Integer

Rate changing the foreground color of a command button



'set the timer interval as 1
'the width and height of button is set as 2055 and 855 respectively.

Private Sub Form_Load()
i = 50
j = 20
End Sub

Private Sub Timer1_Timer()
Dim dc As Long
dc = GetDC(Command1.hWnd)
SetBkMode dc, transparent
SetTextColor dc, RGB(239, 3, 27)
TextOut dc, i, j, "HELLO", 5
End Sub




Download this snippet    Add to My Saved Code

changing the foreground color of a command button Comments

No comments have been posted about changing the foreground color of a command button. Why not be the first to post a comment about changing the foreground color of a command button.

Post your comment

Subject:
Message:
0/1000 characters