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. [vb.net] Gradient Fill

[vb.net] Gradient Fill

Scheduled Pinned Locked Moved Visual Basic
csharpgraphicshelpquestion
2 Posts 2 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.
  • T Offline
    T Offline
    thesleeper
    wrote on last edited by
    #1

    well i'm trying to create a control that inherits from textbox or richtextbox to make the background gradient i use the following code : CODE Protected Overrides Sub OnPaint(ByVal e As PaintEventArgs) MyBase.OnPaint(e) Dim gbr As LinearGradientBrush = New LinearGradientBrush(New Rectangle(0, 0, Me.Width, Me.Height), Color.White, Color.Blue, LinearGradientMode.Horizontal) e.Graphics.FillRectangle(gbr, New Rectangle(0, 0, Me.Width, Me.Height)) End Sub but this isn't working... the backcolor in both is always white. can someone help? thanks in advance ;)

    D 1 Reply Last reply
    0
    • T thesleeper

      well i'm trying to create a control that inherits from textbox or richtextbox to make the background gradient i use the following code : CODE Protected Overrides Sub OnPaint(ByVal e As PaintEventArgs) MyBase.OnPaint(e) Dim gbr As LinearGradientBrush = New LinearGradientBrush(New Rectangle(0, 0, Me.Width, Me.Height), Color.White, Color.Blue, LinearGradientMode.Horizontal) e.Graphics.FillRectangle(gbr, New Rectangle(0, 0, Me.Width, Me.Height)) End Sub but this isn't working... the backcolor in both is always white. can someone help? thanks in advance ;)

      D Offline
      D Offline
      Daniel Turini
      wrote on last edited by
      #2

      You need to override OnPaintBackground. Yes, even I am blogging now!

      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