माइक्रोसॉफ्ट ने इसके बारे में एक वेबपेज लिखा था। यह ApplicationContext
का उपयोग करने का एक उदाहरण देता है। मूल रूप से फॉर्म प्रपत्र होने की बजाय, आपके पास एक ऐप है जो Main()
और Main
चलाता है और फिर फॉर्म खोलता है।
http://msdn.microsoft.com/en-us/library/Aa984417
आप कार्यक्षमता कि जिस तरह से की खो खो, तथापि, क्योंकि आप "अनुप्रयोग फ्रेमवर्क" निष्क्रिय करने के लिए है। यह आपके विंडोज बदसूरत बना देगा।
यहां एक अलग समाधान है, लगभग एक हैक लेकिन बहुत बुरा नहीं है। जब विंडोज़ आपके फॉर्म ऐप को शुरू करता है और Visible
को सत्य पर सेट करता है, तो यह SetVisibleCore
पर कॉल का कारण बनता है। आप उस समारोह को ओवरराइड कर सकते हैं। पहली बार SetVisibleCore
कहा जाता है, इसे गलत सेट करें। तब से, बस से गुज़रें।
ध्यान रखें कि Form.Load
तब नहीं ट्रिगर होगा जब आपका ऐप शुरू नहीं होता है, तो फॉर्म दिखाई नहीं दे रहा है, इसलिए सभी कोड Sub New()
में स्थानांतरित करें।
यहाँ पूरी बात है: गलत पर
Public Sub New()
' This call is required by the designer.
InitializeComponent()
' Add any initialization after the InitializeComponent() call.
config.LoadFromRegistry() 'this gets config.StartMinimized from the registry
' Code that needs to run at start, even if the form isn't showing,
' should be here. Form.Load will only happen when the Form is actually
' visible for the first time.
End Sub
Dim FirstSetVisible As Boolean = True
Protected Overrides Sub SetVisibleCore(ByVal value As Boolean)
If config.StartMinimized And FirstSetVisible Then
MyBase.SetVisibleCore(False) 'ignore Windows attempt to set Visible
FirstSetVisible = False 'never do this again
Else
MyBase.SetVisibleCore(value)
End If
End Sub
को WindowState सेट करें देना कुछ लेख लिंक – amexn
मैं तुम्हें एक लिंक दे दिया है - 'ApplicationContext' पर क्लिक करें। – GenericTypeTea