Click here to Skip to main content
15,884,013 members
Home / Discussions / C#
   

C#

 
GeneralRe: I can not see inside my phone directory branch when I plug it into my PC Pin
_Q12_10-Feb-22 3:05
_Q12_10-Feb-22 3:05 
GeneralRe: I can not see inside my phone directory branch when I plug it into my PC Pin
OriginalGriff10-Feb-22 3:58
mveOriginalGriff10-Feb-22 3:58 
GeneralRe: I can not see inside my phone directory branch when I plug it into my PC Pin
_Q12_15-Feb-22 1:46
_Q12_15-Feb-22 1:46 
GeneralRe: I can not see inside my phone directory branch when I plug it into my PC Pin
OriginalGriff15-Feb-22 2:15
mveOriginalGriff15-Feb-22 2:15 
GeneralRe: I can not see inside my phone directory branch when I plug it into my PC Pin
_Q12_9-Feb-22 23:39
_Q12_9-Feb-22 23:39 
AnswerRe: I can not see inside my phone directory branch when I plug it into my PC Pin
trønderen10-Feb-22 6:25
trønderen10-Feb-22 6:25 
GeneralRe: I can not see inside my phone directory branch when I plug it into my PC Pin
Richard Andrew x6410-Feb-22 9:25
professionalRichard Andrew x6410-Feb-22 9:25 
QuestionIt doesn't seem like resizable forms are inheritable Pin
RobertSF9-Feb-22 10:44
professionalRobertSF9-Feb-22 10:44 
I've recently experimented with base and derived forms, and though it works fine with non-resizable forms, there are problems with resizable forms.

As you know, with resizable forms, you use anchoring and docking to keep the controls in place and let the form resize gracefully. But when you inherit from a form that has anchored or docked controls, the inherited form does not display correctly in the Visual Studio Form Designer. It appears to compile and display correctly while running, but that too could break.

Obviously, in an inherited form, both constructors execute, the base form's and the derived form's. It seems the problem is that one form's constructor sets measurements while the layout is suspended in the other form's constructor. I read about this in Roland Weigelt's blog Roland Weigelt - Visual Inheritance - How to escape Layout Hell[^]

He explains that
Quote:
In the moment the constructor of the base class is left, the layout and the controls are perfect for a Form1 instance - but that's not what we want. The method InitializeComponent() of class Form2 contains the code that is necessary to achieve the desired layout by tweaking the base form and adding the second button. While setting the Text property to "Form2" is rather trivial, setting the ClientSize property causes serious trouble. The problem is that the size is set while the layout logic is suspended; i.e. the size of the form is changed, but the anchored elements of the base class are not updated.

And in Roland Weigelt - Visual Inheritance Revisited[^]
Quote:
Question: So why does docking work, but not anchoring?

Docking tells a control to grab as much space as possible (for top/bottom/left/right: towards to the specified direction) until a border of the container is reached. When the size of the control's container changes, the border is moving, so the docked control will resize itself accordingly.
Anchoring tells a control to keep a constant distance between a specified border (top/bottom/left/right) of the control and the corresponding border of the container at all times. Now if the container is resized while layout is suspended (which is the case in InitializeComponent() of class Form2), the anchored control does not notice the change. When layout is resumed, the control will keep the distance that exists at this time. This can be observed if you resize the form either inside the forms designer or at run time. The anchoring works perfectly, but unfortunately using the wrong offsets...

He advises to use docked panels, but I found this not to work, probably because WinForms has changed since 2003, when he wrote that article.

For now, I'm experimenting with form templates. But templates go only one way. They are basically just copies, so later revisions to the templates don't appear in the forms created from the templates.

Do you use form inheritance, and if so, how do you deal with this?
AnswerRe: It doesn't seem like resizable forms are inheritable Pin
Eddy Vluggen9-Feb-22 10:59
professionalEddy Vluggen9-Feb-22 10:59 
GeneralRe: It doesn't seem like resizable forms are inheritable Pin
RobertSF9-Feb-22 11:01
professionalRobertSF9-Feb-22 11:01 
GeneralRe: It doesn't seem like resizable forms are inheritable Pin
Eddy Vluggen9-Feb-22 11:08
professionalEddy Vluggen9-Feb-22 11:08 
AnswerRe: It doesn't seem like resizable forms are inheritable Pin
OriginalGriff9-Feb-22 20:09
mveOriginalGriff9-Feb-22 20:09 
GeneralRe: It doesn't seem like resizable forms are inheritable Pin
RobertSF10-Feb-22 5:25
professionalRobertSF10-Feb-22 5:25 
GeneralRe: It doesn't seem like resizable forms are inheritable Pin
OriginalGriff10-Feb-22 5:34
mveOriginalGriff10-Feb-22 5:34 
General[Solved] Re: It doesn't seem like resizable forms are inheritable Pin
RobertSF10-Feb-22 8:29
professionalRobertSF10-Feb-22 8:29 
GeneralRe: [Solved] Re: It doesn't seem like resizable forms are inheritable Pin
OriginalGriff10-Feb-22 9:01
mveOriginalGriff10-Feb-22 9:01 
GeneralRe: [Solved] Re: It doesn't seem like resizable forms are inheritable Pin
RobertSF12-Feb-22 8:59
professionalRobertSF12-Feb-22 8:59 
GeneralRe: [Solved] Re: It doesn't seem like resizable forms are inheritable Pin
OriginalGriff12-Feb-22 9:12
mveOriginalGriff12-Feb-22 9:12 
QuestionHow to convert sample code (available in java, PHP and python) to C# for creating a bot using mediawiki API? Pin
Pallavi H Shinde9-Feb-22 5:57
Pallavi H Shinde9-Feb-22 5:57 
AnswerRe: How to convert sample code (available in java, PHP and python) to C# for creating a bot using mediawiki API? Pin
Eddy Vluggen9-Feb-22 6:01
professionalEddy Vluggen9-Feb-22 6:01 
GeneralRe: How to convert sample code (available in java, PHP and python) to C# for creating a bot using mediawiki API? Pin
Pallavi H Shinde9-Feb-22 7:09
Pallavi H Shinde9-Feb-22 7:09 
GeneralRe: How to convert sample code (available in java, PHP and python) to C# for creating a bot using mediawiki API? Pin
Eddy Vluggen9-Feb-22 8:03
professionalEddy Vluggen9-Feb-22 8:03 
AnswerRe: How to convert sample code (available in java, PHP and python) to C# for creating a bot using mediawiki API? Pin
Richard Deeming9-Feb-22 23:09
mveRichard Deeming9-Feb-22 23:09 
QuestionAsp.Net Core. Sending requests with Postman Pin
Kamil Kluska5-Feb-22 22:08
Kamil Kluska5-Feb-22 22:08 
AnswerRe: Asp.Net Core. Sending requests with Postman Pin
Tony Hill6-Feb-22 1:38
mveTony Hill6-Feb-22 1:38 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.