<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="ru">
		<id>http://nfex.ru/index.php?action=history&amp;feed=atom&amp;title=Csharp%2FCSharp_Tutorial%2FGUI_Windows_Forms%2FContextMenu_Popup_Menu</id>
		<title>Csharp/CSharp Tutorial/GUI Windows Forms/ContextMenu Popup Menu - История изменений</title>
		<link rel="self" type="application/atom+xml" href="http://nfex.ru/index.php?action=history&amp;feed=atom&amp;title=Csharp%2FCSharp_Tutorial%2FGUI_Windows_Forms%2FContextMenu_Popup_Menu"/>
		<link rel="alternate" type="text/html" href="http://nfex.ru/index.php?title=Csharp/CSharp_Tutorial/GUI_Windows_Forms/ContextMenu_Popup_Menu&amp;action=history"/>
		<updated>2026-04-30T02:31:41Z</updated>
		<subtitle>История изменений этой страницы в вики</subtitle>
		<generator>MediaWiki 1.30.0</generator>

	<entry>
		<id>http://nfex.ru/index.php?title=Csharp/CSharp_Tutorial/GUI_Windows_Forms/ContextMenu_Popup_Menu&amp;diff=5469&amp;oldid=prev</id>
		<title> в 15:31, 26 мая 2010</title>
		<link rel="alternate" type="text/html" href="http://nfex.ru/index.php?title=Csharp/CSharp_Tutorial/GUI_Windows_Forms/ContextMenu_Popup_Menu&amp;diff=5469&amp;oldid=prev"/>
				<updated>2010-05-26T15:31:53Z</updated>
		
		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;table class=&quot;diff diff-contentalign-left&quot; data-mw=&quot;interface&quot;&gt;
				&lt;tr style=&quot;vertical-align: top;&quot; lang=&quot;ru&quot;&gt;
				&lt;td colspan=&quot;1&quot; style=&quot;background-color: white; color:black; text-align: center;&quot;&gt;← Предыдущая&lt;/td&gt;
				&lt;td colspan=&quot;1&quot; style=&quot;background-color: white; color:black; text-align: center;&quot;&gt;Версия 15:31, 26 мая 2010&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; style=&quot;text-align: center;&quot; lang=&quot;ru&quot;&gt;&lt;div class=&quot;mw-diff-empty&quot;&gt;(нет различий)&lt;/div&gt;
&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;</summary>
			</entry>

	<entry>
		<id>http://nfex.ru/index.php?title=Csharp/CSharp_Tutorial/GUI_Windows_Forms/ContextMenu_Popup_Menu&amp;diff=5470&amp;oldid=prev</id>
		<title>Admin: 1 версия</title>
		<link rel="alternate" type="text/html" href="http://nfex.ru/index.php?title=Csharp/CSharp_Tutorial/GUI_Windows_Forms/ContextMenu_Popup_Menu&amp;diff=5470&amp;oldid=prev"/>
				<updated>2010-05-26T12:15:36Z</updated>
		
		<summary type="html">&lt;p&gt;1 версия&lt;/p&gt;
