Results 1 to 5 of 5

Thread: Why doesnt this code work?

  1. #1

    Thread Starter
    type Woss is new Grumpy; wossname's Avatar
    Join Date
    Aug 2002
    Location
    #!/bin/bash
    Posts
    5,682

    Why doesnt this code work?

    This is verbatim from a book...
    VB Code:
    1. Private Sub frmMain_Paint(ByVal sender As Object, ByVal e As System.Windows.Forms.PaintEventArgs) Handles MyBase.Paint
    2.  
    3.     Dim g As Graphics = Me.CreateGraphics()
    4.  
    5.     Dim x As Integer = Me.Width
    6.     Dim y As Integer = Me.Height
    7.  
    8.     Dim lgb As LinearGradientBrush = New LinearGradientBrush(New Point(0, 0), New Point(x, y), Color.White, Color.Red)
    9.  
    10.     g.FillRectangle(lgb, 0, 0, x, y)
    11.  
    12. End Sub

    It doesn't seem to do anything at all. It's supposed to show a gradient effect on the form, from white to red, top left to bottom right.

    Can anyone get it working?
    I don't live here any more.

  2. #2
    Retired VBF Adm1nistrator plenderj's Avatar
    Join Date
    Jan 2001
    Location
    Dublin, Ireland
    Posts
    10,359
    Works fine for me...
    Microsoft MVP : Visual Developer - Visual Basic [2004-2005]

  3. #3
    Fanatic Member pax's Avatar
    Join Date
    Mar 2001
    Location
    Denmark
    Posts
    840
    Me too....
    I wish I could think of something witty to put in my sig...

    ...Currently using VS2013...

  4. #4

    Thread Starter
    type Woss is new Grumpy; wossname's Avatar
    Join Date
    Aug 2002
    Location
    #!/bin/bash
    Posts
    5,682
    Doh! There's me thinking that panels are transparent.

    I don't live here any more.

  5. #5
    Retired VBF Adm1nistrator plenderj's Avatar
    Join Date
    Jan 2001
    Location
    Dublin, Ireland
    Posts
    10,359
    Originally posted by wossname
    Doh! There's me thinking that panels are transparent.


    Ahhhhh ya have to laugh
    Microsoft MVP : Visual Developer - Visual Basic [2004-2005]

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width