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. C#
  4. Windows Form Background

Windows Form Background

Scheduled Pinned Locked Moved C#
questiongraphicsperformance
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.
  • K Offline
    K Offline
    Khaniya
    wrote on last edited by
    #1

    I need form with shaded background. One way, I can achieve it by making image of shaded color and set it as backgroundImage Second way, I can use System.Drawing.Drawing2D.LinearGradientBrush class with Form paint event My question is which one is good practice from the performance point of view ? Thanks in advance :)

    Life's Like a mirror. Smile at it & it smiles back at you.- P Pilgrim So Smile Please

    M 1 Reply Last reply
    0
    • K Khaniya

      I need form with shaded background. One way, I can achieve it by making image of shaded color and set it as backgroundImage Second way, I can use System.Drawing.Drawing2D.LinearGradientBrush class with Form paint event My question is which one is good practice from the performance point of view ? Thanks in advance :)

      Life's Like a mirror. Smile at it & it smiles back at you.- P Pilgrim So Smile Please

      M Offline
      M Offline
      Michel Godfroid
      wrote on last edited by
      #2

      The difference will be trivial. If you're generating your background image from within your program, you should consider that GDI will probably have better algorithms than you for doing this. Also if your form is resized, you'll have to recalculate your background at every resize. If the form is only displayed once, you'll take a performance hit from going to an outside file, or paging in the resource you're using for the background. (bigger executable = larger loading time). But again, this are trivial performance differences.. Since you're displaying a form, I suspect that you want some user interaction. The user won't notice the difference.

      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