FindString() public method

public FindString ( string s ) : int
s string
return int
示例#1
0
        private void AutoComplete_KeyUp(ComboBox comboBox2, KeyEventArgs e)
        {
            string sTypedText = null;
            int iFoundIndex = 0;
            object oFoundItem = null;
            string sFoundText = null;
            string sAppendText = null;

            //Allow select keys without Autocompleting
            switch (e.KeyCode)
            {
                case Keys.Back:
                case Keys.Left:
                case Keys.Right:
                case Keys.Up:
                case Keys.Delete:
                case Keys.Down:
                case Keys.ShiftKey:
                case Keys.Shift:
                case Keys.RShiftKey:
                case Keys.LShiftKey:
                case Keys.Oem1:
                case Keys.Oem102:
                case Keys.Oem2:
                case Keys.Oem3:
                case Keys.Oem4:
                case Keys.Oem5:
                case Keys.Oem6:
                case Keys.Oem7:
                case Keys.Oem8:
                    return;
            }

            //Get the Typed Text and Find it in the list
            sTypedText = comboBox2.Text;
            iFoundIndex = comboBox2.FindString(sTypedText);

            //If we found the Typed Text in the list then Autocomplete

            if (iFoundIndex >= 0)
            {
                //Get the Item from the list (Return Type depends if Datasource was bound or List Created)
                oFoundItem = comboBox2.Items[iFoundIndex];

                //Use the ListControl.GetItemText to resolve the Name in case the Combo was Data bound
                sFoundText = comboBox2.GetItemText(oFoundItem);

                //Append then found text to the typed text to preserve case
                sAppendText = sFoundText.Substring(sTypedText.Length);
                comboBox2.Text = sTypedText + sAppendText;

                //Select the Appended Text
                comboBox2.SelectionStart = sTypedText.Length;
                comboBox2.SelectionLength = sAppendText.Length;

                label10.Text = ((Person)oFoundItem).Name;
                label11.Text = ((Person)oFoundItem).Email;
                label12.Text = ((Person)oFoundItem).SSN;
            }
        }
示例#2
0
 public void SetCombos(string value, System.Windows.Forms.ComboBox combo1,
                       System.Windows.Forms.ComboBox combo2)
 {
     if (value.Length > 0)
     {
         if (value.Split(',').Length == 2)
         {
             combo1.SelectedIndex = combo1.FindString(value.Split(',')[0]);
             combo2.SelectedIndex = combo2.FindString(value.Split(',')[1]);
         }
         else
         {
             combo1.SelectedIndex = combo1.FindString(value);
         }
     }
 }
示例#3
0
 private void FillValues()
 {
     portLabel.Text               = m_settings.port;
     checkBoxAR.Checked           = m_settings.autoReopen;
     baudLabel.Text               = "" + m_settings.baudRate.ToString();
     comboBoxParity.SelectedIndex = (int)m_settings.parity;
     comboBoxDB.SelectedIndex     = comboBoxDB.FindString(m_settings.dataBits.ToString());
     comboBoxSB.SelectedIndex     = (int)m_settings.stopBits;
     checkBoxCTS.Checked          = m_settings.txFlowCTS;
     checkBoxDSR.Checked          = m_settings.txFlowDSR;
     checkBoxTxX.Checked          = m_settings.txFlowX;
     checkBoxXC.Checked           = m_settings.txWhenRxXoff;
     comboBoxRTS.SelectedIndex    = (int)m_settings.useRTS;
     comboBoxDTR.SelectedIndex    = (int)m_settings.useDTR;
     checkBoxRxX.Checked          = m_settings.rxFlowX;
     checkBoxGD.Checked           = m_settings.rxGateDSR;
     comboBoxXon.SelectedIndex    = (int)m_settings.XonChar;
     comboBoxXoff.SelectedIndex   = (int)m_settings.XoffChar;
     numericUpDownTM.Value        = m_settings.sendTimeoutMultiplier;
     numericUpDownTC.Value        = m_settings.sendTimeoutConstant;
     numericUpDownLW.Value        = m_settings.rxLowWater;
     numericUpDownHW.Value        = m_settings.rxHighWater;
     numericUpDownRxS.Value       = m_settings.rxQueue;
     checkBoxCheck.Checked        = m_settings.checkAllSends;
     numericUpDownTxS.Value       = m_settings.txQueue;
 }
示例#4
0
        //GetCamSettings
        public static void GetCamSettingsCombobox(ComboBox c)
        {
            WebCamSettings = c;

            try
            {
                videoSource = new VideoCaptureDevice(VideoDevices[WebCamList.SelectedIndex].MonikerString);
                WebCamSettings.Items.Clear();
                //DeviceExist = true;
                foreach (var capability in videoSource.VideoCapabilities)
                {
                    WebCamSettings.Items.Add(capability.FrameSize.Width.ToString() + " x " + capability.FrameSize.Height.ToString() + "  " + capability.AverageFrameRate.ToString() + " fps");
                }

                if (Properties.Settings.Default.WebCamResolution == null || Properties.Settings.Default.WebCamDevice != Convert.ToString(WebCamList.SelectedItem))
                {
                    WebCamSettings.SelectedIndex = 0;
                }
                else
                {
                    WebCamSettings.SelectedIndex = WebCamSettings.FindString(Properties.Settings.Default.WebCamResolution);
                }
            }
            catch (ArgumentOutOfRangeException)
            {
                //DeviceExist = false;
                WebCamSettings.Items.Add("No capture device on your system");
            }
        }
示例#5
0
        //GetCamList
        public static void GetCamListCombobox(ComboBox c)
            
        {
            WebCamList = c;

            try
            {
                VideoDevices = new FilterInfoCollection(FilterCategory.VideoInputDevice);
                WebCamList.Items.Clear();

                foreach (FilterInfo device in VideoDevices)
                {
                    WebCamList.Items.Add(device.Name);
                }

                if (Properties.Settings.Default.WebCamDevice == null)
                {
                    WebCamList.SelectedIndex = 0; //First cam found is default
                }
                else
                {
                    WebCamList.SelectedIndex = WebCamList.FindString(Properties.Settings.Default.WebCamDevice);
                }
            }
            catch (ApplicationException)
            {
                //DeviceExist = false;
                WebCamList.Items.Add("No capture device on your system");
            }
        }
