public Printout(RoomBookings caller) { callingForm = caller; InitializeComponent(); this.Width = 1280; this.Height = 720; xPixelDiv = dx((int)virtScaleX / (numDivisions + 4)); yPixelDiv = dy((int)virtScaleY / 7); initTimeTable(); bookingList.Clear(); foreach (booking l in RoomBookings.bookingList) { if (l.rect.Parent != null) { TextRectangle t = new TextRectangle(timeTable); t.Width = dx((int)((float)xPixelDiv * (l.endTime - l.startTime)) * 4); t.Height = dy(yPixelDiv); t.Top = py((int)(yPixelDiv * ((float)l.row + 1f))); t.Left = px((int)((l.startTime - 8.75f) * ((float)xPixelDiv * 4f))); t.Text = l.rect.Text; t.FillColor = Color.AliceBlue; t.CornerRadius = 5; t.FillStyle = FillStyle.Solid; //t.drawFont = new Font("Arial", 10); t.BringToFront(); bookingList.Add(t); } } int x = 15; int y = this.Height - 105; foreach (Button b in this.Controls.OfType <Button>()) { b.Height = 25; b.Width = 75; b.Left = x; b.Top = y + 30; x += 75; } //btnPrint.Width = 75; //btnPrint.Height = 25; //btnPrint.Left = (this.Width - btnPrint.Width) / 2; //btnPrint.Top = this.ClientSize.Height - 40; //pageSD.Document = printDoc; //pageSD.AllowPrinter = true; //pageSD.EnableMetric = true; //pageSD.PageSettings = new PageSettings(); //pageSD.PrinterSettings = new PrinterSettings(); printDoc.DefaultPageSettings.Landscape = true; printDoc.DefaultPageSettings.Margins.Left = 30; printDoc.DefaultPageSettings.Margins.Right = 30; printDoc.DefaultPageSettings.Margins.Top = 30; printDoc.DefaultPageSettings.Margins.Bottom = 30; }
private void selectRectangle(object sender, EventArgs e) { selected = id; RoomBookings f = (RoomBookings)rect.FindForm(); f.formclicked(sender, e); }