简体   繁体   中英

VB.NET UserControl inherits from AutoScaleDimensions

I just added the

Public Class ucGrid : Inherits System.Windows.Forms.Control

to

Public Class ucGrid

and then I get an error on the following 2 lines:

    Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!)
    Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font

The errors I am getting are ".AutoScaleDimnension" is not a member of uGridGrid" and "AutoScaleMode is not a member of uGrid"

Can somebody tell me what is going on here? I guess I am missing extensions but I don't really know where / how to fix this problem.

Thank you!

AutoScaleMode is a member of Forms, AutoScaleDimensions is a member of Container control. When your thing was a UserControl (guessing from the name ucGrid ), it was a member of Forms and inherited from ContainerControl so both properties were available.

Now since you inherit from System.Windows.Forms.Control (which inherits from Component ), those properties are not there. Technically, ucGrid is no longer a UserControl, but a control.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM