private void AddDataGroupInit(Type type, Template template, Template.TemplateData data, Action <Template.TemplateData> f) { this.type = type; this.template = template; callback = f; InitializeComponent(); if (type == Type.Info) { TextBlockNumberChoice.Text = ""; TextBoxNumberChoice.IsEnabled = false; TextBoxNumberChoice.Text = "10"; } else { TextBlockName.Text = "เริ่มข้อที่"; TextBoxName.Text = (data.Offset + data.Count + 1).ToString(); TextBoxName.IsEnabled = false; TextBlockNumberAns.Text = "จำนวนข้อ"; } preview = OMR.ImageDrawing.Draw(OMR.ImageDrawing.Mode.Circle, template.Image.Width, template.Image.Height, template.PointsList, System.Drawing.Color.Black, 2); ImagePreview.Source = System.Windows.Interop.Imaging.CreateBitmapSourceFromHBitmap( preview.GetHbitmap(), IntPtr.Zero, System.Windows.Int32Rect.Empty, BitmapSizeOptions.FromWidthAndHeight(preview.Width, preview.Height)); }
public AddDataGroup(Template template, Template.TemplateData data, Action <Template.TemplateData> f) { AddDataGroupInit(Type.Ans, template, data, f); }