示例#6
0
            public propertiesDialog(CompassLayer layer)
            {
                InitializeComponent();
                //this.Icon = WorldWind.PluginEngine.Plugin.Icon;
                this.layer = layer;
                // Init texture list with *.png
                DirectoryInfo di = new DirectoryInfo(layer.pluginPath);

                FileInfo[] imgFiles = di.GetFiles("*.png");
                cboTexture.Items.AddRange(imgFiles);
                imgFiles = di.GetFiles("*.svg");                 // Tests vector graphics...
                cboTexture.Items.AddRange(imgFiles);
                // select current bitmap
                int i = cboTexture.FindString(layer.textureFileName);

                if (i != -1)
                {
                    cboTexture.SelectedIndex = i;
                }
                // Tilt
                chkTilt.Checked = layer.tilt;
                // Positions
                cboPosition.Items.Add("Top-Left");
                cboPosition.Items.Add("Top-Center");
                cboPosition.Items.Add("Top-Right");
                cboPosition.Items.Add("Bottom-Left");
                cboPosition.Items.Add("Bottom-Center");
                cboPosition.Items.Add("Screen-Center");
                i = cboPosition.FindString(layer.spritePos);
                if (i != -1)
                {
                    cboPosition.SelectedIndex = i;
                }
            }
 public void FormShow(ref ComboBox cb, ref RichTextBox rt1, ref RichTextBox rt2, ref TextBox rt3, ref RichTextBox rt4, ref ComboBox rt5, ref TextBox rt6, ref ComboBox rt7, ref ComboBox rt8, ref ComboBox rt9, ref ComboBox rt10, ref ComboBox rt11, ref ComboBox rt12)
 {
     cb.Text = EntData[0];
     rt3.Text = EntData[1].Substring(EntData[1].IndexOf("-") + 1);
     rt1.Text = EntData[4];
     rt2.Text = EntData[5];
     rt4.Text = EntData[6];
     rt5.Text = EntData[8];
     rt6.Text = EntData[9];
     rt7.SelectedIndex = rt7.FindString(CommonMethods.ConvertToHours(Bh));
     rt8.SelectedIndex = rt8.FindString(CommonMethods.ConvertToHours(Ubh));
     rt9.Text = ProjectType;
     rt10.Text = HaveWork;
     if (UserStory.Equals(" "))
     {
         rt11.SelectedIndex = 0;
     }
     else
     {
         rt11.Text = UserStory;
     }
     if (ShiftTimings.Equals(" "))
     {
         rt12.SelectedIndex = 0;
     }
     else
     {
         rt12.Text = ShiftTimings;
     }
 }
示例#8
0
        private void cmbxPhotographer_TextChanged(object sender, System.EventArgs e)
        {
            if (_inTextChanged)
            {
                return;
            }

            string text  = cmbxPhotographer.Text;
            int    index = cmbxPhotographer.FindString(text);

            if (index >= 0)
            {
                // Found a match
                _inTextChanged = true;
                string newText = cmbxPhotographer.Items[index].ToString();
                cmbxPhotographer.Text = newText;

                if (newText.Length > text.Length)
                {
                    // Only drop if selected text.
                    cmbxPhotographer.DroppedDown = true;
                }
                cmbxPhotographer.SelectionStart  = text.Length;
                cmbxPhotographer.SelectionLength = newText.Length - text.Length;

                _inTextChanged = false;
            }
        }
        public static void fillCountry(ComboBox objCmbCountry,String CountryCode)
        {
            //DataTable objDT = new DataTable("Country");
            //DataRow objRow;
            //DataColumn objcol =new DataColumn("ContryName",typeof(System.String));
            //objDT.Columns.Add(objcol);

            //objcol =new DataColumn("ContryId",typeof(System.String));
            //objDT.Columns.Add(objcol);

            XmlNodeReader objXmlReader;
            DataSet ds = new DataSet();
            XmlDocument  objOutXml = new XmlDocument();
            String strInput = "<MS_LISTCOUNTRY_OUTPUT><COUNTRY  COUNTRY_CODE='0' COUNTRY_NAME='Select one'/><COUNTRY  COUNTRY_CODE='BD' COUNTRY_NAME='Bangladesh'/><COUNTRY  COUNTRY_CODE='IN' COUNTRY_NAME='India' /><COUNTRY  COUNTRY_CODE='NP' COUNTRY_NAME='Nepal' /> <COUNTRY  COUNTRY_CODE='LK' COUNTRY_NAME='Srilanka' /><COUNTRY  COUNTRY_CODE='BT' COUNTRY_NAME='Bhutan' /><COUNTRY  COUNTRY_CODE='ML' COUNTRY_NAME='Maldives' /><COUNTRY  COUNTRY_CODE='TB' COUNTRY_NAME='TBA' /> <Errors Status='False'><Error Code='' Description='' /></Errors></MS_LISTCOUNTRY_OUTPUT>";
            objOutXml.LoadXml(strInput);

            objXmlReader = new XmlNodeReader(objOutXml);
            ds.ReadXml(objXmlReader);
            objCmbCountry.DataSource = ds.Tables["COUNTRY"];
            objCmbCountry.DisplayMember = "COUNTRY_NAME";
            objCmbCountry.ValueMember = "COUNTRY_CODE";
            objCmbCountry.SelectedIndex = 0;
            if (CountryCode !="")
            {
                objCmbCountry.SelectedIndex = objCmbCountry.FindString("India");
            }
        }
        private static void SetComboBoxString(System.Windows.Forms.ComboBox cb, string sText)
        {
            int idx = cb.FindString(sText);

            if (idx == -1)
            {
                Styx.Helpers.Logging.Write("Dialog Error: combobox {0} does not have value '{1}' in list", cb.Name, sText);
                idx = cb.FindString("Auto");
                if (idx == -1)
                {
                    Styx.Helpers.Logging.Write("Dialog Error: combobox {0} does not have an 'Auto' value either, defaulting to first in list", cb.Name);
                    idx = 0;
                }
            }

            cb.SelectedIndex = idx;
        }
