예제 #1
0
        private void onSelectUint(object sender, EventArgs e)
        {
            MenuWithID mi = sender as MenuWithID;

            if (mi != null)
            {
                drawPage.PageAttributes.PageUnit = mi.Unit;
                this.Refresh();
            }
        }
예제 #2
0
        protected override void OnMouseDown(MouseEventArgs e)
        {
            base.OnMouseDown(e);
            int nTop = toolBar1.Height;

            if (e.Y > nTop && e.Y < nTop + nDY && e.X < nDX)
            {
                System.Windows.Forms.ContextMenu mnu = new ContextMenu();
                MenuWithID mi = new MenuWithID(EnumPageUnit.Pixel.ToString());
                mi.Unit   = EnumPageUnit.Pixel;
                mi.Click += new EventHandler(onSelectUint);
                mnu.MenuItems.Add(mi);
                mi        = new MenuWithID(EnumPageUnit.Inch.ToString());
                mi.Unit   = EnumPageUnit.Inch;
                mi.Click += new EventHandler(onSelectUint);
                mnu.MenuItems.Add(mi);
                mi        = new MenuWithID(EnumPageUnit.Centimeter.ToString());
                mi.Unit   = EnumPageUnit.Centimeter;
                mi.Click += new EventHandler(onSelectUint);
                mnu.MenuItems.Add(mi);
                mnu.Show(this, new System.Drawing.Point(e.X, e.Y));
            }
        }