Use the .ini file to create a "Dynamic Help" selected from TRNBO for the input interface.

xiaoxiao2021-03-06  63

In C # programming, in some cases we may also use .ini files. For example, create a "Dynamic Help" for an input interface: We set a label below the input interface, when the user moves the cursor to each TextBox or other input, select some of the help information to the input item. The INI file is a text file, which is composed of several sections. Here's the title (key) and its corresponding value (value) [section] key = value. Simple, the file name is: Helpinfo.ini. ----------------- [Promptinfo] YourTextbox = Please enter xxxxx information. ---------------- First we need to call kernel32.dll [DLLIMPORT ("kernel32")] private static extern int GetPrivateProfileString (String Section, String Key, String Def, StringBuilder RetVal, int size, then prepares a callback method this.YourTextBox.Enter = new system.eventhandler (this.Conector) for input items (such as a textbox) ENTER ENTER (such as a TextBox); System.Eventargs e) {string strpromptfile = directory.getCurrentDirectory () "//helpinfo.ini";// Get the path in which the INI file String strentral.gettype (). Tostring (). TouPper (); if strClsName.EndsWith ( "TEXTBOX")) {if (sender.Equals (YourTextBox)) {GetPrivateProfileString ( "PromptInfo", "YourTextBox", "", strPromptContent, 1024, strPromptFile);} txtHelpContent.Text = strPromptContent.ToString () // txthelpcontent is the label of displaying help information}

转载请注明原文地址:https://www.9cbs.com/read-86044.html

New Post(0)