示例#11
0
        private void Settings_Load(object sender, System.EventArgs e)
        {
            int index = cbPing.FindString(Setting.PingType);

            cbPing.SelectedIndex = index;
            index = cbTraceRoute.FindString(Setting.TraceRouteType);
            cbTraceRoute.SelectedIndex = index;
        }
示例#12
0
 private void Dialog_Load(object sender, System.EventArgs e)
 {
     YValue.Text = ChartRef.Series[0].Points[pointIndex].YValues[0].ToString();
     Label.Text  = ChartRef.Series[0].Points[pointIndex].Label;
     PointColor.SelectedIndex        = PointColor.FindString(ChartRef.Series[0].Points[pointIndex].Color.Name);
     MarkerColor.SelectedIndex       = MarkerColor.FindString(ChartRef.Series[0].Points[pointIndex].MarkerColor.Name);
     BorderColor.SelectedIndex       = BorderColor.FindString(ChartRef.Series[0].Points[pointIndex].BorderColor.Name);
     MarkerBorderColor.SelectedIndex = MarkerBorderColor.FindString(ChartRef.Series[0].Points[pointIndex].MarkerBorderColor.Name);
 }
示例#13
0
 public void SetCombosFormatMoney(string value, System.Windows.Forms.ComboBox combo1,
                                  System.Windows.Forms.ComboBox combo2)
 {
     if (value.Length > 0)
     {
         if (value.Split(',').Length == 2)
         {
             var t1 = Convert.ToDecimal(value.Split(',')[0]).ToString("C");
             var t2 = Convert.ToDecimal(value.Split(',')[1]).ToString("C");
             combo1.SelectedIndex = combo1.FindString(t1);
             combo2.SelectedIndex = combo2.FindString(t2);
         }
         else
         {
             var t1 = Convert.ToDecimal(value).ToString("C");
             combo1.SelectedIndex = combo1.FindString(t1);
         }
     }
 }
示例#14
0
 public void RefreshCurveEqComboBox(ComboBox cb, INCCAnalysisParams.CurveEquationVals v)
 {
     cb.Items.Clear();
     foreach (INCCAnalysisParams.CurveEquation cs in System.Enum.GetValues(typeof(INCCAnalysisParams.CurveEquation)))
     {
         //Per Martyn, use equation string, not named value.  7/17/2014 HN
                 cb.Items.Add(cs.ToDisplayString());                
     }
     cb.Refresh();
     cb.SelectedIndex = cb.FindString (v.cal_curve_equation.ToDisplayString());
 }
示例#15
0
        private void NewModule_Load(object sender, System.EventArgs e)
        {
            IntiFontLib();
            //添加
            if (!isModify)
            {
                //初始化界面
                comboBox1.Items.Clear();
                textBox1.Clear();
                textBox2.Clear();
                textBox3.Clear();

                //正式信息
                lock (typeof(C_Event.CSocketEvent))
                {
                    mResult = m_ClientEvent.RequestResult(C_Global.CEnum.ServiceKey.GAME_QUERY, C_Global.CEnum.Msg_Category.GAME_ADMIN, this.mMsgBody);
                }
                //检测状态
                if (mResult[0, 0].eName == C_Global.CEnum.TagName.ERROR_Msg)
                {
                    MessageBox.Show(mResult[0, 0].oContent.ToString());
                    //Application.Exit();
                    return;
                }

                comboBox1 = GMAdmin.DisplayComboBox(m_ClientEvent, comboBox1, mResult);
            }
            else            //编辑
            {
                comboBox1.Items.Clear();
                textBox1.Clear();
                textBox2.Clear();
                textBox3.Clear();

                lock (typeof(C_Event.CSocketEvent))
                {
                    mResult = m_ClientEvent.RequestResult(C_Global.CEnum.ServiceKey.GAME_QUERY, C_Global.CEnum.Msg_Category.GAME_ADMIN, this.mMsgBody);
                }
                //检测状态
                if (mResult[0, 0].eName == C_Global.CEnum.TagName.ERROR_Msg)
                {
                    MessageBox.Show(mResult[0, 0].oContent.ToString());
                    //Application.Exit();
                    return;
                }
                comboBox1 = GMAdmin.DisplayComboBox(m_ClientEvent, comboBox1, mResult);
                int index = comboBox1.FindString(requestMsgBody[1].oContent.ToString().Trim());
                this.comboBox1.SelectedIndex = index;
                //this.comboBox1.Text = requestMsgBody[1].oContent.ToString().Trim();
                this.textBox1.Text = requestMsgBody[2].oContent.ToString().Trim();
                this.textBox2.Text = requestMsgBody[3].oContent.ToString().Trim();
                this.textBox3.Text = requestMsgBody[4].oContent.ToString().Trim();
            }
        }
示例#16
0
        private void Init()
        {
            txtFileName.Text   = GlobalValues.PlainFileName;
            txtReportName.Text = GlobalValues.DefaultReportName;
            this.cboGraphicsUnit.Items.AddRange(Enum.GetNames(typeof(GraphicsUnit)));

            cboGraphicsUnit.SelectedIndex = cboGraphicsUnit.FindString(GraphicsUnit.Millimeter.ToString());

            this.radioPullModell.Checked = true;
            initDone = true;
        }
