A
A
Alexander Petrenko2018-10-09 16:14:55
C++ / C#
Alexander Petrenko, 2018-10-09 16:14:55

Best practice, or how to change the font of the main form, through the submenu of the child form?

Hello, tell me how you can change the font of the menu of the main form, through the menu sub-item of the child form. I got acquainted with C# recently, and now such a question arose. )
Ps Thanks in advance.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
#
#, 2018-10-09
@Gelisore

no special best practices:
- regardless of childhood, to influence the form, you need a "link" (not in the sense of referencing, but a variable of the desired type myForm) and a public method that performs the necessary actions with private properties
- about "links" - the main form, as a rule, she knows all the "daughters", by the fact that she usually creates them herself. but in the "daughters" it is necessary to provide a public property/field of the MainForm type. and after creating a child from the main form, set this field/property to this . only then run it. .. it is also possible through the constructor, but for me it’s more gimmicky
upd, although in fact there is one feature of 5ODp4P3.pngPropertyBinding to AplicationSettings, but there you won’t get off with the knowledge of how to change the font ))
this is a regular mechanism for creating saved configs. frankly, already decently outdated (like the forms themselves). but you have to climb on MSDN))

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question