dcsimg
Results 1 to 12 of 12
  1. #1

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

    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
    32,039

    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,158

    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
    .NUT jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    98,682

    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.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

  5. #5

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

    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
    .NUT jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    98,682

    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.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

  7. #7

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

    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
    .NUT jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    98,682

    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.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

  9. #9

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

    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
    .NUT jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    98,682

    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.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

  11. #11

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

    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
    .NUT jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    98,682

    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.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

Posting Permissions

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



Featured


Click Here to Expand Forum to Full Width


×
We have made updates to our Privacy Policy to reflect the implementation of the General Data Protection Regulation.