&lt;p&gt;&lt;b&gt;Новая страница&lt;/b&gt;&lt;/p&gt;&lt;div&gt;==Add ContextMenu to TextBox==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
&amp;lt;source lang=&amp;quot;csharp&amp;quot;&amp;gt;using System;&lt;br /&gt;
using System.Drawing;&lt;br /&gt;
using System.Windows.Forms;&lt;br /&gt;
public class TextBoxContextMenuDemo : Form&lt;br /&gt;
{&lt;br /&gt;
    public TextBoxContextMenuDemo()&lt;br /&gt;
    {&lt;br /&gt;
        InitializeComponent();&lt;br /&gt;
        ContextMenu mnuContext = new ContextMenu();&lt;br /&gt;
        foreach (MenuItem mnuItem in mnuFile.MenuItems)&lt;br /&gt;
        {&lt;br /&gt;
            mnuContext.MenuItems.Add(mnuItem.CloneMenu());&lt;br /&gt;
        }&lt;br /&gt;
        TextBox1.ContextMenu = mnuContext;&lt;br /&gt;
    }&lt;br /&gt;
    private void TextBox1_MouseDown(object sender, MouseEventArgs e)&lt;br /&gt;
    {&lt;br /&gt;
        if (e.Button == MouseButtons.Right)&lt;br /&gt;
        {&lt;br /&gt;
            TextBox1.ContextMenu.Show(TextBox1, new Point(e.X, e.Y));&lt;br /&gt;
        }&lt;br /&gt;
    }&lt;br /&gt;
    private void mnuOpen_Click(object sender, EventArgs e)&lt;br /&gt;
    {&lt;br /&gt;
        MessageBox.Show(&amp;quot;This is the event handler for Open.&amp;quot;,&amp;quot;TextBoxContextMenuDemo&amp;quot;);&lt;br /&gt;
    }&lt;br /&gt;
    private void mnuSave_Click(object sender, EventArgs e)&lt;br /&gt;
    {&lt;br /&gt;
        MessageBox.Show(&amp;quot;This is the event handler for Save.&amp;quot;,&amp;quot;TextBoxContextMenuDemo&amp;quot;);&lt;br /&gt;
    }&lt;br /&gt;
    private void mnuExit_Click(object sender, EventArgs e)&lt;br /&gt;
    {&lt;br /&gt;
        MessageBox.Show(&amp;quot;This is the event handler for Exit.&amp;quot;,&amp;quot;TextBoxContextMenuDemo&amp;quot;);&lt;br /&gt;
    }&lt;br /&gt;
    [STAThread]&lt;br /&gt;
    public static void Main(string[] args)&lt;br /&gt;
    {&lt;br /&gt;
        Application.Run(new TextBoxContextMenuDemo());&lt;br /&gt;
    }&lt;br /&gt;
    private System.Windows.Forms.MainMenu MainMenu1;&lt;br /&gt;
    private System.Windows.Forms.MenuItem mnuFile;&lt;br /&gt;
    private System.Windows.Forms.MenuItem mnuOpen;&lt;br /&gt;
    private System.Windows.Forms.MenuItem mnuSave;&lt;br /&gt;
    private System.Windows.Forms.MenuItem mnuExit;&lt;br /&gt;
    private System.Windows.Forms.MenuItem MenuItem5;&lt;br /&gt;
    private System.Windows.Forms.MenuItem MenuItem6;&lt;br /&gt;
    private System.Windows.Forms.MenuItem MenuItem7;&lt;br /&gt;
    private System.Windows.Forms.MenuItem MenuItem8;&lt;br /&gt;
    private System.Windows.Forms.TextBox TextBox1;&lt;br /&gt;
    private System.ruponentModel.IContainer components = null;&lt;br /&gt;
    private void InitializeComponent()&lt;br /&gt;
    {&lt;br /&gt;
        this.ruponents = new System.ruponentModel.Container();&lt;br /&gt;
        this.MainMenu1 = new System.Windows.Forms.MainMenu(this.ruponents);&lt;br /&gt;
        this.mnuFile = new System.Windows.Forms.MenuItem();&lt;br /&gt;
        this.mnuOpen = new System.Windows.Forms.MenuItem();&lt;br /&gt;
        this.mnuSave = new System.Windows.Forms.MenuItem();&lt;br /&gt;
        this.mnuExit = new System.Windows.Forms.MenuItem();&lt;br /&gt;
        this.MenuItem5 = new System.Windows.Forms.MenuItem();&lt;br /&gt;
        this.MenuItem6 = new System.Windows.Forms.MenuItem();&lt;br /&gt;
        this.MenuItem7 = new System.Windows.Forms.MenuItem();&lt;br /&gt;
        this.MenuItem8 = new System.Windows.Forms.MenuItem();&lt;br /&gt;
        this.TextBox1 = new System.Windows.Forms.TextBox();&lt;br /&gt;
        this.SuspendLayout();&lt;br /&gt;
        // &lt;br /&gt;
        // MainMenu1&lt;br /&gt;
        // &lt;br /&gt;
        this.MainMenu1.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {&lt;br /&gt;
        this.mnuFile,&lt;br /&gt;
        this.MenuItem5});&lt;br /&gt;
        // &lt;br /&gt;
        // mnuFile&lt;br /&gt;
        // &lt;br /&gt;
        this.mnuFile.Index = 0;&lt;br /&gt;
        this.mnuFile.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {&lt;br /&gt;
        this.mnuOpen,&lt;br /&gt;
        this.mnuSave,&lt;br /&gt;
        this.mnuExit});&lt;br /&gt;
        this.mnuFile.Text = &amp;quot;File&amp;quot;;&lt;br /&gt;
        // &lt;br /&gt;
        // mnuOpen&lt;br /&gt;
        // &lt;br /&gt;
        this.mnuOpen.Index = 0;&lt;br /&gt;
        this.mnuOpen.Text = &amp;quot;Open&amp;quot;;&lt;br /&gt;
        this.mnuOpen.Click += new System.EventHandler(this.mnuOpen_Click);&lt;br /&gt;
        // &lt;br /&gt;
        // mnuSave&lt;br /&gt;
        // &lt;br /&gt;
        this.mnuSave.Index = 1;&lt;br /&gt;
        this.mnuSave.Text = &amp;quot;Save&amp;quot;;&lt;br /&gt;
        this.mnuSave.Click += new System.EventHandler(this.mnuSave_Click);&lt;br /&gt;
        // &lt;br /&gt;
        // mnuExit&lt;br /&gt;
        // &lt;br /&gt;
        this.mnuExit.Index = 2;&lt;br /&gt;
        this.mnuExit.Text = &amp;quot;Exit&amp;quot;;&lt;br /&gt;
        this.mnuExit.Click += new System.EventHandler(this.mnuExit_Click);&lt;br /&gt;
        // &lt;br /&gt;
        // MenuItem5&lt;br /&gt;
        // &lt;br /&gt;
        this.MenuItem5.Index = 1;&lt;br /&gt;
        this.MenuItem5.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {&lt;br /&gt;
        this.MenuItem6,&lt;br /&gt;
        this.MenuItem7,&lt;br /&gt;
        this.MenuItem8});&lt;br /&gt;
        this.MenuItem5.Text = &amp;quot;Edit&amp;quot;;&lt;br /&gt;
        // &lt;br /&gt;
        // MenuItem6&lt;br /&gt;
        // &lt;br /&gt;
        this.MenuItem6.Index = 0;&lt;br /&gt;
        this.MenuItem6.Text = &amp;quot;Cut&amp;quot;;&lt;br /&gt;
        // &lt;br /&gt;
        // MenuItem7&lt;br /&gt;
        // &lt;br /&gt;
        this.MenuItem7.Index = 1;&lt;br /&gt;
        this.MenuItem7.Text = &amp;quot;Copy&amp;quot;;&lt;br /&gt;
        // &lt;br /&gt;
        // MenuItem8&lt;br /&gt;
        // &lt;br /&gt;
        this.MenuItem8.Index = 2;&lt;br /&gt;
        this.MenuItem8.Text = &amp;quot;Paste&amp;quot;;&lt;br /&gt;
        // &lt;br /&gt;
        // TextBox1&lt;br /&gt;
        // &lt;br /&gt;
        this.TextBox1.Location = new System.Drawing.Point(44, 56);&lt;br /&gt;
        this.TextBox1.Multiline = true;&lt;br /&gt;
        this.TextBox1.Name = &amp;quot;TextBox1&amp;quot;;&lt;br /&gt;
        this.TextBox1.Size = new System.Drawing.Size(180, 88);&lt;br /&gt;
        this.TextBox1.TabIndex = 1;&lt;br /&gt;
        this.TextBox1.Text = &amp;quot;Right click here to view the cloned context menu.&amp;quot;;&lt;br /&gt;
        this.TextBox1.MouseDown += new System.Windows.Forms.MouseEventHandler(this.TextBox1_MouseDown);&lt;br /&gt;
        // &lt;br /&gt;
        // TextBoxContextMenuDemo&lt;br /&gt;
        // &lt;br /&gt;
        this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);&lt;br /&gt;
        this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;&lt;br /&gt;
        this.ClientSize = new System.Drawing.Size(292, 266);&lt;br /&gt;
        this.Controls.Add(this.TextBox1);&lt;br /&gt;
        this.Menu = this.MainMenu1;&lt;br /&gt;
        this.ResumeLayout(false);&lt;br /&gt;
        this.PerformLayout();&lt;br /&gt;
    }&lt;br /&gt;
}&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Form popup menu==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
&amp;lt;source lang=&amp;quot;csharp&amp;quot;&amp;gt;using System;&lt;br /&gt;
using System.Drawing;&lt;br /&gt;
using System.Collections;&lt;br /&gt;
using System.ruponentModel;&lt;br /&gt;
using System.Windows.Forms;&lt;br /&gt;
using System.Data;&lt;br /&gt;
public class FormPopupMenu : System.Windows.Forms.Form&lt;br /&gt;
{&lt;br /&gt;
  private int currFontSize = 12;&lt;br /&gt;
  private ContextMenu popUpMenu;&lt;br /&gt;
  private MenuItem currentCheckedItem;&lt;br /&gt;
  private MenuItem checkedHuge;&lt;br /&gt;
  private MenuItem checkedNormal;&lt;br /&gt;
  private MenuItem checkedTiny;&lt;br /&gt;
  private System.ruponentModel.Container components;&lt;br /&gt;
  public FormPopupMenu()&lt;br /&gt;
  {&lt;br /&gt;
    InitializeComponent();&lt;br /&gt;
    popUpMenu = new ContextMenu();&lt;br /&gt;
    popUpMenu.MenuItems.Add(&amp;quot;Huge&amp;quot;, new EventHandler(PopUp_Clicked));&lt;br /&gt;
    popUpMenu.MenuItems.Add(&amp;quot;Normal&amp;quot;, new EventHandler(PopUp_Clicked));&lt;br /&gt;
    popUpMenu.MenuItems.Add(&amp;quot;Tiny&amp;quot;, new EventHandler(PopUp_Clicked));&lt;br /&gt;
    this.ContextMenu = popUpMenu;&lt;br /&gt;
    checkedHuge = this.ContextMenu.MenuItems[0];&lt;br /&gt;
    checkedNormal = this.ContextMenu.MenuItems[1];        &lt;br /&gt;
    checkedTiny = this.ContextMenu.MenuItems[2];&lt;br /&gt;
    currentCheckedItem = checkedNormal;&lt;br /&gt;
    currentCheckedItem.Checked = true;&lt;br /&gt;
    this.Resize += new System.EventHandler(this.FormPopupMenu_Resize);&lt;br /&gt;
    this.Paint += new System.Windows.Forms.PaintEventHandler(this.FormPopupMenu_Paint);&lt;br /&gt;
  }&lt;br /&gt;
  protected override void Dispose( bool disposing )&lt;br /&gt;
  {&lt;br /&gt;
    if( disposing )&lt;br /&gt;
    {&lt;br /&gt;
      if (components != null) &lt;br /&gt;
      {&lt;br /&gt;
        components.Dispose();&lt;br /&gt;
      }&lt;br /&gt;
    }&lt;br /&gt;
    base.Dispose( disposing );&lt;br /&gt;
  }&lt;br /&gt;
  private void InitializeComponent()&lt;br /&gt;
  {&lt;br /&gt;
    this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);&lt;br /&gt;
    this.ClientSize = new System.Drawing.Size(292, 273);&lt;br /&gt;
  }&lt;br /&gt;
