public void SetViewImage(IImage img, GDMFileReferenceWithTitle fileRef) { var imageCtl = new GKUI.Components.ImageView(); imageCtl.OpenImage(img); fController.ProcessPortraits(imageCtl, fileRef); SetViewControl(imageCtl); }
public void SetViewImage(IImage img, GEDCOMFileReferenceWithTitle fileRef) { var imageCtl = new GKUI.Components.ImageView(); imageCtl.OpenImage(img); fController.ProcessPortraits(imageCtl, fileRef); fTimer = AppHost.Instance.CreateTimer(100.0f, InitViewer_Tick); fTimer.Start(); SetViewControl(imageCtl); }
private void InitializeComponent() { SuspendLayout(); btnAccept = new Button(); btnAccept.ImagePosition = ButtonImagePosition.Left; btnAccept.Size = new Size(130, 26); btnAccept.Text = "btnAccept"; btnAccept.Click += btnAccept_Click; btnAccept.Image = Bitmap.FromResource("Resources.btn_accept.gif"); btnCancel = new Button(); btnCancel.ImagePosition = ButtonImagePosition.Left; btnCancel.Size = new Size(130, 26); btnCancel.Text = "btnCancel"; btnCancel.Click += CancelClickHandler; btnCancel.Image = Bitmap.FromResource("Resources.btn_cancel.gif"); imageView1 = new GKUI.Components.ImageView(); imageView1.SelectionMode = ImageBoxSelectionMode.Rectangle; imageView1.ShowToolbar = true; imageView1.Size = new Size(800, 600); Content = new DefTableLayout { Rows = { new TableRow { ScaleHeight = true, Cells = { imageView1 } }, UIHelper.MakeDialogFooter(null, btnAccept, btnCancel) } }; DefaultButton = btnAccept; AbortButton = btnCancel; Title = "PortraitSelectDlg"; SetPredefProperties(870, 680); ResumeLayout(); }
private void ProcessPortraits(GKUI.Components.ImageView imageCtl, GEDCOMFileReferenceWithTitle fileRef) { var mmRec = fileRef.Parent as GEDCOMMultimediaRecord; var linksList = new List <GEDCOMObject>(); GKUtils.SearchRecordLinks(linksList, mmRec.Owner, mmRec); foreach (var link in linksList) { var mmLink = link as GEDCOMMultimediaLink; if (mmLink != null && mmLink.IsPrimary) { var indiRec = mmLink.Parent as GEDCOMIndividualRecord; string indiName = GKUtils.GetNameString(indiRec, true, false); var region = UIHelper.Rt2Rt(mmLink.CutoutPosition.Value); imageCtl.NamedRegions.Add(new NamedRegion(indiName, region)); } } imageCtl.ShowNamedRegionTips = (imageCtl.NamedRegions.Count > 0); }