示例#17
0
            internal propertiesDialog(GlobalCloudsLayer layer)
            {
                this.layer = layer;
                InitializeComponent();
                //this.Icon = WorldWind.PluginEngine.Plugin.Icon;
                // Init texture list with *.jpg and/or *.png
                DirectoryInfo di = new DirectoryInfo(layer.cachePath);

                FileInfo[] imgFiles = di.GetFiles("*.png");
                cboTexture.Items.AddRange(imgFiles);
                // select current bitmap
                int i = cboTexture.FindString(layer.textureFileName);

                if (i != -1)
                {
                    cboTexture.SelectedIndex = i;
                }
                // Save current textureFileName
                savedTextureFileName = layer.textureFileName;
                //this.Text += layer.version;
            }
示例#18
0
        public ServerSettingsForm()
        {
            InitializeComponent();
            InitializingProviderTypes();
            LoadConnectionStrings();

            if (Server.ConnectionString.Length > 0)
            {
                uiConnectionStringComboList.SelectedIndex = uiConnectionStringComboList.FindString(Server.ConnectionString.Trim());
                uiProviderTypeSelection.SelectedIndex     = (int)Server.ProviderType;
            }
        }
示例#19
0
 private void NewPackageForm_Load(object sender, System.EventArgs e)
 {
     templateDirectoryTextBox.Text = StringSetting("templateDirectory",
                                                   @"C:\Program Files\Microsoft SDK\Samples\SysMgmt\MSI\Database");
     databaseFileNameTextBox.Text = StringSetting("databaseFileName",
                                                  "test.msi");
     manufacturerTextBox.Text         = StringSetting("manufacturer", "");
     productNameTextBox.Text          = StringSetting("productName", "");
     productVersionTextBox.Text       = StringSetting("productVersion", "1.0");
     targetRootComboBox.SelectedIndex = targetRootComboBox.FindString(
         StringSetting("targetRoot", "ProgramFiles"));
     targetDirectoryTextBox.Text = StringSetting("targetDirectory",
                                                 productNameTextBox.Text);
 }
示例#20
0
        private int FindByValue(System.Windows.Forms.ComboBox box, string strValue)
        {
            int index = 0;

            foreach (DictionaryEntry item in box.Items)
            {
                if (item.Value.ToString() == strValue)
                {
                    index = box.FindString(item.Key.ToString());
                    break;
                }
            }
            return(index);
        }
示例#21
0
        private void cmbxPhotographer_TextChanged(object sender, System.EventArgs e)
        {
            string text  = cmbxPhotographer.Text;
            int    index = cmbxPhotographer.FindString(text);

            if (index >= 0)
            {
                // Found a match
                string newText = cmbxPhotographer.Items[index].ToString();
                cmbxPhotographer.Text = newText;

                cmbxPhotographer.SelectionStart  = text.Length;
                cmbxPhotographer.SelectionLength = newText.Length - text.Length;
            }
        }
示例#22
0
            public propertiesDialog(AtmosphereLayer layer)
            {
                InitializeComponent();
                //this.Icon = WorldWind.PluginEngine.Plugin.Icon;
                this.layer = layer;
                // Init texture list with *.png
                DirectoryInfo di = new DirectoryInfo(layer.pluginPath);

                FileInfo[] imgFiles = di.GetFiles("*.png");
                cboTexture.Items.AddRange(imgFiles);
                // select current bitmap
                int i = cboTexture.FindString(layer.textureFileName);

                if (i != -1)
                {
                    cboTexture.SelectedIndex = i;
                }
            }
示例#23
0
        /// <summary>
        /// Checks if a Combobox Text is equal the selected item.
        /// </summary>
        /// <param name="AComboBox">ComboBox Control that should be verified.</param>
        /// <returns>TVerificationResult Nil if validation succeeded, otherwise it contains
        /// details about the problem.
        /// </returns>
        public static TVerificationResult ValidateStringComboBox(System.Windows.Forms.ComboBox AComboBox)
        {
            TVerificationResult ReturnValue = null;

            if (AComboBox.SelectedItem == null)
            {
                ReturnValue = new TVerificationResult(AComboBox.Name, ErrorCodes.GetErrorInfo(
                                                          CommonErrorCodes.ERR_INFORMATIONMISSING, StrNoItemSelected));
            }

            if (AComboBox.FindString(AComboBox.Text) != AComboBox.SelectedIndex)
            {
                ReturnValue = new TVerificationResult(AComboBox.Name, ErrorCodes.GetErrorInfo(
                                                          CommonErrorCodes.ERR_INFORMATIONMISSING, StrNonExistingItem));
            }

            return(ReturnValue);
        }
示例#24
0
            public propertiesDialog(SkyGradientLayer layer)
            {
                this.layer = layer;
                InitializeComponent();
                //this.Icon = WorldWind.PluginEngine.Plugin.Icon;
                // Init file list with *.csv
                DirectoryInfo di = new DirectoryInfo(layer.pluginPath);

                FileInfo[] imgFiles = di.GetFiles(layer.world.Name + "*.csv");
                cboFiles.Items.AddRange(imgFiles);
                // select current file
                int i = cboFiles.FindString(layer.presetFileName);

                if (i != -1)
                {
                    cboFiles.SelectedIndex = i;
                }
            }
示例#25
0
        public void AutoComplete(ComboBox cb, System.Windows.Forms.KeyPressEventArgs e, bool limitToList)
        {
            string strFindStr = "";

            if (e.KeyChar == (char)8)
            {
                if (cb.SelectionStart <= 1)
                {
                    cb.Text = "";
                    return;
                }

                if (cb.SelectionLength == 0)
                    strFindStr = cb.Text.Substring(0, cb.Text.Length - 1);
                else
                    strFindStr = cb.Text.Substring(0, cb.SelectionStart - 1);
            }
            else
            {
                if (cb.SelectionLength == 0)
                    strFindStr = cb.Text + e.KeyChar;
                else
                    strFindStr = cb.Text.Substring(0, cb.SelectionStart) + e.KeyChar;
            }

            int intIdx = -1;

            // 在combox中搜索字符串

            intIdx = cb.FindString(strFindStr);

            if (intIdx != -1)
            {
                cb.SelectedText = "";
                cb.SelectedIndex = intIdx;
                cb.SelectionStart = strFindStr.Length;
                cb.SelectionLength = cb.Text.Length;
                e.Handled = true;
            }
            else
            {
                e.Handled = limitToList;
            }
        }
