|
-
Oct 14th, 2001, 03:33 PM
#1
Gradient Text <<resolved>>
Hi, is it possible to create gradient text? Similar to:
Apologies for the bad quality of the image.
-
Oct 14th, 2001, 03:42 PM
#2
Junior Member
Would it be possible to create gradient text in VB? I would like to know also.
-
Oct 14th, 2001, 03:44 PM
#3
PowerPoster
Which one? The one which is in the image or the one which nishantp has in his post?
-
Oct 14th, 2001, 03:52 PM
#4
In VB. Like the image I posted. Vertical gradient in VB.
-
Oct 14th, 2001, 03:53 PM
#5
PowerPoster
I would like to know how you did that in the forums.
-
Oct 14th, 2001, 04:05 PM
#6
Frenzied Member
I have no idea how to do it in VB, but here is the forum way:
Itsnotreallyagradient,everycharisitsowncolor.Itjustappearsthatway.
You just proved that sig advertisements work.
-
Oct 14th, 2001, 04:08 PM
#7
Frenzied Member
Oh and BTW - about the VB way, making a form gradient is rather simple (i have written my own code for this). But for text i can see no way other than doing the same as the VB-World tool does (see my above post), and have each character a different color. But that wont work for large characters.
You just proved that sig advertisements work.
-
Oct 14th, 2001, 04:22 PM
#8
Junior Member
Originally posted by nishantp
Oh and BTW - about the VB way, making a form gradient is rather simple (i have written my own code for this). But for text i can see no way other than doing the same as the VB-World tool does (see my above post), and have each character a different color. But that wont work for large characters.
How would you go about at making your form gradient?
-
Oct 14th, 2001, 04:24 PM
#9
PowerPoster
-
Oct 14th, 2001, 04:28 PM
#10
PowerPoster
Here is the very basic gradiants text in a richtextbox:
VB Code:
rtf1.Text = "This is my text that"
For x = 0 To Len(rtf1.Text) - 1
rtf1.SelStart = x
rtf1.SelLength = 1
rtf1.SelColor = RGB(0, 0, x * 10)
Next x
-
Oct 14th, 2001, 04:30 PM
#11
Hmm, that is for a horizontal gradient I need vertical gradient.
Why do I get a funny feeling this is not possible?
-
Oct 14th, 2001, 04:32 PM
#12
PowerPoster
I have been always thinking of doing that "Vertical" gradiants but I have no clue how to do that.
The biggest problem is having more than one colour on a character.
-
Oct 14th, 2001, 04:33 PM
#13
Member
Originally posted by j2k
Hmm, that is for a horizontal gradient I need vertical gradient.
Why do I get a funny feeling this is not possible?
Conceptually, here's how I see it: make a mask using text and fill a picturebox. Does PSC have anything?
-
Oct 14th, 2001, 04:35 PM
#14
Filburt1, don't suppose you could throw together an example project of your ramblings just then could you please?
What is PSC? How do I use masks?
-
Oct 14th, 2001, 04:39 PM
#15
Member
It was just a theory, I wouldn't know where to start.
-
Oct 14th, 2001, 04:42 PM
#16
PowerPoster
Originally posted by j2k
Filburt1, don't suppose you could throw together an example project of your ramblings just then could you please?
What is PSC? How do I use masks?
PSC=PlanetSourceCode.com
-
Oct 14th, 2001, 04:46 PM
#17
Originally posted by filburt1
It was just a theory, I wouldn't know where to start.
That makes two of us..
-
Oct 14th, 2001, 04:46 PM
#18
Originally posted by eiSecure
PSC=PlanetSourceCode.com
<smacks head!> Of course! So obvious!
BTW people - eiSecure's forum really is COOL! Have you checked it out recently??!
-
Oct 14th, 2001, 04:47 PM
#19
PowerPoster
first person to 30 referrals gets free copy of Secure-It! 2002 & all future versions & free support.
-
Oct 14th, 2001, 04:49 PM
#20
PowerPoster
I will start thinking about writting some code on it.
Would not that work:
You create a gradiant coloured object, and then paste the colours from that object on a picturebox (but they will only be pasted where you find a specific colour - the text forecolour).
-
Oct 15th, 2001, 10:01 AM
#21
Hmm. Interesting theory. Could you please give it a go?
Many thanks!!
-
Oct 15th, 2001, 10:06 AM
#22
PowerPoster
I will start working on it now.
-
Oct 15th, 2001, 10:09 AM
#23
Thank you my friend
-
Oct 15th, 2001, 10:10 AM
#24
PowerPoster
Originally posted by eiSecure
first person to 30 referrals gets free copy of Secure-It! 2002 & all future versions & free support.
Please describe your program
-
Oct 16th, 2001, 03:52 PM
#25
Originally posted by abdul
I will start working on it now.
Hi.. Have you gotten anywhere with it?
-
Oct 16th, 2001, 04:06 PM
#26
PowerPoster
Not totally but I'll keep trying
-
Oct 16th, 2001, 04:54 PM
#27
PowerPoster
The progress
Just to show to the picture of what is going on I think that is what you want.
-
Oct 17th, 2001, 10:04 AM
#28
-
Oct 17th, 2001, 10:42 AM
#29
PowerPoster
There was no problem making it vertical. I just had to change the way it coloured the font.
I will post the other picture after some mintues
-
Oct 17th, 2001, 10:45 AM
#30
-
Oct 17th, 2001, 11:56 AM
#31
-
Oct 17th, 2001, 12:09 PM
#32
Great - thanks When do you go home (if you don't mind my asking), as I am in UK an it is 18:05 now.
-
Oct 17th, 2001, 12:33 PM
#33
PowerPoster
It's 1:15 and I'll will go at 3:20 
Anyway, here is the code for the basic one (no specific function to do that yet):
VB Code:
'First put a picture box on the form and make the font face large enough
Private Declare Function SetPixelV Lib "gdi32" (ByVal hdc As Long, ByVal x As Long, ByVal y As Long, ByVal crColor As Long) As Long
Private Declare Function GetTextMetrics Lib "gdi32" Alias "GetTextMetricsA" (ByVal hdc As Long, lpMetrics As TEXTMETRIC) As Long
Private Type TEXTMETRIC
tmHeight As Long
tmAscent As Long
tmDescent As Long
tmInternalLeading As Long
tmExternalLeading As Long
tmAveCharWidth As Long
tmMaxCharWidth As Long
tmWeight As Long
tmOverhang As Long
tmDigitizedAspectX As Long
tmDigitizedAspectY As Long
tmFirstChar As Byte
tmLastChar As Byte
tmDefaultChar As Byte
tmBreakChar As Byte
tmItalic As Byte
tmUnderlined As Byte
tmStruckOut As Byte
tmPitchAndFamily As Byte
tmCharSet As Byte
End Type
Dim tm As TEXTMETRIC
Private Sub Command1_Click()
GetTextMetrics Picture1.hdc, tm
For tx = 1 To Len("MY PICTURE") * tm.tmMaxCharWidth
For ty = 1 To tm.tmHeight
If Picture1.Point(tx, ty) = vbBlack Then
SetPixelV Picture1.hdc, tx, ty, RGB(20, ty * 2, 0)
End If
Next
Next
End Sub
Private Sub Form_Load()
Picture1.AutoRedraw = True
Picture1.ScaleMode = 3
Picture1.Print "MY PICTURE"
End Sub
Here is the picture again for vertical gradiants
-
Oct 17th, 2001, 01:16 PM
#34
Thanks 
Is it possible to change the gradient colour from green? I want the top to be dark red, to turn to orange.
TIA.
-
Oct 17th, 2001, 03:13 PM
#35
PowerPoster
That is why I said it is not finished.
I am now going to write a function that will take the starting colous, ending colour, and the type of gradiants the user wants(vertical or horizontal)
-
Oct 17th, 2001, 03:18 PM
#36
Great stuff - thanks again
-
Oct 18th, 2001, 09:37 AM
#37
Please post source here when it's done 
TIA
-
Oct 18th, 2001, 01:26 PM
#38
Fanatic Member
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|