// NOTE: That says "po-Op-Source", but if you want to look at it as "poOp-Source", well, that's up to you, // and try not laugh yourself silly public void AddCustomOperator(string psCustomOpName, WonkaBreSource poOpSource = null) { if (BasicOps.Contains(psCustomOpName)) { throw new Exception("ERROR! Provided operator is already a basic operator within the rules engine."); } if (ArithmeticLimitOps.Contains(psCustomOpName)) { throw new Exception("ERROR! Provided operator is already a arithmetic limit operator within the rules engine."); } if (DateLimitOps.Contains(psCustomOpName)) { throw new Exception("ERROR! Provided operator is already a date limit operator within the rules engine."); } if (poOpSource != null) { CustomOpSources[psCustomOpName] = poOpSource; } else { CustomOpSources[psCustomOpName] = new WonkaBreSource("", "", "", "", "", "", "", null); } }
private void pnlBackgroundImg_Paint(object sender, PaintEventArgs e) { if (m_bmpBackgroundImage != null) { //Create a temporary bitmap Bitmap bmpTemp = new Bitmap(pnlBackgroundImg.Width, pnlBackgroundImg.Height); Graphics gfx = Graphics.FromImage(bmpTemp); gfx.FillRectangle(Brushes.Transparent, new Rectangle(0, 0, bmpTemp.Width, bmpTemp.Height)); //Get scaled size for thumbnail Bitmap bmpResized = new Bitmap(m_bmpBackgroundImage, BasicOps.MaintainAspectRatio_DontExcedeNewSize(bmpTemp.Size, m_bmpBackgroundImage.Size)); //Get Offest for thumbnail Point pntOffset = new Point((pnlBackgroundImg.Size.Width - bmpTemp.Size.Width) / 2, (pnlBackgroundImg.Size.Height - bmpTemp.Size.Height) / 2); //Render e.Graphics.DrawImage(bmpResized, pntOffset); } else { Graphics gfx = e.Graphics; Font fnt = new Font("Arial", 8); gfx.DrawString("Drag\nbackground\nhere", fnt, Brushes.Black, 0, 0); } }