示例#26
0
            public propertiesDialog(Stars3DLayer layer)
            {
                InitializeComponent();
                //this.Icon = WorldWind.PluginEngine.Plugin.Icon;
                this.layer = layer;
                // Init star catalog list with *.tsv
                DirectoryInfo di = new DirectoryInfo(layer.pluginPath);

                FileInfo[] imgFiles = di.GetFiles("*.tsv");
                cboTexture.Items.AddRange(imgFiles);
                // select current catalog
                int i = cboTexture.FindString(layer.catalogFileName);

                if (i != -1)
                {
                    cboTexture.SelectedIndex = i;
                }
                // Flares
                chkFlares.Checked = layer.showFlares;
            }
示例#27
0
		public void FindString ()
		{
			Thread.CurrentThread.CurrentCulture = new CultureInfo ("tr-TR");

			ComboBox cmbbox = new ComboBox ();
			Assert.AreEqual (-1, cmbbox.FindString ("Hello"), "#A1");
			Assert.AreEqual (-1, cmbbox.FindString (string.Empty), "#A2");
			Assert.AreEqual (-1, cmbbox.FindString (null), "#A3");
			Assert.AreEqual (-1, cmbbox.FindString ("Hola", -5), "#A4");
			Assert.AreEqual (-1, cmbbox.FindString ("Hola", 40), "#A5");

			cmbbox.Items.AddRange (new object [] { "in", "BADTest", "IN", "BAD", "Bad", "In" });
			Assert.AreEqual (2, cmbbox.FindString ("I"), "#B1");
			Assert.AreEqual (0, cmbbox.FindString ("in"), "#B2");
			Assert.AreEqual (1, cmbbox.FindString ("BAD"), "#B3");
			Assert.AreEqual (1, cmbbox.FindString ("Bad"), "#B4");
			Assert.AreEqual (1, cmbbox.FindString ("b"), "#B5");
			Assert.AreEqual (0, cmbbox.FindString (string.Empty), "#B6");
			Assert.AreEqual (-1, cmbbox.FindString (null), "#B7");

			Assert.AreEqual (3, cmbbox.FindString ("b", 2), "#C1");
			Assert.AreEqual (5, cmbbox.FindString ("I", 3), "#C2");
			Assert.AreEqual (4, cmbbox.FindString ("B", 3), "#C3");
			Assert.AreEqual (1, cmbbox.FindString ("B", 4), "#C4");
			Assert.AreEqual (5, cmbbox.FindString ("I", 4), "#C5");
			Assert.AreEqual (4, cmbbox.FindString ("BA", 3), "#C6");
			Assert.AreEqual (0, cmbbox.FindString ("i", -1), "#C7");
			Assert.AreEqual (3, cmbbox.FindString (string.Empty, 2), "#C8");
			Assert.AreEqual (-1, cmbbox.FindString (null, 1), "#C9");

			cmbbox.Items.Add (string.Empty);
			Assert.AreEqual (0, cmbbox.FindString (string.Empty), "#D1");
			Assert.AreEqual (-1, cmbbox.FindString (null), "#D2");

			Assert.AreEqual (4, cmbbox.FindString (string.Empty, 3), "#E1");
			Assert.AreEqual (-1, cmbbox.FindString (null, 99), "#E2");
			Assert.AreEqual (-1, cmbbox.FindString (null, -5), "#E3");
		}
示例#28
0
		public void FindString_StartIndex_Max ()
		{
			ComboBox cmbbox = new ComboBox ();
			cmbbox.Items.AddRange (new object [] { "ACBD", "ABDC", "ACBD", "ABCD" });
			try {
				cmbbox.FindString ("Hola", 4);
				Assert.Fail ("#1");
			} catch (ArgumentOutOfRangeException ex) {
				Assert.AreEqual (typeof (ArgumentOutOfRangeException), ex.GetType (), "#2");
				Assert.IsNull (ex.InnerException, "#3");
				Assert.IsNotNull (ex.Message, "#4");
				Assert.IsNotNull (ex.ParamName, "#5");
				Assert.AreEqual ("startIndex", ex.ParamName, "#6");
			}
		}
示例#29
0
            public propertiesDialog(GlobeIconLayer layer)
            {
                InitializeComponent();
                this.layer = layer;
                //this.Icon = WorldWind.PluginEngine.Plugin.Icon;
                this.Text = layer.pluginName + " " + layer.version + " properties";
                // Init texture list with *.png
                DirectoryInfo di = new DirectoryInfo(layer.texturePath);

                //DirectoryInfo di = new DirectoryInfo(Path.Combine(WorldWindSettings.WorldWindDirectory, "Data/Earth/BmngBathy"));
                FileInfo[] imgFiles = di.GetFiles("*.jpg");
                cboTexture.Items.AddRange(imgFiles);
                imgFiles = di.GetFiles("*.png");
                cboTexture.Items.AddRange(imgFiles);
                // select current bitmap
                int i = cboTexture.FindString(layer.textureFileName);

                if (i != -1)
                {
                    cboTexture.SelectedIndex = i;
                }
                // Show globe
                chkGlobe.Checked = layer.showGlobe;
                // Positions globe
                cboPosition.Items.Add("Top-Left");
                cboPosition.Items.Add("Top-Center");
                cboPosition.Items.Add("Top-Right");
                cboPosition.Items.Add("Bottom-Left");
                cboPosition.Items.Add("Bottom-Center");
                cboPosition.Items.Add("Bottom-Right");
                cboPosition.Items.Add("Screen-Center");
                i = cboPosition.FindString(layer.spritePos);
                if (i != -1)
                {
                    cboPosition.SelectedIndex = i;
                }
                // Size globe
                cboSize.Items.Add("64x64");
                cboSize.Items.Add("80x80");
                cboSize.Items.Add("100x100");
                cboSize.Items.Add("128x128");
                i = cboSize.FindString((layer.globeRadius * 2).ToString() + "x" + (layer.globeRadius * 2).ToString());
                if (i != -1)
                {
                    cboSize.SelectedIndex = i;
                }
                // Show inset
                chkInset.Checked = layer.showInset;
                // Positions inset
                cboPosition2.Items.Add("Top-Left");
                cboPosition2.Items.Add("Top-Center");
                cboPosition2.Items.Add("Top-Right");
                cboPosition2.Items.Add("Bottom-Left");
                cboPosition2.Items.Add("Bottom-Center");
                cboPosition2.Items.Add("Bottom-Right");
                cboPosition2.Items.Add("Screen-Center");
                i = cboPosition2.FindString(layer.insetPos);
                if (i != -1)
                {
                    cboPosition2.SelectedIndex = i;
                }
                // Size inset
                cboSize2.Items.Add("64x64");
                cboSize2.Items.Add("100x64");
                cboSize2.Items.Add("64x100");
                cboSize2.Items.Add("80x80");
                cboSize2.Items.Add("110x80");
                cboSize2.Items.Add("80x110");
                cboSize2.Items.Add("100x100");
                cboSize2.Items.Add("133x100");
                cboSize2.Items.Add("100x133");
                cboSize2.Items.Add("128x128");
                cboSize2.Items.Add("160x128");
                cboSize2.Items.Add("128x160");
                i = cboSize2.FindString(layer.insetWidth.ToString() + "x" + layer.insetHeight.ToString());
                if (i != -1)
                {
                    cboSize2.SelectedIndex = i;
                }
            }
