PatternRecogControlLib.PatternRecogControl pp = null; public Pattern() { InitializeComponent(); pp = new PatternRecogControlLib.PatternRecogControl(); } private MicrocosmicCCDInterface microcosmicCCDInterface; private void Pattern_Load(object sender, EventArgs e) { this.Controls.Add(pp); pp.Dock = DockStyle.Fill; pp.RefreshImageHandle += pp_RefreshImageHandle; DateTime dt = DateTime.Now; string pName = "pattern" + dt.ToString("yyyyMMddHHmmssfff"); pp.SetPatternName(pName); new Common.IniFile(PublicVariable.ConfigPath + "SystemConfig.ini").IniWriteValue("SystemConfig", "PatternName", pName); } Bitmap pp_RefreshImageHandle() { microcosmicCCDInterface = MicrocosmicCCD.GetInstance(); Bitmap bm = new Bitmap(microcosmicCCDInterface.OutPutImage()); return bm; }
首先,将要调用的控件dll放到目录下,项目里调用该dll;
如代码中所示,PatternRecogControlLib是dll的名称,PatternRecogControl是dll中控件的名称;