void Parent_PCBIFormGraphicPaneDrawing(Graphics g, int ClientWidth, int ClientHeight) { if (!parent.JobIsLoaded) return; RectangleF BoardSize = parent.GetJobBounds(); if (BoardSize == RectangleF.Empty) return; Point locationBoard = parent.WorldToClient(BoardSize.Location); //Be careful with top and bottom because the display is vertical mirrored! Point rightTopBoard = parent.WorldToClient(new PointF(BoardSize.Right, BoardSize.Bottom)); #region draw down line g.DrawLine(Pens.Green, new Point(locationBoard.X, locationBoard.Y + 15), new Point(rightTopBoard.X, locationBoard.Y + 15)); g.DrawLine(Pens.Green, new Point(locationBoard.X, locationBoard.Y + 10), new Point(locationBoard.X, locationBoard.Y + 20)); g.DrawLine(Pens.Green, new Point(rightTopBoard.X, locationBoard.Y + 10), new Point(rightTopBoard.X, locationBoard.Y + 20)); #endregion #region draw right line g.DrawLine(Pens.Green, new Point(rightTopBoard.X + 15, locationBoard.Y), new Point(rightTopBoard.X + 15, rightTopBoard.Y)); g.DrawLine(Pens.Green, new Point(rightTopBoard.X + 10, locationBoard.Y), new Point(rightTopBoard.X + 20, locationBoard.Y)); g.DrawLine(Pens.Green, new Point(rightTopBoard.X + 10, rightTopBoard.Y), new Point(rightTopBoard.X + 20, rightTopBoard.Y)); #endregion //do translate for Strings string BoaurdSizeWidth = BoardSize.Width.ToString("N3"); string BoardSizeHeight = BoardSize.Height.ToString("N3"); string BoaurdSizeLU = BoardSize.X.ToString("N3") + " / " + BoardSize.Y.ToString("N3"); string BoardSizeRO = BoardSize.Right.ToString("N3") + " / " + BoardSize.Bottom.ToString("N3"); if (parent.GetUnit()) { float unit = 25.4f / 1000; BoaurdSizeWidth = (BoardSize.Width * unit).ToString("N3"); BoardSizeHeight = (BoardSize.Height * unit).ToString("N3"); BoaurdSizeLU = (BoardSize.X * unit).ToString("N3") + " / " + (BoardSize.Y * unit).ToString("N3"); BoardSizeRO = (BoardSize.Right * unit).ToString("N3") + " / " + (BoardSize.Bottom * unit).ToString("N3"); g.TranslateTransform(1, -1); g.DrawString(BoaurdSizeWidth + " mm", new Font("Arial", 10), Brushes.YellowGreen, new Point((int)((locationBoard.X + rightTopBoard.X) / 2.1), locationBoard.Y + 20)); g.DrawString(BoardSizeHeight + " mm", new Font("Arial", 10), Brushes.YellowGreen, new Point(rightTopBoard.X + 20, (int)((rightTopBoard.Y + locationBoard.Y) / 2) - 5)); g.DrawString(BoaurdSizeLU + " mm", new Font("Arial", 10), Brushes.AliceBlue, new Point((int)((locationBoard.X)), locationBoard.Y + 40)); g.DrawString(BoardSizeRO + " mm", new Font("Arial", 10), Brushes.AliceBlue, new Point(rightTopBoard.X + 20, (int)((rightTopBoard.Y)) - 5)); } else { g.TranslateTransform(1, -1); g.DrawString(BoaurdSizeWidth + " mils", new Font("Arial", 10), Brushes.YellowGreen, new Point((int)((locationBoard.X + rightTopBoard.X) / 2.1), locationBoard.Y + 20)); g.DrawString(BoardSizeHeight + " mils", new Font("Arial", 10), Brushes.YellowGreen, new Point(rightTopBoard.X + 20, (int)((rightTopBoard.Y + locationBoard.Y) / 2) - 5)); g.DrawString(BoaurdSizeLU + " mils", new Font("Arial", 10), Brushes.AliceBlue, new Point((int)((locationBoard.X)), locationBoard.Y + 40)); g.DrawString(BoardSizeRO + " mils", new Font("Arial", 10), Brushes.AliceBlue, new Point(rightTopBoard.X + 20, (int)((rightTopBoard.Y)) - 5)); } }
public void Execute(IPCBIWindow parent) { RectangleF boundsJob = parent.GetJobBounds(); if (boundsJob.IsEmpty) { IStep step = parent.GetCurrentStep(); if (step == null) { return; } boundsJob = step.GetBounds(); if (boundsJob.IsEmpty) { IMatrix matrix = parent.GetMatrix(); if (matrix == null) { return; } RectangleD boundsLayerCombination = new RectangleD(); //check signal layers foreach (string layerName in step.GetAllLayerNames()) { if (matrix.IsSignalLayer(layerName)) { IODBLayer odbLayer = (IODBLayer)step.GetLayer(layerName); RectangleF layerBounds = odbLayer.GetBounds(); boundsLayerCombination = IMath.AddRectangleD(boundsLayerCombination, new RectangleD(layerBounds)); } } boundsJob = boundsLayerCombination.ToRectangleF(); } } MessageBox.Show("The Job has following bounds in mils:" + Environment.NewLine + " X " + boundsJob.X.ToString() + " ; Y " + boundsJob.Y.ToString() + " ; width " + boundsJob.Width + " ; height " + boundsJob.Height, "Job Bounds", MessageBoxButtons.OK, MessageBoxIcon.Information); }