Hi, is it possible to create gradient text? Similar to:
http://j2k2001.50megs.com/90.jpg
Apologies for the bad quality of the image.
Printable View
Hi, is it possible to create gradient text? Similar to:
http://j2k2001.50megs.com/90.jpg
Apologies for the bad quality of the image.
Would it be possible to create gradient text in VB? I would like to know also.
Which one? The one which is in the image or the one which nishantp has in his post?
In VB. Like the image I posted. Vertical gradient in VB.
I would like to know how you did that in the forums. :)
I have no idea how to do it in VB, but here is the forum way:
Itsnotreallyagradient,everycharisitsowncolor.Itjustappearsthatway.
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?Quote:
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.
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
Hmm, that is for a horizontal gradient :( I need vertical gradient.
Why do I get a funny feeling this is not possible?
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.
Conceptually, here's how I see it: make a mask using text and fill a picturebox. Does PSC have anything?Quote:
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?
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?
It was just a theory, I wouldn't know where to start. :(
PSC=PlanetSourceCode.comQuote:
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?
That makes two of us.. :(Quote:
Originally posted by filburt1
It was just a theory, I wouldn't know where to start. :(
<smacks head!> Of course! So obvious!Quote:
Originally posted by eiSecure
PSC=PlanetSourceCode.com
BTW people - eiSecure's forum really is COOL! Have you checked it out recently??!
first person to 30 referrals gets free copy of Secure-It! 2002 & all future versions & free support. :)
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).
Hmm. Interesting theory. Could you please give it a go?
Many thanks!!
I will start working on it now.:)
Thank you my friend :)
Please describe your program:DQuote:
Originally posted by eiSecure
first person to 30 referrals gets free copy of Secure-It! 2002 & all future versions & free support. :)
Hi.. Have you gotten anywhere with it?Quote:
Originally posted by abdul
I will start working on it now.:)
Not totally but I'll keep trying:)
Just to show to the picture of what is going on:D I think that is what you want.
.Quote:
Originally posted by abdul
Just to show to the picture of what is going on:D I think that is what you want.
That's great :) Any chance of the gradient going down vertically instead of horizontally? It's just what I'm after - thanks :D
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:D
Excellent!! Any chance of the source please? :) :) :) :) :)
No Problem:)
The source code is not that long (a few lines). I'll post the source code after I go home:D
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.
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:)
Thanks :)
Is it possible to change the gradient colour from green? I want the top to be dark red, to turn to orange.
TIA.
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):)
Great stuff - thanks again :)
Please post source here when it's done :)
TIA
Your Welcome