private void SetupTools(VoucherForm form) { var item0 = lstColors.Buttons.FirstOrDefault((i) => ((Color)i.Tag == form.Canvas.BackColor)); if (item0 != null) { ShowBackColor(((RibbonButton)item0).SmallImage); } // var item1 = lstColors.Buttons.FirstOrDefault((i) => ((Color)i.Tag == form.Canvas.ForeColor)); if (item1 != null) { ShowForeColor(((RibbonButton)item1).SmallImage); } // ShowFontSize(m_ActiveChild.Canvas.Font.Size.ToString()); ShowFontName(m_ActiveChild.Canvas.Font.Name); // var item2 = btnLineSize.DropDownItems.FirstOrDefault((i) => i.Tag.Cast <int>() == form.Canvas.LineSize); if (item2 != null) { ShowLineSize(((RibbonButton)item2).SmallImage); } }
public VoucherForm AddNewChild() { VoucherForm form = new VoucherForm(); form.MdiParent = this; form.Show(); return(form); }
protected override void WndProc(ref Message m) { switch (m.Msg) { case user32.WM_COPYDATA: { //The scaning Form sends ready status //Get image from appslot IntPtr sender; string text = WinMsg.ReceiveText(m.LParam, out sender); if (!string.IsNullOrEmpty(text)) { if (text.StartsWith(Strings.VScan_EditItem)) { new MethodInvoker(() => { const int MAX_OPENED_FORMS = 5; int openedForms = ScanAppContext.Default.OpenFormsOf <VoucherForm>().Count(); int settings = SettingsTable.Get <int>(Strings.VScan_MaximumOpenedScanForms, MAX_OPENED_FORMS); if (openedForms > settings) { WinMsg.SendText(sender, Strings.VScan_StopTheScanner); throw new AppExclamationException("Too many opened windows in editor.\nStop scanning."); } }).FireAndForget(); var data = DataSlot.Get <Voucher>(text); Debug.Assert(data != null && data.VoucherImage != null && !string.IsNullOrEmpty(data.Message), "MainForm.WndProc"); try { VoucherForm form = AddNewChild(); form.Canvas.Update(data); } finally { if (VoucherMonitorForm.IsStarted) { VoucherMonitorForm.ShowImage(text); } DataSlot.Free(text); } } else if (text.StartsWith(Strings.VScan_ItemSaved)) { string[] msgs = text.Split('|'); if (msgs.Length > 1) { tssLabel1.Text = msgs[0]; tssLabel2.Text = msgs[1]; } if (VoucherMonitorForm.IsStarted) { VoucherMonitorForm.ShowImage(text); } DataSlot.Free(text); } else if (text.CompareNoCase(Strings.VScan_ScanIsDoneEvent)) { WaitForm.Stop(this); } else if (string.Compare(text, Strings.Transferring_RemoteLock) == 0) { Lock(); } } } break; default: base.WndProc(ref m); break; } }