![]() |
|
[.NET] [Source Code] Flashing Text In Visual Basic - Printable Version +- Hack Forums (https://hackforums.net) +-- Forum: Tech (https://hackforums.net/forumdisplay.php?fid=444) +--- Forum: Coding (https://hackforums.net/forumdisplay.php?fid=151) +---- Forum: Software Development (https://hackforums.net/forumdisplay.php?fid=118) +---- Thread: [.NET] [Source Code] Flashing Text In Visual Basic (/showthread.php?tid=4596548) Pages: Pages
1
2
|
[Source Code] Flashing Text In Visual Basic - Shenagan-Hack-Team - Dec 22, 2014 Here Is The Code For The Flashing Text In Visual Basic.Hope You Guys Enjoy -----------------------------------------CODE------------------------------------------------- Label1.ForeColor = Color.Green Timer1.Stop() Timer2.Start() Label1.ForeColor = Color.Red Timer2.Stop() Timer3.Start() Label1.ForeColor = Color.Yellow Timer3.Stop() Timer4.Start() Label1.ForeColor = Color.Purple Timer4.Stop() Timer1.Start() --------------------------------------------------------------------------------------- Remember Your First Timer Must Be On True Not False.Do This So The Code Works. * - Rhez - Dec 22, 2014 PLease use a code/php tag when u are posting a source code bro * - Haru9 - Dec 22, 2014 (Dec 22, 2014 02:27 AM)Shenagan-Hack-Team Wrote: Here Is The Code For The Flashing Text In Visual Basic.Hope You Guys EnjoyAre you serious? 4 timers for something that easy...❓ Try my simple code: Code Public Class Form1* - SIM-2137258 - Dec 22, 2014 (Dec 22, 2014 04:10 AM)Haru9 Wrote: Are you serious? 4 timers for something that easy...❓ Thank you for you code :) Anyone know how to have random color with all colors ? * - Haru9 - Dec 22, 2014 (Dec 22, 2014 05:11 AM)ImHaxor Wrote: Thank you for you code :) Code Dim number As New Random : Label1.ForeColor = Color.FromArgb(number.Next(0, 255), number.Next(0, 255), number.Next(0, 255))* - SIM-2137258 - Dec 22, 2014 (Dec 22, 2014 05:44 AM)Haru9 Wrote: Thank you very much it's nice to share your:) * - Haru9 - Dec 22, 2014 (Dec 22, 2014 07:37 AM)ImHaxor Wrote: Thank you very much it's nice to share your:)You're welcome ;) This is so simple thing... Anyway, you can find almost everything what you need to know about Visual Basic language here: //msdn.microsoft.com/en-us/library/sh9ywfdk%28v=vs.90%29.aspx 🙂 * - RandomUser123 - Dec 22, 2014 (Dec 22, 2014 05:11 AM)ImHaxor Wrote: Thank you for you code :) ------ Code Dim NewColor As System.Drawing.ColorSet NewColor variable. Code NewColor = Drawing.Color.FromArgb(New Random().Next(0, 255), New Random().Next(0, 255), New Random().Next(0, 255))Set a new random color. By using New Random().Next(0,255) you get a random number between 0 and 255. You use it 3 times to get an RGB color, and convert it to System.Drawing.Color by using System.Drawing.Color.FromArgb. Example in use: Code Public Class Form1In case of Haru9's code, you should do: Code Private Sub Timer1_Tick(sender As Object, e As System.EventArgs)* - Odus - Dec 22, 2014 (Dec 22, 2014 10:03 AM)RandomUser123 Wrote: Why are you creating 3 Random instances for that? * - KingDeath360 - Dec 22, 2014 you could make a new class then inherit the label control, do some stuff with the Ondraw sub, it saves your form from having messy code with all the timers * - RandomUser123 - Dec 22, 2014 (Dec 22, 2014 10:36 AM)Odus Wrote: Why are you creating 3 Random instances for that? Because you need 3 values to make an RGB color (red value, green value and blue value). FromArgb(red, green, blue). * - Odus - Dec 22, 2014 (Dec 22, 2014 12:14 PM)RandomUser123 Wrote: Because you need 3 values to make an RGB color (red value, green value and blue value). FromArgb(red, green, blue). Yes I'm well aware FromArgb takes 3 arguments but you're initializing a new random for each argument, you only need 1 and it's using unnecessary memory. Plus your code only returns greyscale when I use it. Try this: Code Dim R As Random = New Random()* - Hawk HF - Dec 22, 2014 (Dec 22, 2014 12:26 PM)Odus Wrote: Yes I'm well aware FromArgb takes 3 arguments but you're initializing a new random for each argument, you only need 1 and it's using unnecessary memory. Plus your code only returns greyscale when I use it. Try this: Use this, OP. However, you should declare your random in the class scope. There's no need to declare a new variable every time a method is executed. * - RandomUser123 - Dec 22, 2014 Doesnt a variable get deleted from RAM after a method stops using it? I thought so, for this i was using 3... Btw i had to add another value, because first one is aplha (transparency) then rgb. By manually setting rgb values (and alpha at 255) i can get red blue and green. By doing it using random function i get greyscale... o.o EDIT----- Fixed so: Code Dim NewColor As System.Drawing.ColorBy using New Random().Next(0,255) I get grey scale. By declaring the variabile I don't. Is there a reason? * - Haru9 - Dec 23, 2014 (Dec 22, 2014 03:13 PM)RandomUser123 Wrote: Doesnt a variable get deleted from RAM after a method stops using it?Yes, but it consumes memory when this code part is executed, that generally means slow-down for your application... More variables = more memory. (Dec 22, 2014 03:13 PM)RandomUser123 Wrote: Btw i had to add another value, because first one is aplha (transparency) then rgb.Alpha color is optional. If you don't want to set transparency of rgb value, you don't need to define it, it is always 255 by default. (Dec 22, 2014 03:13 PM)RandomUser123 Wrote: By using New Random().Next(0,255) I get grey scale. By declaring the variabile I don't. Is there a reason?Yes, you propably don't know what you are doing at all. //msdn.microsoft.com/en-us/library/system.random(v=vs.110).aspx Quote:Random Class |