Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Visual Basic
  4. Fading Form colours?

Fading Form colours?

Scheduled Pinned Locked Moved Visual Basic
csharpvisual-studioquestion
7 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    Mr Oizo
    wrote on last edited by
    #1

    Hi I am trying to increase the appeal of my forms by ading the colours across them, I have found a couple of code snippets online but when i try to implement it myself the keywords get underlined by the intellisense in vb. eg: oForm.AutoRedraw = True oForm.DrawStyle = vbInsideSolid oForm.DrawMode = vbCopyPen oForm.DrawWidth = 2 oForm.ScaleMode = vbPixels it will leave a message saying that Autodraw is not a member of system.windows.forms.form the same for the other lines. has something changed in vb.net or something? how could i implement fading the form colours? thanks in advance Mr Oizo

    G 1 Reply Last reply
    0
    • M Mr Oizo

      Hi I am trying to increase the appeal of my forms by ading the colours across them, I have found a couple of code snippets online but when i try to implement it myself the keywords get underlined by the intellisense in vb. eg: oForm.AutoRedraw = True oForm.DrawStyle = vbInsideSolid oForm.DrawMode = vbCopyPen oForm.DrawWidth = 2 oForm.ScaleMode = vbPixels it will leave a message saying that Autodraw is not a member of system.windows.forms.form the same for the other lines. has something changed in vb.net or something? how could i implement fading the form colours? thanks in advance Mr Oizo

      G Offline
      G Offline
      Guffa
      wrote on last edited by
      #2

      That's VB6 code. Although the syntax in VB.NET is very similar, it's a completely new language. Here you see that most of the properties that you try to use simply doesn't exist any more: MSDN Library: Graphics for VB6 users[^]

      --- single minded; short sighted; long gone;

      M 2 Replies Last reply
      0
      • G Guffa

        That's VB6 code. Although the syntax in VB.NET is very similar, it's a completely new language. Here you see that most of the properties that you try to use simply doesn't exist any more: MSDN Library: Graphics for VB6 users[^]

        --- single minded; short sighted; long gone;

        M Offline
        M Offline
        Mr Oizo
        wrote on last edited by
        #3

        Thanks i'll check it out. hopefully what i'm trying to do is fairly easy Mr Oizo

        1 Reply Last reply
        0
        • G Guffa

          That's VB6 code. Although the syntax in VB.NET is very similar, it's a completely new language. Here you see that most of the properties that you try to use simply doesn't exist any more: MSDN Library: Graphics for VB6 users[^]

          --- single minded; short sighted; long gone;

          M Offline
          M Offline
          Mr Oizo
          wrote on last edited by
          #4

          Thanks i'll check it out. Hopefully what i'm trying to do is fairly easy:doh: Mr Oizo

          M 1 Reply Last reply
          0
          • M Mr Oizo

            Thanks i'll check it out. Hopefully what i'm trying to do is fairly easy:doh: Mr Oizo

            M Offline
            M Offline
            Mr Oizo
            wrote on last edited by
            #5

            I managed to sort out what i needed using the following code. Unfortunately if i use it on a button in the paint event it clears the text off the button and the button isn't raised off the form like normal.... Any ideas on how i can fix that? Dim rec As Rectangle = New Rectangle(0, 0, Me.Width, Me.Height) 'create a new recatangle 'Create a new brush. Make is a Gradient style brush. Dim myBrush As Brush = New Drawing.Drawing2D.LinearGradientBrush(rec, Color.Silver, Color.SteelBlue, Drawing.Drawing2D.LinearGradientMode.ForwardDiagonal) 'draw the gradient onto the form. e.Graphics.FillRectangle(myBrush, rec) Mr Oizo

            P 1 Reply Last reply
            0
            • M Mr Oizo

              I managed to sort out what i needed using the following code. Unfortunately if i use it on a button in the paint event it clears the text off the button and the button isn't raised off the form like normal.... Any ideas on how i can fix that? Dim rec As Rectangle = New Rectangle(0, 0, Me.Width, Me.Height) 'create a new recatangle 'Create a new brush. Make is a Gradient style brush. Dim myBrush As Brush = New Drawing.Drawing2D.LinearGradientBrush(rec, Color.Silver, Color.SteelBlue, Drawing.Drawing2D.LinearGradientMode.ForwardDiagonal) 'draw the gradient onto the form. e.Graphics.FillRectangle(myBrush, rec) Mr Oizo

              P Offline
              P Offline
              Patrick Etc
              wrote on last edited by
              #6

              Your prior post said you were trying to do that to a form. No, if you override the paint event of a button, you're going to have to do all the painting yourself, including the text and all the button states - mouse over, pressed, etc. What you're doing is painting over the button and only painting the background. If you want pretty gradient/glass buttons, there are tons of articles here on Code Project that will show you how to do that.


              The early bird who catches the worm works for someone who comes in late and owns the worm farm. -- Travis McGee

              M 1 Reply Last reply
              0
              • P Patrick Etc

                Your prior post said you were trying to do that to a form. No, if you override the paint event of a button, you're going to have to do all the painting yourself, including the text and all the button states - mouse over, pressed, etc. What you're doing is painting over the button and only painting the background. If you want pretty gradient/glass buttons, there are tons of articles here on Code Project that will show you how to do that.


                The early bird who catches the worm works for someone who comes in late and owns the worm farm. -- Travis McGee

                M Offline
                M Offline
                Mr Oizo
                wrote on last edited by
                #7

                Thanks dude. I'll look around. If you know of any links i can click then please post them here. thanks again:) Mr Oizo

                1 Reply Last reply
                0
                Reply
                • Reply as topic
                Log in to reply
                • Oldest to Newest
                • Newest to Oldest
                • Most Votes


                • Login

                • Don't have an account? Register

                • Login or register to search.
                • First post
                  Last post
                0
                • Categories
                • Recent
                • Tags
                • Popular
                • World
                • Users
                • Groups