private void panel_DragDrop(object sender, DragEventArgs e) { e.Effect = DragDropEffects.Copy; ChangeListItemBhikku lbl = (ChangeListItemBhikku)e.Data.GetData(typeof(ChangeListItemBhikku)); DoDragnDrop(lbl); this.BringToFront(); this.minimizedAsapuwa.MinimizedAsapuwa_DragLeave(sender, e); }
public void DoDragnDrop(ChangeListItemBhikku lbl) { if (lbl.ParentLbl == null) { AddBhikku(lbl); } else { lbl.ParentLbl.Reset(); AddBhikku(lbl.ParentLbl); } }
// drow print document private void printDocument1_PrintPage(object sender, System.Drawing.Printing.PrintPageEventArgs e) { if (bhikkuList.Count == 0) { return; } //e.Graphics.PageUnit = GraphicsUnit.Display; int imgeWidthHeight = bhikkuList[0].imagePicbox.Height; int y = 80; int labelX = 150 + (printImage ? imgeWidthHeight : -30); // add heading and date for first page only if (printIndex == 0) { y = 215; //Font fB = new Font("Iskoola Pota", 120, FontStyle.Bold); TextRenderer.DrawText(e.Graphics, "නමෝ බුද්ධාය !", new Font("Iskoola Pota", 20 * 6, FontStyle.Regular), new Rectangle(480, 60 * 6, 4000, 200), SystemColors.ControlText, TextFormatFlags.HorizontalCenter); TextRenderer.DrawText(e.Graphics, "පින්වත් ස්වාමීන් වහන්සේලාගේ අසපු මාරුවීමේ නාම ලේඛනය", new Font("Iskoola Pota", 15 * 6, FontStyle.Bold), new Rectangle(480, 100 * 6, 4000, 200), SystemColors.ControlText, TextFormatFlags.HorizontalCenter); TextRenderer.DrawText(e.Graphics, fromToString, new Font("Iskoola Pota", 13 * 6), new Rectangle(480, 130 * 6, 4000, 200), SystemColors.ControlText, TextFormatFlags.HorizontalCenter); e.Graphics.DrawLine(new Pen(Brushes.DarkGray, 2), new Point(10, 158), new Point(e.PageBounds.Width - 10, 158)); TextRenderer.DrawText(e.Graphics, this.asapuwaName, new Font("Iskoola Pota", 16 * 6, FontStyle.Bold), new Rectangle(480, 165 * 6, 4000, 200), SystemColors.ControlText, TextFormatFlags.Left); // e.Graphics.DrawString(this.asapuwaName+" a", new Font("Iskoola Pota", 18, FontStyle.Bold), Brushes.Black, 100, 80); //e.Graphics.DrawString(fromToString, new Font("Iskoola Pota", 12), Brushes.Black, 100, 120); } int labelY = y; // +imgeWidthHeight / 2; if (printImage) { labelY = y - 16 + imgeWidthHeight / 2; } // print footer TextRenderer.DrawText(e.Graphics, string.Concat(this.asapuwaName, " (", fromToString, ")"), new Font("Iskoola Pota", 9 * 6, FontStyle.Bold), new Rectangle(10 * 6, (e.PageBounds.Height - 50) * 6, 8000, 200), SystemColors.ControlText, TextFormatFlags.Left); while (printIndex < bhikkuList.Count) { // page breaker if (y > e.MarginBounds.Height + 65) { y = 100; e.HasMorePages = true; return; } ChangeListItemBhikku bhikku = bhikkuList[printIndex++]; e.Graphics.DrawString(printIndex + ".", new Font("Iskoola Pota", 16), Brushes.Black, 80, labelY); if (printImage && bhikku.imagePicbox.Image != null) { e.Graphics.DrawImageUnscaled(bhikku.imagePicbox.Image, new Point(130, y)); } string postrString = MahamewnawaInfo.Common.Utility.GetPostString(bhikku.bInfo.Post); if (!string.IsNullOrEmpty(postrString)) { postrString = string.Concat("(", MahamewnawaInfo.Common.Utility.GetPostString(bhikku.bInfo.Post), ")"); } // e.Graphics.DrawString(bhikku.bInfo.NameAssumedAtRobing, new Font("Iskoola Pota", 16), Brushes.Black, labelX, labelY); TextRenderer.DrawText(e.Graphics, bhikku.bInfo.NameAssumedAtRobing + (printImage ? "" : " " + postrString), new Font("Iskoola Pota", 16 * 6), new Rectangle(labelX * 6, labelY * 6, 5000, 200), SystemColors.ControlText, TextFormatFlags.Left); // add post if (printImage) { //e.Graphics.DrawString(MahamewnawaInfo.Common.Utility.GetPostStringLong(bhikku.bInfo.Post), new Font("Iskoola Pota", 12), Brushes.Black, labelX, labelY + 25); TextRenderer.DrawText(e.Graphics, MahamewnawaInfo.Common.Utility.GetPostStringLong(bhikku.bInfo.Post), new Font("Iskoola Pota", 9 * 6), new Rectangle(labelX * 6, (labelY + 25) * 6, 5000, 200), SystemColors.ControlText, TextFormatFlags.Left); } if (printImage) { y += imgeWidthHeight + 5; labelY = y - 16 + imgeWidthHeight / 2; } else { y += 30; labelY = y; } } printIndex = 0; }
public void RemoveBhikkuList(ChangeListItemBhikku bhikku) { bhikkuList.Remove(bhikku); updateBhikkuCountLabel(-1, bhikku.bInfo.BhikkuType); }
private void AddBhikkuList(ChangeListItemBhikku bhikku) { bhikkuList.Add(bhikku); updateBhikkuCountLabel(1, bhikku.bInfo.BhikkuType); }
public void AddBhikku(ChangeListItemBhikku lbl) { AddBhikkuList(lbl); PrepareNamelist(); lbl.DoDrag(this); }