-
Jan 27th, 2018, 03:29 PM
#1
Thread Starter
PowerPoster
Visual Basic 2017: can i inherit the usercontrol from a form?
can i inherit the usercontrol from a form?
-
Jan 27th, 2018, 04:47 PM
#2
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
-
Jan 27th, 2018, 04:54 PM
#3
Thread Starter
PowerPoster
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
-
Jan 27th, 2018, 08:52 PM
#4
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.
-
Jan 28th, 2018, 06:05 AM
#5
Thread Starter
PowerPoster
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)
-
Jan 28th, 2018, 06:18 AM
#6
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.
-
Jan 28th, 2018, 06:32 AM
#7
Thread Starter
PowerPoster
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)
-
Jan 28th, 2018, 07:34 AM
#8
Re: Visual Basic 2017: can i inherit the usercontrol from a form?
Originally Posted by joaquim
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.
-
Jan 28th, 2018, 10:26 AM
#9
Thread Starter
PowerPoster
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.
-
Jan 28th, 2018, 06:00 PM
#10
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.
-
Jan 29th, 2018, 01:28 PM
#11
Thread Starter
PowerPoster
Re: Visual Basic 2017: can i inherit the usercontrol from a form?
i'm sorry, but why using 2 different languages on VB?
-
Jan 29th, 2018, 09:09 PM
#12
Re: Visual Basic 2017: can i inherit the usercontrol from a form?
Originally Posted by joaquim
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|