Added methods to use common dictionary of fonts part of B2017-117 Out of Window Handles fix
Use method from VE_Font to get a font reference (uses dictionary so redundant Window Handles are not created) B2017-117 Add a Using statement when we temporarily create a RichTextBox to ensure the Window Handle is free’d. Also use method from VE_Font to get a font reference (uses dictionary so redundant Window Handles are not created) B2017-117
This commit is contained in:
@@ -1468,26 +1468,33 @@ namespace Volian.Controls.Library
|
||||
try // RHM20150506 Multiline ItemID TextBox
|
||||
{
|
||||
IDataObject iData = Clipboard.GetDataObject();
|
||||
DataFormats.Format frm = DataFormats.GetFormat("Embed Source");
|
||||
System.Windows.Forms.RichTextBox richTextBox1;
|
||||
richTextBox1 = new System.Windows.Forms.RichTextBox();
|
||||
richTextBox1.Location = new System.Drawing.Point(35, 32);
|
||||
richTextBox1.Name = "richTextBox1";
|
||||
richTextBox1.Size = new System.Drawing.Size(67, 58);
|
||||
richTextBox1.TabIndex = 0;
|
||||
richTextBox1.Text = "";
|
||||
richTextBox1.ScrollBars = System.Windows.Forms.RichTextBoxScrollBars.None;
|
||||
bool noEquationData = true;
|
||||
try
|
||||
// part of bug B2017-117 we were running out of window handles when printing, found this similar use of
|
||||
// creating a new richtextbox just for some processing. Put a Using around this to ensure the window handle
|
||||
// is free'd
|
||||
using (System.Windows.Forms.RichTextBox richTextBox1 = new System.Windows.Forms.RichTextBox())
|
||||
{
|
||||
richTextBox1.Paste(frm);
|
||||
if (richTextBox1.Rtf.ToUpper().Contains("OBJCLASS EQU")) noEquationData = false;
|
||||
if (richTextBox1.Rtf.ToUpper().Contains("OBJCLASS VIS")) noEquationData = false;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
noEquationData = false;
|
||||
}
|
||||
DataFormats.Format frm = DataFormats.GetFormat("Embed Source");
|
||||
//System.Windows.Forms.RichTextBox richTextBox1;
|
||||
//richTextBox1 = new System.Windows.Forms.RichTextBox();
|
||||
richTextBox1.Location = new System.Drawing.Point(35, 32);
|
||||
richTextBox1.Name = "richTextBox1";
|
||||
richTextBox1.Size = new System.Drawing.Size(67, 58);
|
||||
richTextBox1.TabIndex = 0;
|
||||
richTextBox1.Text = "";
|
||||
richTextBox1.ScrollBars = System.Windows.Forms.RichTextBoxScrollBars.None;
|
||||
//bool noEquationData = true;
|
||||
try
|
||||
{
|
||||
richTextBox1.Paste(frm);
|
||||
if (richTextBox1.Rtf.ToUpper().Contains("OBJCLASS EQU")) noEquationData = false;
|
||||
if (richTextBox1.Rtf.ToUpper().Contains("OBJCLASS VIS")) noEquationData = false;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
noEquationData = false;
|
||||
}
|
||||
} // end using
|
||||
//btnEdit3CMPaste.Enabled = btnPasteText.Enabled = btnCMPasteText.Enabled = btnCMPaste.Enabled = btnPaste.Enabled = (iData.GetDataPresent(DataFormats.Text) || iData.GetDataPresent(DataFormats.Rtf));
|
||||
//btnPasteText.Enabled = btnPasteStepText.Enabled = btnPaste.Enabled = (iData.GetDataPresent(DataFormats.Text) || iData.GetDataPresent(DataFormats.Rtf));
|
||||
btnPaste.Enabled = noEquationData && (iData.GetDataPresent(DataFormats.Text) || iData.GetDataPresent(DataFormats.Rtf));
|
||||
|
Reference in New Issue
Block a user