/// <summary> /// 不在构造函数里面初始化,是因为有时候要求初始化的时间可控。 /// </summary> public void Init() { //已经初始化过了则没必要再重复 if (m_dbOP != null || m_connString == null || m_connString == "") { return; } m_dbOP = new ObjectOperator(m_connString); }
private void btnBatchPrint_Click(object sender, EventArgs e) { if (!string.IsNullOrWhiteSpace(tbBarCodeWidth.Text)) { barCodeWidth = int.Parse(tbBarCodeWidth.Text); } if (!string.IsNullOrWhiteSpace(tbBarcodeHeight.Text)) { barCodeHeight = int.Parse(tbBarcodeHeight.Text); } if (!string.IsNullOrWhiteSpace(tbBarCodeSpacing.Text)) { barCodeSpacing = int.Parse(tbBarCodeSpacing.Text); } if (!string.IsNullOrWhiteSpace(tbFontSize.Text)) { fontSize = int.Parse(tbFontSize.Text); } barCodeImages.Clear(); printCounter = 0; if (lbBarCodes.Items.Count > 0) { foreach (string s in lbBarCodes.Items) { barCodeImages.Add(ObjectOperator.CreateBarCode(s, barCodeWidth, barCodeHeight, true)); } //PrintDocument batchPrintDocument = new PrintDocument(); try { batchPrintDocument.PrinterSettings.PrinterName = cbPrinters.SelectedItem.ToString(); //PageSetupDialog pageSetupDialog = new PageSetupDialog(); //pageSetupDialog.Document = batchPrintDocument; //if (DialogResult.OK == pageSetupDialog.ShowDialog()) //{ //batchPrintDocument.PrintPage += BatchPrint; PrintPreviewDialog ppd = new PrintPreviewDialog(); ppd.Document = batchPrintDocument; ppd.ShowDialog(); //} } catch (Exception ePrint) { MessageBox.Show($"打印失败:\r\n{ePrint})", "打印失败", MessageBoxButtons.OK, MessageBoxIcon.Error); } //finally //{ batchPrintDocument.Dispose(); } } else { MessageBox.Show("无可打印数据"); } }
private void btnGenerate_Click(object sender, EventArgs e) { string codeString = tbCodeString.Text; if (!string.IsNullOrWhiteSpace(codeString)) { Bitmap barCodeImage = ObjectOperator.CreateBarCode(codeString, 300, 100); pictureBoxBarCode.Image = barCodeImage; } }
void SpawnObjects() { ObjectOperator prefab = objectPrefabs[Random.Range(0, objectPrefabs.Length)]; ObjectOperator spawn = prefab.GetPooledInstance <ObjectOperator>(); spawn.GetComponent <MeshRenderer>().material = objectMaterial; spawn.transform.localPosition = transform.position; spawn.transform.localScale = new Vector3(1, 1, 1) * scale.RandomInRange; spawn.transform.localRotation = Random.rotation; spawn.Body.velocity = transform.up * velocity + Random.onUnitSphere * randomVelocity.RandomInRange; spawn.Body.angularVelocity = Random.onUnitSphere * angularVelocity.RandomInRange; }
protected CDBOperator( ) { m_connString = ""; m_dbOP = null;// new CDBOperator(m) }