Resizing Text at runtime
Posted on 2005-03-28
I need a little help with one of my projects. I have created a screensaver that displays Sales Reminders to our sales people. The reminders come from a text file shared on the network. Anyway, When the screensaver starts, it displays the list just fine. (only 5 allowed) The problem I'm having is that I would like to start with the top-most reminder and change the text size/font so that it will grow till it reaches the screen width, then make it shrink back to normal. I also wanted a random color. Here is the code I use for the timer event:
Private Sub Timer1_Tick(ByVal sender As Object, ByVal e As System.EventArgs) Handles Timer1.Tick
Static r As Integer
Static c As Integer
Dim y As Integer
Dim z As Integer
Dim mc As Color
If c < 5 Then
Randomize() ' Initialize random-number generator.
y = CInt(Int((255 * Rnd()) + 1)) ' Generate random value between 1 and 255.
z = CInt(Int((255 * Rnd()) + 1)) ' Generate random value between 1 and 255.
MyLabels(r).ForeColor = mc.FromArgb(255, y, z)
c += 1
If c = 5 Then
If r <= 5 Then
r += 1
c = 0
Pretty simple huh? Well the random coloring looks just great, but I can't seem to figure out how to increase the text size.
Any and all help is appreciated. Because I need a quick answer I will award the full 500 points for a quick solution.