private void ReadLinkType() { try { StringBuilder str_tmp = new StringBuilder(); string iniFilePath = GlobalVar.gl_strTargetPath + "\\" + GlobalVar.gl_iniTBS_FileName; myfunction.CheckFileExit(); MyFunctions.GetPrivateProfileString(GlobalVar.gl_inisection_Global, GlobalVar.gl_iniKey_LinkType, "", str_tmp, 50, iniFilePath); GlobalVar.gl_Link = str_tmp.ToString().Trim(); if (GlobalVar.gl_Link == "BARCODE關聯") { GlobalVar.gl_LinkType = LinkType.BARCODE; } else if (GlobalVar.gl_Link == "PROX關聯") { GlobalVar.gl_LinkType = LinkType.PROX; } else if (GlobalVar.gl_Link == "MIC關聯") { GlobalVar.gl_LinkType = LinkType.MIC; } else if (GlobalVar.gl_Link == "IC關聯")//增加IC关联 [2018.1.10]-lqz { GlobalVar.gl_LinkType = LinkType.IC; } else { GlobalVar.gl_LinkType = LinkType.MIC; } } catch { } }
private void GetPorductTypeConfig(string strProductType) { string strProductTypeINI = Application.StartupPath + "\\" + GlobalVar.gl_ProductModel + "\\" + GlobalVar.gl_LinkType + "\\" + GlobalVar.gl_iniExposure_FileName; //strProductTypeINI = Application.StartupPath + "\\" + GlobalVar.gl_ProductModel + "\\" + GlobalVar.gl_LinkType + "\\" + GlobalVar.gl_iniTBS_FileName;//将配置写入到同一文件下 StringBuilder str_tmp = new StringBuilder(100); MyFunctions.GetPrivateProfileString(strProductType.ToUpper(), GlobalVar.ini_key_MRedLight, "1", str_tmp, 100, strProductTypeINI); GlobalVar.gl_Model_redLight = Convert.ToInt32(str_tmp.ToString()); MyFunctions.GetPrivateProfileString(strProductType, GlobalVar.ini_key_MWhiteLight, "1", str_tmp, 100, strProductTypeINI); GlobalVar.gl_Model_whiteLight = Convert.ToInt32(str_tmp.ToString()); MyFunctions.GetPrivateProfileString(strProductType, GlobalVar.ini_key_MExposure, "5000", str_tmp, 100, strProductTypeINI); GlobalVar.gl_Model_exposure = Convert.ToInt32(str_tmp.ToString()); addLogStr("光源參數更改:部品:" + strProductType + "紅光:" + GlobalVar.gl_Model_redLight + "白光:" + GlobalVar.gl_Model_whiteLight + "曝光值:" + GlobalVar.gl_Model_exposure); }
private void ReadSettingConfig() { StringBuilder str_tmp = new StringBuilder(50); string iniFilePath = Application.StartupPath + "\\" + GlobalVar.gl_ProductModel + "\\" + GlobalVar.gl_LinkType + "\\" + GlobalVar.gl_iniTBS_FileName; try { MyFunctions.GetPrivateProfileString(GlobalVar.gl_iniSection_cam, GlobalVar.gl_inikey_Focus, "", str_tmp, 50, iniFilePath); m_value_Focus = (str_tmp.ToString().Trim() == "" ? 40 : Convert.ToInt32(str_tmp.ToString())); MyFunctions.GetPrivateProfileString(GlobalVar.gl_iniSection_cam, GlobalVar.gl_inikey_Pan, "", str_tmp, 50, iniFilePath); m_value_Pan = (str_tmp.ToString().Trim() == "" ? 0 : Convert.ToInt32(str_tmp.ToString())); MyFunctions.GetPrivateProfileString(GlobalVar.gl_iniSection_cam, GlobalVar.gl_inikey_Tilt, "", str_tmp, 50, iniFilePath); m_value_Tilt = (str_tmp.ToString().Trim() == "" ? 0 : Convert.ToInt32(str_tmp.ToString())); MyFunctions.GetPrivateProfileString(GlobalVar.gl_iniSection_cam, GlobalVar.gl_inikey_Zoom, "", str_tmp, 50, iniFilePath); m_value_Zoom = (str_tmp.ToString().Trim() == "" ? 0 : Convert.ToInt32(str_tmp.ToString())); MyFunctions.GetPrivateProfileString(GlobalVar.gl_iniSection_cam, GlobalVar.gl_inikey_Exposure, "", str_tmp, 50, iniFilePath); m_value_Exposure = (str_tmp.ToString().Trim() == "" ? 0 : Convert.ToInt32(str_tmp.ToString())); } catch { } }
public ChooseLineName() { InitializeComponent(); ChooseLineNameInit();//获取开放线别 DBQuery db = new DBQuery(); db.GetLineListInfo(); tableLayoutPanel1.Controls.OfType <RadioButton>();//只查找RadioButton控件 StringBuilder str_tmp = new StringBuilder(50); string iniFilePath = GlobalVar.gl_strTargetPath + "\\" + GlobalVar.gl_iniTBS_FileName; MyFunctions.GetPrivateProfileString(GlobalVar.gl_inisection_Global, GlobalVar.gl_inikey_Line, "", str_tmp, 50, iniFilePath); //读取产线 GlobalVar.gl_LineName = str_tmp.ToString().Trim(); foreach (RadioButton bt in tableLayoutPanel1.Controls.OfType <RadioButton>()) { bt.Anchor = AnchorStyles.None; bt.AutoSize = false; if (GlobalVar.gl_LineName != "NONET" && GlobalVar.gl_LineName != "") { switch (GlobalVar.gl_LineName.Substring(1, 1)) { case "1": if (bt.Name == "rdb_OLine" + GlobalVar.gl_LineName.Substring(GlobalVar.gl_LineName.Length - 1, 1)) { ((RadioButton)bt).Checked = true; } break; case "2": if (bt.Name == "rdb_SLine" + GlobalVar.gl_LineName.Substring(GlobalVar.gl_LineName.Length - 1, 1)) { ((RadioButton)bt).Checked = true; } break; case "3": if (bt.Name == "rdb_TLine" + GlobalVar.gl_LineName.Substring(GlobalVar.gl_LineName.Length - 1, 1)) { ((RadioButton)bt).Checked = true; } break; case "4": if (bt.Name == "rdb_FLine" + GlobalVar.gl_LineName.Substring(GlobalVar.gl_LineName.Length - 1, 1)) { ((RadioButton)bt).Checked = true; } break; default: break; } } //bt.CheckAlign = System.Drawing.ContentAlignment.TopRight; //bt.Size = new System.Drawing.Size(100, 50); //bt.Font = new Font("宋体", 9, FontStyle.Bold); } }