&lt;br /&gt;
  [STAThread]&lt;br /&gt;
  static void Main() &lt;br /&gt;
  {&lt;br /&gt;
    Application.Run(new FormPopupMenu());&lt;br /&gt;
  }&lt;br /&gt;
  private void PopUp_Clicked(object sender, EventArgs e) &lt;br /&gt;
  {&lt;br /&gt;
    currentCheckedItem.Checked = false;&lt;br /&gt;
    MenuItem miClicked = null; &lt;br /&gt;
    if (sender is MenuItem)&lt;br /&gt;
      miClicked = (MenuItem)sender;&lt;br /&gt;
    else&lt;br /&gt;
      return;&lt;br /&gt;
    string item = miClicked.Text;&lt;br /&gt;
    if(item == &amp;quot;Huge&amp;quot;)&lt;br /&gt;
    { &lt;br /&gt;
      currFontSize = 18;&lt;br /&gt;
      currentCheckedItem = checkedHuge;&lt;br /&gt;
    } &lt;br /&gt;
    if(item == &amp;quot;Normal&amp;quot;)&lt;br /&gt;
    { &lt;br /&gt;
      currFontSize = 12;&lt;br /&gt;
      currentCheckedItem = checkedNormal;&lt;br /&gt;
    } &lt;br /&gt;
    if(item == &amp;quot;Tiny&amp;quot;)&lt;br /&gt;
    { &lt;br /&gt;
      currFontSize = 8;&lt;br /&gt;
      currentCheckedItem = checkedTiny;&lt;br /&gt;
    } &lt;br /&gt;
    currentCheckedItem.Checked = true;&lt;br /&gt;
    Invalidate();&lt;br /&gt;
  }&lt;br /&gt;
  private void FormPopupMenu_Paint(object sender, System.Windows.Forms.PaintEventArgs e)&lt;br /&gt;
  {&lt;br /&gt;
    Graphics g = e.Graphics;&lt;br /&gt;
    g.DrawString(&amp;quot;string&amp;quot;, &lt;br /&gt;
      new Font(&amp;quot;Times New Roman&amp;quot;, (float)currFontSize), &lt;br /&gt;
      new SolidBrush(Color.Black), &lt;br /&gt;
      this.DisplayRectangle);&lt;br /&gt;
  }&lt;br /&gt;
  private void FormPopupMenu_Resize(object sender, System.EventArgs e)&lt;br /&gt;
  {&lt;br /&gt;
    Invalidate();&lt;br /&gt;
  }&lt;br /&gt;
}&amp;lt;/source&amp;gt;&lt;/div&gt;</summary>
		<author><name>Admin</name></author>	</entry>

	</feed>