示例#30
0
        private void findButton_Click(object sender, System.EventArgs e)
        {
            int index = comboBox1.FindString(textBox2.Text);

            comboBox1.SelectedIndex = index;
        }
示例#31
0
		public WordPadFormat(WordPad wordpad) {
			FontFamily[]	fontFamilies;

			this.wordpad = wordpad;
			Height = 21;
			fonts = new ComboBox();
			sizes = new ComboBox();

			fonts.DropDownStyle = ComboBoxStyle.DropDownList;

			fontFamilies = FontFamily.Families;
			fonts.BeginUpdate( );
			foreach ( FontFamily ff in fontFamilies ) {
				fonts.Items.Add( ff.Name );
			}
			fonts.EndUpdate();
			fonts.Location = new Point(0, 0);
			fonts.Width = 150;

			fonts.SelectedIndex = fonts.FindString("Arial");
			fonts.SelectedIndexChanged += new EventHandler(fonts_SelectedIndexChanged);

			sizes.DropDownStyle = ComboBoxStyle.DropDownList;
			sizes.Location = new Point(160, 0);
			sizes.Width = 50;

			sizes.Items.AddRange(new string[] {"8", "9", "10", "11", "12", "14", "16", "18", "20", "22", "24", "26", "28", "36", "48", "72"});
			Console.WriteLine ("font height:  {0}", wordpad.edit.Font.Height.ToString ());
			sizes.SelectedItem = wordpad.edit.Font.Height.ToString ();
			sizes.SelectedIndexChanged += new EventHandler(sizes_SelectedIndexChanged);



			this.Controls.Add(fonts);
			this.Controls.Add(sizes);
		}
示例#32
0
 public static DialogResult SubjectBox(string title, ref string[] value)
 {
     var form = new Form();
     var label1 = new Label();
     var name = new TextBox();
     var label2 = new Label();
     var department = new ComboBox();
     var buttonOk = new Button();
     form.Text = title;
     label1.AutoSize = true;
     label1.Location = new Point(12, 18);
     label1.Size = new Size(20, 13);
     label1.TabIndex = 0;
     label1.Text = "Название:";
     name.Location = new Point(74, 15);
     name.Size = new Size(219, 20);
     name.TabIndex = 1;
     name.Text = value[0];
     label2.AutoSize = true;
     label2.Location = new Point(17, 45);
     label2.Size = new Size(20, 13);
     label2.TabIndex = 2;
     label2.Text = "Кафедра:";
     department.DropDownWidth = 300;
     department.FormattingEnabled = true;
     department.Location = new Point(74, 42);
     department.Size = new Size(219, 21);
     department.TabIndex = 2;
     department.KeyPress += department_KeyPress;
     foreach (DataRow row in DBProvider.Departments().Rows)
     {
         department.Items.Add(row[0].ToString());
     }
     if (value[1] != "" && char.IsDigit(value[1], 0))
         department.Text = department.Items[Convert.ToInt32(value[1])].ToString();
     else
         department.Text = value[1];
     buttonOk.Location = new Point(110, 70);
     buttonOk.AutoSize = true;
     buttonOk.Size = new Size(20, 23);
     buttonOk.TabIndex = 3;
     buttonOk.UseVisualStyleBackColor = true;
     buttonOk.Text = title;
     buttonOk.DialogResult = DialogResult.OK;
     form.ClientSize = new Size(305, 100);
     form.Controls.AddRange(new Control[] { label1, label2, name, department, buttonOk });
     form.FormBorderStyle = FormBorderStyle.FixedDialog;
     form.StartPosition = FormStartPosition.WindowsDefaultLocation;
     form.MinimizeBox = false;
     form.MaximizeBox = false;
     form.AcceptButton = buttonOk;
     var dialogResult = form.ShowDialog();
     value[0] = name.Text;
     if (department.Text != "")
         value[1] = department.FindString(department.Text).ToString();
     else
         value[1] = "";
     return dialogResult;
 }
