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 that don't receive focus??

windows that don't receive focus??

Scheduled Pinned Locked Moved C#
question
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.
  • J Offline
    J Offline
    jremignanti
    wrote on last edited by
    #1

    I wanted to create my own Menu type class for use with a drop down button so that when you click the button a window can pop up that will contain some other controls. At first I thought I could do it with a stripped down form, but I realized that when I create the form it will always be activated and take focus from my main window (I don't want this to happen). So what I'm wondering is what are similar things like context menus or the dropdown portion of the combobox based on? Or is it possible to make a form that won't steal the focus? Thanks, Jesse

    H 1 Reply Last reply
    0
    • J jremignanti

      I wanted to create my own Menu type class for use with a drop down button so that when you click the button a window can pop up that will contain some other controls. At first I thought I could do it with a stripped down form, but I realized that when I create the form it will always be activated and take focus from my main window (I don't want this to happen). So what I'm wondering is what are similar things like context menus or the dropdown portion of the combobox based on? Or is it possible to make a form that won't steal the focus? Thanks, Jesse

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

      Windows Forms controls (as well as many classes in the .NET Framework Class Library (FCL) encapsulate native APIs. You need to research and understand the Windows APIs and common controls to do what you want. For instance, read the Windows Controls[^] and Windowing[^] sections in the Platform SDK. You need to understand window handles, styles, and message pumps. You might try searching CodeProject for existing managed samples (in C#, VB.NET, whatever - it all gets compiled to roughly the same thing), but you'll most likely find the majority of samples in VC++ or MFC. Writing custom menu bars and toolbars in VC++ or MFC is very common and there are plenty of samples both here on CodeProject and on sites like CodeGuru[^]. For example, you'll want to override the protected CreateParams property in your control derivative and use the WS_POPUP (0x80000000) window style. See the Platform SDK for more details about that, which should give you some idea of where to start.

      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