예제 #1
0
        }//end FormEncodings_Load

		private void m_btnOK_Click(object sender, EventArgs e)
		{
			foreach ( ListViewItem itm in m_listEncodings.Items )
			{
                EncodingItemData i = itm.Tag as EncodingItemData;
				i.ShowInMenu = itm.Checked;
			}//end foreach
		}
예제 #2
0
        }        //end CreateEncodingsMenuItems

        private static void MenuItem_Encoding_Click(object sender, EventArgs e)
        {
            ToolStripMenuItem itm = (ToolStripMenuItem)sender;
            EncodingItemData  i   = itm.Tag as EncodingItemData;

            System.Diagnostics.Trace.WriteLine("MenuItem_Encoding_Click: " + itm.Text);

            SetText(Convert(GetText(), i.Enc));
        }        //end MenuItem_Encoding_Click
예제 #3
0
        public static int CreateEncodingsMenuItems(ToolStripItemCollection root,
                                                   Func <string> getText, Action <string> setText,
                                                   List <EncodingItemData> encodingsList)
        {
            GetText = getText;
            SetText = setText;
            //m_RichTextBoxSrc = richSrc;
            //m_RichTextBoxDst = richDst;

            ArrayList vEncodingMenus = new ArrayList();

            for (int i = 0; i < encodingsList.Count; i++)
            {
                EncodingItemData itm = encodingsList[i];
                if (!itm.ShowInMenu)
                {
                    continue;
                }

                ToolStripItem x = new ToolStripMenuItem(itm.EncodingName);
                x.Tag    = itm;
                x.Click += MenuItem_Encoding_Click;

                vEncodingMenus.Add(x);
            }            //end for

            //leave first 2 items
            while (root.Count > 2)
            {
                root.RemoveAt(root.Count - 1);
            }

            if (vEncodingMenus.Count == 0)
            {
                return(0);
            }

            root.AddRange((ToolStripItem[])vEncodingMenus.ToArray(typeof(ToolStripItem)));

            return(root.Count);
        }        //end CreateEncodingsMenuItems