示例#33
0
        /// <summary>
        /// Sets the resolution drop down selected item to the one that is set in fsx.cfg
        /// </summary>
        public void SelectCurrentResolution(ComboBox comboBox, [Optional]string resolution)
        {
            using (IniFile iniFile = new IniFile())
            {
                iniFile.IniPath = Application.StartupPath + @"\locations.ini";
                iniFile.IniPath = iniFile.ReadValue("LOCATIONS", "cfg") + @"\fsx.cfg";

                if (resolution != null)
                {
                    comboBox.SelectedIndex = comboBox.FindString(resolution, -1);

                    if (comboBox.SelectedIndex == -1)
                        comboBox.SelectedIndex = 0;
                }
                else
                {
                    comboBox.SelectedIndex = comboBox.FindString(iniFile.ReadValue("GRAPHICS", "TEXTURE_MAX_LOAD"), -1);

                    if (comboBox.SelectedIndex == -1)
                        comboBox.SelectedIndex = 0;
                }
            }
        }
示例#34
0
        /// <summary>
        /// Sets the radius drop down selected item to the one that is set in fsx.cfg
        /// </summary>
        public void SelectCurrentRadius(ComboBox comboBox, [Optional]string radius)
        {
            // Method variables
            string formattedRadius;

            using (IniFile iniFile = new IniFile())
            {
                /// <switch>fsx.cfg</switch>
                iniFile.IniPath = Application.StartupPath + @"\locations.ini";
                iniFile.IniPath = iniFile.ReadValue("LOCATIONS", "cfg") + @"\fsx.cfg";

                if (radius != null)
                {
                    // Format the radius
                    using (Format format = new Format())
                        formattedRadius = format.Compact(radius);

                    // Set the current selected item
                    comboBox.SelectedIndex = comboBox.FindString(formattedRadius, -1);

                    // Set the index to the first
                    if (comboBox.SelectedIndex == -1)
                        comboBox.SelectedIndex = 0;

                }
                else
                {
                    using (Format format = new Format())
                    {
                        // Set the radius to the current one in fsx.cfg
                        comboBox.SelectedIndex = comboBox.FindString(format.Compact(iniFile.ReadValue("TERRAIN", "LOD_RADIUS")), -1);

                        // Set the index to the first
                        if (comboBox.SelectedIndex == -1)
                            comboBox.SelectedIndex = 0;
                    }
                }
            }
        }
示例#35
0
 /// <include file='doc\WinBarComboBox.uex' path='docs/doc[@for="ToolStripComboBox.FindString1"]/*' />
 public int FindString(string s, int startIndex)
 {
     return(ComboBox.FindString(s, startIndex));
 }
示例#36
0
 private void cmbAPITypes_TextChanged(object sender, System.EventArgs e)
 {
     cmbAPITypes.SelectedIndex = cmbAPITypes.FindString(cmbAPITypes.Text);
 }
示例#37
0
		public void FindStringExact_StartIndex_ItemCount ()
		{
			Thread.CurrentThread.CurrentCulture = new CultureInfo ("tr-TR");

			ComboBox cmbbox = new ComboBox ();
			cmbbox.Items.AddRange (new object [] { "AB", "BA", "AB", "BA" });
#if NET_2_0
			Assert.AreEqual (1, cmbbox.FindStringExact ("BA", 3));
#else
			try {
				cmbbox.FindString ("BA", 3);
				Assert.Fail ("#1");
			} catch (ArgumentOutOfRangeException ex) {
				Assert.AreEqual (typeof (ArgumentOutOfRangeException), ex.GetType (), "#2");
				Assert.IsNull (ex.InnerException, "#3");
				Assert.IsNotNull (ex.Message, "#4");
				Assert.IsNotNull (ex.ParamName, "#5");
				Assert.AreEqual ("startIndex", ex.ParamName, "#6");
			}
#endif
		}
示例#38
0
 private String extractSexFromConnectorType( String type, ComboBox sexCombo )
 {
     String newType = type;
     if (newType != null)
     {
         if (newType.Contains( "Female" ))
             sexCombo.SelectedIndex = sexCombo.FindString( "Female" );
         else if (newType.Contains( "Male" ))
             sexCombo.SelectedIndex = sexCombo.FindString( "Male" );
         newType = newType.Replace( "Female", "" );
         newType = newType.Replace( "Male", "" );
         newType = newType.Trim();
     }
     return newType;
 }
示例#39
0
        /// <summary>
        /// 窗体载入
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void ModiUserAttribute_Load(object sender, System.EventArgs e)
        {
            IntiFontLib();

            if (int.Parse(m_ClientEvent.GetInfo("SysAdminValue").ToString()) == 0)
            {
                chkDeptAdmin.Visible   = false;
                chkSystmeAdmin.Visible = false;
            }
            if (int.Parse(m_ClientEvent.GetInfo("SysAdminValue").ToString()) == 2)
            {
                chkSystmeAdmin.Visible = false;
                chkDeptAdmin.Visible   = false;
            }

            this.txtUser.Text = msgUserAttribute[1].oContent.ToString();
            int isAdmin = int.Parse(msgUserAttribute[7].oContent.ToString());

            if (isAdmin == 1)
            {
                chkSystmeAdmin.Checked = true;
            }
            else if (isAdmin == 2)
            {
                chkDeptAdmin.Checked = true;
            }
            else
            {
                chkSystmeAdmin.Checked = false;
            }

            if (int.Parse(msgUserAttribute[6].oContent.ToString()) == 1)
            {
                this.chkGMOnLine.Checked = true;
            }

            int dateYear = Convert.ToDateTime(msgUserAttribute[2].oContent).Year;

            int dateMonth = Convert.ToDateTime(msgUserAttribute[2].oContent).Month;
            int dateDay   = Convert.ToDateTime(msgUserAttribute[2].oContent).Day;

            this.dateTimePicker1.Value = this.dateTimePicker1.Value = new System.DateTime(dateYear, dateMonth, dateDay);

            this.txtRealName.Text = msgUserAttribute[4].oContent.ToString();

            if (int.Parse(msgUserAttribute[3].oContent.ToString()) == 0)
            {
                this.userStatus.Checked = true;
            }

            #region 部门列表相关信息
            departmentMsg = m_ClientEvent.RequestResult(C_Global.CEnum.ServiceKey.DEPART_QUERY, C_Global.CEnum.Msg_Category.USER_ADMIN, null);

            if (departmentMsg[0, 0].eName == C_Global.CEnum.TagName.ERROR_Msg)
            {
                MessageBox.Show(departmentMsg[0, 0].oContent.ToString());
                return;
            }

            string departName = null;            //部门名称

            for (int i = 0; i < departmentMsg.GetLength(0); i++)
            {
                department.Items.Add(departmentMsg[i, 1].oContent.ToString().Trim());
                if (int.Parse(msgUserAttribute[5].oContent.ToString()) == int.Parse(departmentMsg[i, 0].oContent.ToString()))
                {
                    departName = departmentMsg[i, 1].oContent.ToString().Trim();
                }
            }
            //标记选中部门
            int index = department.FindString(departName);
            this.department.SelectedIndex = index;

            /*
             * 使用情况:权限模块
             * 分析:登陆帐号为部门级管理者时只能为其本部门添加帐号,所以部门应限定死,不可选择
             */
            if (int.Parse(m_ClientEvent.GetInfo("SysAdminValue").ToString()) == 2)
            {
                department.Enabled = false;
            }
            #endregion
        }
