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. Creating a windows forms control with no (or minimal) GUI

Creating a windows forms control with no (or minimal) GUI

Scheduled Pinned Locked Moved C#
csharpasp-netwinformscomdesign
4 Posts 3 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
    Todd Davis
    wrote on last edited by
    #1

    I have created several ASP.NET server controls, but this is my first attempt at a control for Windows Forms. I need to build a control that has no visual component (for example, like an ImageList control). When I inherit from Control, it brings along a ton of properties and methods that I don't need or want (i.e. backcolor, font, anchor). What should I inherit from in order to create a control with no design time or visual properties? Just the properties and methods I dictate? -Todd Davis (toddhd@hotmail.com)

    B 1 Reply Last reply
    0
    • T Todd Davis

      I have created several ASP.NET server controls, but this is my first attempt at a control for Windows Forms. I need to build a control that has no visual component (for example, like an ImageList control). When I inherit from Control, it brings along a ton of properties and methods that I don't need or want (i.e. backcolor, font, anchor). What should I inherit from in order to create a control with no design time or visual properties? Just the properties and methods I dictate? -Todd Davis (toddhd@hotmail.com)

      B Offline
      B Offline
      Bill Dean
      wrote on last edited by
      #2

      Are you sure you want to create a control? Todd Davis wrote: no design time or visual properties? Just the properties and methods I dictate? Sounds like you just want to define your own class.class ToddsClass{ public int ToddsInteger; public int ToddsMethod(int iFactor){ return(iFactor*this.ToddsInteger); } public ToddsClass(){ //a constructor this.ToddsInteger=1; } }
      Or am I missing something? Bill

      T 1 Reply Last reply
      0
      • B Bill Dean

        Are you sure you want to create a control? Todd Davis wrote: no design time or visual properties? Just the properties and methods I dictate? Sounds like you just want to define your own class.class ToddsClass{ public int ToddsInteger; public int ToddsMethod(int iFactor){ return(iFactor*this.ToddsInteger); } public ToddsClass(){ //a constructor this.ToddsInteger=1; } }
        Or am I missing something? Bill

        T Offline
        T Offline
        Todd Davis
        wrote on last edited by
        #3

        Yup, you are right. I figured that out shortly after posting this. I had defined the class as a source code file, but we needed it to be a *.dll, and I got hung up on choosing Windows Forms Library from the new project wizard. I instead chose Class library, and now life is good... thanks! Never code when it is past your bedtime... :) -Todd Davis (toddhd@hotmail.com)

        H 1 Reply Last reply
        0
        • T Todd Davis

          Yup, you are right. I figured that out shortly after posting this. I had defined the class as a source code file, but we needed it to be a *.dll, and I got hung up on choosing Windows Forms Library from the new project wizard. I instead chose Class library, and now life is good... thanks! Never code when it is past your bedtime... :) -Todd Davis (toddhd@hotmail.com)

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

          If you want a component like the ImageList, however, that can interact with the designer, extend the Component class. Also, this has absolutely nothing to do with what kind of project you create. You are supposed to add classes to that and understand what's in the source file. A Windows Forms Application can contain all the same things a Windows Control Library can, and even an ASP.NET Web Application can, too, though a Windows Forms class won't do much good there. The difference is how the assemblies are built, whether they are self executing or loadable (among a few other differences in the PE/COFF header and where everything is located, etc.). Todd Davis wrote: Never code when it is past your bedtime... ...or before reading the documentation.

          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