Ejemplo n.º 1
0
        private double transy; //posunuti

        #endregion Fields

        #region Constructors

        public Form1(string filename)
        {
            Text = "Viewer";
            Size = new Size(250, 200);
            BackColor = System.Drawing.Color.LightGray;
            DoubleBuffered = true;

            menu = new MainMenu();
            MenuItem itemfile = new MenuItem("File");
            menu.MenuItems.Add(itemfile);
            l = null;
            //tvorba menu
            itemfile.MenuItems.Add(new MenuItem("&Open",new EventHandler(OnFileOpen),Shortcut.CtrlO));
            itemfile.MenuItems.Add(new MenuItem("&Close",new EventHandler(OnFileClose),Shortcut.CtrlC));
            itemfile.MenuItems.Add(new MenuItem("&Quit",new EventHandler(OnFileQuit),Shortcut.CtrlQ));

            Menu = menu;

            rx = 0;
            ry = 0;
            butdown = false;

            scale=1;
            transx = 0;
            transy = 0;
            //registrace udalosti
            MouseMove += new System.Windows.Forms.MouseEventHandler(OnMouseMove);
            MouseDown += new System.Windows.Forms.MouseEventHandler(OnMouseDown);
            MouseUp += new System.Windows.Forms.MouseEventHandler(OnMouseUp);
            MouseWheel += new System.Windows.Forms.MouseEventHandler(OnMouseWheel);
            KeyDown += new KeyEventHandler(OnKeyDown);
            Paint += new PaintEventHandler(OnPaint);
            ResizeEnd += new EventHandler(OnResize);
            SizeChanged += new EventHandler(OnResize);
            CenterToScreen();
        }
Ejemplo n.º 2
0
        //obsluha polozky open v menu
        private void OnFileOpen(object sender,EventArgs e)
        {
            string filename = "";
            OpenFileDialog openFileDialog = new OpenFileDialog();
            openFileDialog.Title = "File to Open";
            openFileDialog.RestoreDirectory = true;

            if (openFileDialog.ShowDialog() == DialogResult.OK)
            {
            filename = openFileDialog.FileName;
            l = FileLoaderAC3D.Load(filename);
            }
            Refresh();
        }
Ejemplo n.º 3
0
 private void OnFileClose(object sender,EventArgs e)
 {
     l = null;
     Refresh();
 }