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. WM_PRINT for themed controls

WM_PRINT for themed controls

Scheduled Pinned Locked Moved C#
graphicstutorialquestion
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.
  • M Offline
    M Offline
    Mathew Hall
    wrote on last edited by
    #1

    Hi, I'm trying to get a custom control to render its contents into a bitmap by sending it a WM_PRINT message. This works great if XP themes are not enabled. If XP themes are enabled, some controls (textbox, listview, listbox, treeview, datetimepicker) forget how to draw a themed border and draw an unthemed 3d border instead - and the groupbox only draws its background :wtf: Any ideas on how to get round this? "I think I speak on behalf of everyone here when I say huh?" - Buffy

    H 1 Reply Last reply
    0
    • M Mathew Hall

      Hi, I'm trying to get a custom control to render its contents into a bitmap by sending it a WM_PRINT message. This works great if XP themes are not enabled. If XP themes are enabled, some controls (textbox, listview, listbox, treeview, datetimepicker) forget how to draw a themed border and draw an unthemed 3d border instead - and the groupbox only draws its background :wtf: Any ideas on how to get round this? "I think I speak on behalf of everyone here when I say huh?" - Buffy

      H Offline
      H Offline
      Heath Stewart
      wrote on last edited by
      #2

      First, don't handle the WM_PAINT message. Override OnPaint for your controls (unless you're using an IMessageFilter or something) and use Control.SetStyle with the ControlStyles enumeration (read the .NET Framework SDK documentation for details) to control exactly what gets drawn. If you don't want this code to run on Windows XP, use the Environment.Version property to determine on what platform and version of the OS the environment (the CLR) is running. Use that as a condition to executing certain code.

      Microsoft MVP, Visual C# My Articles

      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