How do you make an invisible OCX?

Hi, I'm using VB express and I cant seem to find a way of making my usercontrol invisible I can do it with VB6, its easy, But I want to make a control that doesn't have location and other visual properties, I've seen them but I cant make them. Am I missing something

PS. Please dont post the obvious set visible to false, thats not what I want, lol, I want the ocx to only expose the methods and properties I set.

Thanks.




Answer this question

How do you make an invisible OCX?

  • rod_r

    No I dont get anything like that, trust me, I have looked, the method I talked about works though, so I'll just make one and use that as a basis for all the rest I make.

    Thanks for your time though in helping me out.



  • Geraldo Thomaz JR.

    when you right click your project, does a meny come up that sasy "Add->" and the sub menu under this, does it have "Component. . ."

  • Jacksdisplayname

    http://msdn2.microsoft.com/en-us/9k9st93e.aspx

    From that page:

    All designers implement the IDesigner interface, which defines the basic designer interface methods. The .NET Framework also provides a set of base designer classes that provide methods that can be useful to designers that support specific types of components or controls.

    http://msdn.microsoft.com/library/default.asp url=/library/en-us/cpref/html/frlrfSystemWindowsFormsControlClassTopic.asp

    From that page:

    The Control class implements very basic functionality required by classes that display information to the user. It handles user input through the keyboard and pointing devices. It handles message routing and security. It defines the bounds of a control (its position and size), although it does not implement painting. It provides a window handle (hWnd).

    You CANNOT have a windowless control, a control has a hWnd, and a position and size. That is the point I was making, and it is true. I did also say that the items you were referring to as examples were not controls, by definition. This is true. They are components that impliment IDesigner. I also said that I didn't know that at the time, because I don't use them. My answers were therefore correct.

    // not to express personal views and opinions about the people posting the questions.

    I apologise, but the arrogance of people who take something for free then complain that it's not good enough gets up my nose.

    I would suggest that you stop using the terminology 'windowless controls'. It is wrong.



  • mthierauf

    Sounds to me like they are wanting to create a custom component. I don't know if the express version has the template for createing a component.



  • Klgsx

    // They get you all excited about programming using the lastest tools and techniques then strip you functionality. Makes me laff.

    I have to laugh everytime I see people on these forums using an express edition ( which is free ) and complaining that it doesn't do everything that the full priced versions do.



  • Shawn Rheal

    Okay, I just loaded express and the menu i get is summat like this:

    New item...
    Existing item...
    Folder
    --------------------
    Windows Form...
    User Control...
    --------------------
    Module...
    Class...

    I dont think i've got the functionality in express. I'll work around it somehow.



  • Bill.Net

    Thanks for replying but your missing the point, you can have controls that are accessable but not visable, you drag them from the toolbox and they sit in an area below the designer. See Just like the NotifyIcon. The 'Visible' property you are refering to is the controls own visible property which can be modified at runtime. Usercontrol designers who wrote controls in VB6 will know exactly what I mean. I think the standard term for what I want is a windowless control.

    Thanks anyway.



  • geniusguy

    It also makes me laff when people who have nothing constructive to say post replies to threads they know nothing about.

    Forums like these are designed for people to get help, not to express personal views and opinions about the people posting the questions.

    Anyway, the solution to creating windowless controls lies with the IDesigner interface. Using this you expose whatever you want and hide whatever you dont want, you can even have those little arrows next to the control that give you design time options without having to scroll through the properties window.

    If anybody is interested, there is an introduction to designers at http://www.developerfusion.co.uk/show/4411

    Cant have windowless controls eh



  • jklein

    Thanks Jayson, I think that's the problem, I've looked at source for other projects that do what I want, and they do have a different class type than a standard class, one which I cannot select. I'll see if I can pinch the class and just clear it out and re-use it. They get you all excited about programming using the lastest tools and techniques then strip you functionality. Makes me laff.

    Thanks anyway for your help.



  • Par Hedberg

    I still think you should drop back to a Component.

    when you select New Item, is component not listed as a template



  • Byaloz

    Create a class that derives from System.ComponentModel.Component



  • BauerK

    Yeah. . . just to add on a little.

    the proper .NET way of doing things is to implement a component.

    Try to forget everything you did in VB6 (which I lovingly call VBSUX as it was a gawd awful development environment. . .not fit for human consumption, but thats another story) as .NET is a real development platform.

    It sounds like your install is corrupt.

    Did you by any chance ever have a beta version of vb express installed

    look in [Visual Studio Install Directory]\Common7\IDE\ItemTemplates folder. . . are there any .ZIP files underneath that (perhaps in a child folder) there should be a Components.zip file there.

    do a search for vbexpress /InstallVSTemplates

    It appears people have had similar problems.



  • TechAddict

    Sounds to me like you want to build a COM dll. Why That is, why do you need COM Do you need to interface with VB6 If not, you can just build a normal dll that exposes methods and properties.

    BTW, you asked how to make your usercontrol invisible, then you said 'don't tell me to set visible to false'. That is indeed the only way to make a control invisible. All controls will have a position and a size, and will be visible unless set otherwise.



  • jayman16

    // you drag them from the toolbox and they sit in an area below the designer

    Those things are

    1 - not OCXs

    2 - not controls ( except stuff like an openfiledialog, which is still a seperate class/form, not a control on a form ).

    // I think the standard term for what I want is a windowless control.

    There is no such thing. A control in .NET is derived from a base class which has a window. What seems likely is that you want a way to write a class which can be dragged onto a form without appearing on it, in the designer. I don't know how to do that, but however it's done, it's still not a control. I think that anything which does not appear on a form does not belong in the designer. I appreciate that there are differences of opinion, especially for library writers, who obviously have a market in people who want to avoid writing code. That being the case, I'm probably not the one to help you further. However, hopefully our conversation has clarified what you want sufficiently that someone else will be able to help you further, as you seem to want something completely different to how I first understood your question.

    Good luck.



  • How do you make an invisible OCX?