HOW DO I MAKE IMAGES FADE, words, text, buttons, ect....

I want just for looks to make images fade in my program. Was hoping there's a cheaper easy way built in to vb.net to do this. Thanx :)

Comments

  • : I want just for looks to make images fade in my program. Was hoping there's a cheaper easy way built in to vb.net to do this. Thanx :)
    :
    :
    Hi:
    Here are some code examples that might explain how to make a bmp image fade:

    [Code listing 1]
    Dim bmp as New Bitmap("Logo")
    bmp.MakeTransparent(Color.FromArgb(140, 195, 247))
    gr.DrawImage(bmp,20,20)

    Another option is:
    [Code Listing 2

    Dim bmp as New Bitmap("Logo")

    Dim transparency as Single = 0.8
    Dim values()() as Single = {New Single() {1,0,0,0,0}, _
    New Single() {0,1,0,0,0}, _
    New Single() {0,0,0,transparency,0} _
    New Single() {0,0,0,1}}
    Dim colMatrix as New ColorMatrix(values)
    Dim imageAttr as New ImageAttributes()
    imageAttr.SetColorMatrix(colMatrix, ColorMatrixFlag.Default, _
    ColorAdjustType.Bitmap)
    gr.DrawImage(bmp,New Rectangle(200,20,bmp.Width,bmp.Height), _
    0,0, bmp.Width, bmp.Height, GraphicsUnit.Pixel,imageAttr)

    And yet another option would be:
    [Code Listing 3]

    Dim bmp as new BitMap("Logo")
    Dim x,y as Single

    for x = 0 to bmp.Width - 1
    for y = 0 to bmp.Height - 1
    Dim oldColor = bmp.GetPixel(x,y)
    Dim NewColor as Color.FromArgb(x / bmp.Width * 256,oldColor)
    bmp.SetPixel(x,y,newColor)
    next
    next
    gr.DrawImage(bmp,400,20)

    Each of these code examples will give you a level of transparency. Try them all and see which one works for you.

    As to how to load the bitmaps is another subject and I'm still getting to that section in my book on VB.Net! Only has 1527 pages of reference materials!
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

In this Discussion