Results 1 to 12 of 12

Thread: Visual Basic 2017: can i inherit the usercontrol from a form?

  1. #1

    Thread Starter
    PowerPoster joaquim's Avatar
    Join Date
    Apr 2007
    Posts
    3,904

    Visual Basic 2017: can i inherit the usercontrol from a form?

    can i inherit the usercontrol from a form?
    VB6 2D Sprite control

    To live is difficult, but we do it.

  2. #2
    Super Moderator Shaggy Hiker's Avatar
    Join Date
    Aug 2002
    Location
    Idaho
    Posts
    38,989

    Re: Visual Basic 2017: can i inherit the usercontrol from a form?

    You can inherit a form from a form, and a form is derived from Control, but what would be the point of inheriting a usercontrol from a form? You'd ultimately want to put a usercontrol ON a form, which wouldn't make so much sense if it WAS a form already. If you want something that IS a form, then you want a form, or a class derived from form.
    My usual boring signature: Nothing

  3. #3

    Thread Starter
    PowerPoster joaquim's Avatar
    Join Date
    Apr 2007
    Posts
    3,904

    Re: Visual Basic 2017: can i inherit the usercontrol from a form?

    my big objective was win a property: TransparencyKey.
    i hate the BackColor - Transparent, because isn't real.
    what i can do is regions with bitmaps, it's very slow.. very slow
    VB6 2D Sprite control

    To live is difficult, but we do it.

  4. #4
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    110,299

    Re: Visual Basic 2017: can i inherit the usercontrol from a form?

    A user control is, by definition, a control that inherits UserControl. If your class inherits Form then it is, by definition, a form. You can actually add a form to another form as a child control, but that would do you no good in your case. TransparencyKey is only relevant to a top-level form. You can't use TransparencyKey to see through a child control to its parent control. TransparencyKey is specifically for seeing through a top-level form and all its child controls to the desktop.

    If you're not happy with how transparency works in Windows Forms then don't use Windows Forms. Learn to work with WPF or UWP, which were built from the ground up with modern features like transparency in mind.

  5. #5

    Thread Starter
    PowerPoster joaquim's Avatar
    Join Date
    Apr 2007
    Posts
    3,904

    Re: Visual Basic 2017: can i inherit the usercontrol from a form?

    thanks for correct me that.
    - if a child uses a form transparentkey, we get a hole on form lol
    - if the backcolor is Transparent, we can't see the controls on back lol
    what Microsoft have against a real transparent? or they could facilitate the Regions for controls(i mean with images)
    VB6 2D Sprite control

    To live is difficult, but we do it.

  6. #6
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    110,299

    Re: Visual Basic 2017: can i inherit the usercontrol from a form?

    Microsoft don't have anything against "real" transparency. That's why they built it into WPF. Windows Forms was born in a time when transparency wasn't much of a thing. To retrofit "real' transparency into WinForms after the fact would have been very difficult and could quite possibly have involved an unacceptable level of breaking changes. As I said, WPF was built from the ground up to support modern features like transparency. You know what your options are. What you wish was the case won't change them.

  7. #7

    Thread Starter
    PowerPoster joaquim's Avatar
    Join Date
    Apr 2007
    Posts
    3,904

    Re: Visual Basic 2017: can i inherit the usercontrol from a form?

    i'm sorry but using Windows Forms and WPF are more or less the same?(speaking on project, because i understand that they are a different tools)
    VB6 2D Sprite control

    To live is difficult, but we do it.

  8. #8
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    110,299

    Re: Visual Basic 2017: can i inherit the usercontrol from a form?

    Quote Originally Posted by joaquim View Post
    i'm sorry but using Windows Forms and WPF are more or less the same?
    As Google apparently doesn't service your area so you can't find out for yourself, Windows Forms and WPF are both intended to create Win32 desktop apps. There are significant differences between them, most obviously that WPF works more like ASP.NET in that you use XAML markup to define the UI and then separate VB or C# code to make things happen. There's plenty for a Windows Forms developer to learn when migrating to WPF but if you want the features that WPF provides and WinForms does not then that's the price you pay. Also, moving to UWP at some point in the future would be much easier as it is also XAML-based.

  9. #9

    Thread Starter
    PowerPoster joaquim's Avatar
    Join Date
    Apr 2007
    Posts
    3,904

    Re: Visual Basic 2017: can i inherit the usercontrol from a form?

    i did more than that: i have tested. the WPF uses VB code for events. but it uses, too, the XML\HTML(something like that) language.
    VB6 2D Sprite control

    To live is difficult, but we do it.

  10. #10
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    110,299

    Re: Visual Basic 2017: can i inherit the usercontrol from a form?

    It is, as I said, XAML. That's Extensible Application Markup Language. It is XML-based.

  11. #11

    Thread Starter
    PowerPoster joaquim's Avatar
    Join Date
    Apr 2007
    Posts
    3,904

    Re: Visual Basic 2017: can i inherit the usercontrol from a form?

    i'm sorry, but why using 2 different languages on VB?
    VB6 2D Sprite control

    To live is difficult, but we do it.

  12. #12
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    110,299

    Re: Visual Basic 2017: can i inherit the usercontrol from a form?

    Quote Originally Posted by joaquim View Post
    i'm sorry, but why using 2 different languages on VB?
    I'm sure it was just to make your life more difficult. If you're interested, go and do some reading on the subject.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width