示例#40
0
        public static bool UpdateDialog(EcasObjectType objType, ComboBox cmbTypes,
			DataGridView dgvParams, IEcasObject o, bool bGuiToInternal, bool bDxTypeInfo)
        {
            bool bResult = true;

            try
            {
                if(bGuiToInternal)
                {
                    IEcasParameterized eTypeInfo = null;

                    if(bDxTypeInfo)
                    {
                        string strSel = (cmbTypes.SelectedItem as string);
                        if(!string.IsNullOrEmpty(strSel))
                        {
                            if(objType == EcasObjectType.Event)
                            {
                                eTypeInfo = Program.EcasPool.FindEvent(strSel);
                                o.Type = eTypeInfo.Type;
                            }
                            else if(objType == EcasObjectType.Condition)
                            {
                                eTypeInfo = Program.EcasPool.FindCondition(strSel);
                                o.Type = eTypeInfo.Type;
                            }
                            else if(objType == EcasObjectType.Action)
                            {
                                eTypeInfo = Program.EcasPool.FindAction(strSel);
                                o.Type = eTypeInfo.Type;
                            }
                            else { Debug.Assert(false); }
                        }
                    }

                    EcasUtil.DataGridViewToParameters(dgvParams, o, eTypeInfo);
                }
                else // Internal to GUI
                {
                    if(bDxTypeInfo)
                    {
                        if(o.Type.EqualsValue(PwUuid.Zero))
                            cmbTypes.SelectedIndex = 0;
                        else
                        {
                            int i = -1;
                            if(objType == EcasObjectType.Event)
                                i = cmbTypes.FindString(Program.EcasPool.FindEvent(o.Type).Name);
                            else if(objType == EcasObjectType.Condition)
                                i = cmbTypes.FindString(Program.EcasPool.FindCondition(o.Type).Name);
                            else if(objType == EcasObjectType.Action)
                                i = cmbTypes.FindString(Program.EcasPool.FindAction(o.Type).Name);
                            else { Debug.Assert(false); }

                            if(i >= 0) cmbTypes.SelectedIndex = i;
                            else { Debug.Assert(false); }
                        }
                    }

                    IEcasParameterized t = null;
                    if(objType == EcasObjectType.Event)
                        t = Program.EcasPool.FindEvent(cmbTypes.SelectedItem as string);
                    else if(objType == EcasObjectType.Condition)
                        t = Program.EcasPool.FindCondition(cmbTypes.SelectedItem as string);
                    else if(objType == EcasObjectType.Action)
                        t = Program.EcasPool.FindAction(cmbTypes.SelectedItem as string);
                    else { Debug.Assert(false); }

                    if(t != null) EcasUtil.ParametersToDataGridView(dgvParams, t, o);
                }
            }
            catch(Exception e) { MessageService.ShowWarning(e); bResult = false; }

            return bResult;
        }
 private static void UpdateSelection(ComboBox cb, string s)
 {
     var i = cb.FindString(s);
     if (i != -1)
     {
         cb.SelectedText = "";
         cb.SelectedIndex = i;
         cb.SelectionStart = s.Length;
         cb.SelectionLength = cb.Text.Length;
     }
 }
示例#42
0
 /// <include file='doc\WinBarComboBox.uex' path='docs/doc[@for="ToolStripComboBox.FindString"]/*' />
 public int FindString(string s)
 {
     return(ComboBox.FindString(s));
 }
示例#43
0
		public void FindString_StartIndex_ItemCount ()
		{
			Thread.CurrentThread.CurrentCulture = new CultureInfo ("tr-TR");

			ComboBox cmbbox = new ComboBox ();
			cmbbox.Items.AddRange (new object [] { "BA", "BB" });
			Assert.AreEqual (0, cmbbox.FindString ("b", 1));
		}
 /// <summary>
 /// Autocomplete a combobox on keypress
 /// </summary>
 /// <param name="comboBox"></param>
 /// <param name="e"></param>
 public static void AutoCompleteOnKeyPress(ComboBox comboBox, KeyPressEventArgs e)
 {
     if (Char.IsControl(e.KeyChar))
         return;
     string stringToFind = comboBox.Text.Substring(0, comboBox.SelectionStart) + e.KeyChar;
     int index = comboBox.FindStringExact(stringToFind);
     if (index == -1)
         index = comboBox.FindString(stringToFind);
     if (index == -1)
         return;
     comboBox.SelectedIndex = index;
     comboBox.SelectionStart = stringToFind.Length;
     comboBox.SelectionLength = comboBox.Text.Length - comboBox.SelectionStart;
     e.Handled = true;
 }
示例#45
0
        private void cboPuesto_TextChanged(object sender, System.EventArgs e)
        {
            string Calle = cboPuesto.Text;

            cboPuesto.SelectedIndex = cboPuesto.FindString(Calle);
        }