Beispiel #1
0
 public void EditObject()
 {
     if (selectedDrawing != null)
     {
         selectedDrawing.Edit(this);
     }
 }
Beispiel #2
0
        private void toolBar1_ButtonClick(object sender, System.Windows.Forms.ToolBarButtonClickEventArgs e)
        {
            switch (toolBar1.Buttons.IndexOf(e.Button))
            {
            case 0:                    //new
            {
                dlgNewDrawing dlg = new dlgNewDrawing();
                dlg.LoadData(HotspotOnly);
                if (dlg.ShowDialog(this) == DialogResult.OK)
                {
                    dlgDrawings frm = this.Parent as dlgDrawings;
                    dlg.objRet.Page = frm;
                    frm.StartDrawing(dlg.objRet);
                    this.Hide();
                }
            }
            break;

            case 1:                    //edit
                if (lstDrawings.SelectedIndex >= 0)
                {
                    dlgDrawings frm = this.Parent as dlgDrawings;
                    DrawingItem obj = lstDrawings.Items[lstDrawings.SelectedIndex] as DrawingItem;
                    if (obj != null)
                    {
                        obj.Edit(frm);
                    }
                }
                break;

            case 2:                    //delete
                DeleteObject();
                break;

            case 3:                     //up
                MoveUp();
                break;

            case 4:                     //down
                MoveDown();

                break;

            case 5:                     //finish
                this.DialogResult      = System.Windows.Forms.DialogResult.OK;
                frmParent.DialogResult = System.Windows.Forms.DialogResult.OK;
                frmParent.Close();
                break;

            case 6:                     //cancel
                this.DialogResult      = System.Windows.Forms.DialogResult.Cancel;
                frmParent.DialogResult = System.Windows.Forms.DialogResult.Cancel;
                frmParent.Close();
                break;

            case 8:                     //show/hide background image
                if (e.Button.Pushed)
                {
                    if (frmParent != null)
                    {
                        if (frmParent.BKImage != null)
                        {
                            frmParent.BackgroundImage = frmParent.BKImage;
                        }
                    }
                }
                else
                {
                    frmParent.BackgroundImage = null;
                }
                frmParent.Invalidate();
                break;
            }
        }