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. Custom Drawn Controls

Custom Drawn Controls

Scheduled Pinned Locked Moved Visual Basic
csharpwpfgraphicsarchitecture
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.
  • R Offline
    R Offline
    Rigga
    wrote on last edited by
    #1

    Hi, Using VB.NET. I'm a beginner so please be gentle.. I am trying to overdraw A ListBox control, among others, so that they have a solid 3 pixel border. Currently I am doing this by creating a customcontrol inheriting from the specific windows control i.e. CustomListBox, inherits ListBox... then handling the WndProc and looking for the WM_Paint message. I am then calling the MyBase.OnPaint.. this is to handle all of the item drawing, and on TextBox the text drawing stuff etc... then drawing over the 3DBorder with a solid border of the required colour. However when I do this and the control is resized it flickers quite badly and I want to stop the flickering. I have tried overriding the NC_PAINT message, which works very nicely, until the list box needs scroll bars.. then I am getting very strange results.. I've also tried setting the styles property to DoubleBuffer.. but that didn't seem to make a difference. I'm not even sure that I'm going about this in the right way. Does anyone know of a way to do this sort of thing correctly, or a way to stop the flickering. Any help at all would be appreciated. Even if it's to point me in the direction of a guide or documentation to custom drawing controls Regards and thanks in advance, Rig.

    M 1 Reply Last reply
    0
    • R Rigga

      Hi, Using VB.NET. I'm a beginner so please be gentle.. I am trying to overdraw A ListBox control, among others, so that they have a solid 3 pixel border. Currently I am doing this by creating a customcontrol inheriting from the specific windows control i.e. CustomListBox, inherits ListBox... then handling the WndProc and looking for the WM_Paint message. I am then calling the MyBase.OnPaint.. this is to handle all of the item drawing, and on TextBox the text drawing stuff etc... then drawing over the 3DBorder with a solid border of the required colour. However when I do this and the control is resized it flickers quite badly and I want to stop the flickering. I have tried overriding the NC_PAINT message, which works very nicely, until the list box needs scroll bars.. then I am getting very strange results.. I've also tried setting the styles property to DoubleBuffer.. but that didn't seem to make a difference. I'm not even sure that I'm going about this in the right way. Does anyone know of a way to do this sort of thing correctly, or a way to stop the flickering. Any help at all would be appreciated. Even if it's to point me in the direction of a guide or documentation to custom drawing controls Regards and thanks in advance, Rig.

      M Offline
      M Offline
      matthew barfoot
      wrote on last edited by
      #2

      I'm sorry that I cannot be of any help, but I would be very grateful for anything you may have learned in changing the border color of a textbox. Many thanks Matt:confused:

      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