예제 #1
0
 public virtual Bitmap CaptureControl( Control window, String filename, ImageFormatHandler.ImageFormatTypes format )
 {
     CaptureControl( window );
     Save( filename, format );
     return images[0];
 }
예제 #2
0
        public virtual void Save( String filename, ImageFormatHandler.ImageFormatTypes format )
        {
            String directory = Path.GetDirectoryName( filename );
            String name = Path.GetFileNameWithoutExtension( filename );
            String ext = Path.GetExtension( filename );

            ext = formatHandler.GetDefaultFilenameExtension( format );

            if ( ext.Length == 0 )
            {
                format = ImageFormatHandler.ImageFormatTypes.imgPNG;
                ext = "png";
            }

            try
            {
                ImageCodecInfo info;
                EncoderParameters parameters = formatHandler.GetEncoderParameters( format, out info );

                for ( int i = 0; i < images.Length; i++ )
                {
                    if ( images.Length > 1 )
                    {
                        filename = String.Format( "{0}\\{1}.{2:D2}.{3}", directory, name, i + 1, ext );
                    }
                    else
                    {
                        filename = String.Format( "{0}\\{1}.{2}", directory, name, ext );
                    }
                    image = images[i];

                    if ( parameters != null )
                    {
                        image.Save( filename, info, parameters );
                    }
                    else
                    {
                        image.Save( filename, ImageFormatHandler.GetImageFormat( format ) );
                    }
                }
            }
            catch ( Exception ex )
            {
                Terminals.Logging.Log.Info("", ex);
                string s = string.Format("Saving image to [{0}] in format [{1}].\n{2}", filename, format.ToString(), ex.ToString() );
                MessageBox.Show( s, "Capture failed", MessageBoxButtons.OK, MessageBoxIcon.Error );
            }
        }
예제 #3
0
 public virtual Bitmap Capture( IntPtr handle, String filename, ImageFormatHandler.ImageFormatTypes format )
 {
     Capture( handle );
     Save( filename, format );
     return images[0];
 }
예제 #4
0
 public virtual Bitmap[] Capture( CaptureType typeOfCapture, String filename, ImageFormatHandler.ImageFormatTypes format )
 {
     Capture( typeOfCapture );
     Save( filename, format );
     return images;
 }
예제 #5
0
 public virtual Bitmap Capture( Form window, String filename, ImageFormatHandler.ImageFormatTypes format )
 {
     return Capture( window, filename, format, false );
 }
예제 #6
0
 public virtual Bitmap Capture( Form window, String filename, ImageFormatHandler.ImageFormatTypes format, bool onlyClient )
 {
     Capture( window, onlyClient );
     Save( filename, format );
     return images[0];
 }
예제 #7
0
        public ScreenCapture( ImageFormatHandler formatHandler )
        {
            doc.PrintPage += new PrintPageEventHandler( printPage );

            this.formatHandler = formatHandler;
        }
예제 #8
0
 public ScreenCapture()
 {
     doc.PrintPage += new PrintPageEventHandler( printPage );
     formatHandler = new ImageFormatHandler();
 }
예제 #9
0
        /*private ScreenCapture screenCapture;
        private PictureBox previewPictureBox;*/
        public MainForm()
        {
            try
            {

                //check for wizard
                if(Settings.ShowWizard)
                {
                    //settings file doesnt exist, wizard!
                    //this.Hide();
                    FirstRunWizard wzrd = new FirstRunWizard();
                    wzrd.ShowDialog(this);
                    Settings.ShowWizard = false;
                }

                imageFormatHandler = new ImageFormatHandler();
                //screenCapture = new ScreenCapture(imageFormatHandler);
                _formSettings = new FormSettings(this);
                InitializeComponent();

                if(Settings.Office2007BlueFeel)
                    ToolStripManager.Renderer = Office2007Renderer.Office2007Renderer.GetRenderer(Office2007Renderer.RenderColors.Blue);
                else if(Settings.Office2007BlackFeel)
                    ToolStripManager.Renderer = Office2007Renderer.Office2007Renderer.GetRenderer(Office2007Renderer.RenderColors.Black);
                else
                    ToolStripManager.Renderer = new System.Windows.Forms.ToolStripProfessionalRenderer();

                //Settings.RebuildTagIndex();

                LoadFavorites();
                LoadFavorites("");
                LoadSpecialCommands();
                LoadGroups();
                UpdateControls();
                pnlTagsFavorites.Width = 7;
                LoadTags("");
                ProtocolHandler.Register();
                SingleInstanceApplication.NewInstanceMessage += new NewInstanceMessageEventHandler(SingleInstanceApplication_NewInstanceMessage);
                tcTerminals.MouseClick += new MouseEventHandler(tcTerminals_MouseClick);
                QuickContextMenu.ItemClicked += new ToolStripItemClickedEventHandler(QuickContextMenu_ItemClicked);
                SystemTrayQuickConnectToolStripMenuItem.DropDownItemClicked += new ToolStripItemClickedEventHandler(SystemTrayQuickConnectToolStripMenuItem_DropDownItemClicked);
                //System.Net.NetworkInformation.NetworkChange.NetworkAvailabilityChanged += new System.Net.NetworkInformation.NetworkAvailabilityChangedEventHandler(NetworkChange_NetworkAvailabilityChanged);

                LoadWindowState();

                this.MainWindowNotifyIcon.Visible = Settings.MinimizeToTray;
                this.lockToolbarsToolStripMenuItem.Checked = Settings.ToolbarsLocked;
                this.groupsToolStripMenuItem.Visible = Settings.EnableGroupsMenu;

                if(Settings.ToolbarsLocked)
                    MainMenuStrip.GripStyle = ToolStripGripStyle.Hidden;
                else
                    MainMenuStrip.GripStyle = ToolStripGripStyle.Visible;

                //be sure to turn off the visual studio hosting process for this to work
                //right click the Terminals project, debug, bottom checkbox
                //try {
                //    gma.System.Windows.UserActivityHook hook = new gma.System.Windows.UserActivityHook(false, true);
                //    hook.KeyUp += new KeyEventHandler(hook_KeyUp);
                //} catch(Exception exc) {
                //    Terminals.Logging.Log.Info("Failed to set keyboard hook for global event handling.", exc);
                //}

            }
            catch(Exception exc)
            {
                Terminals.Logging.Log.Info("", exc);
                System.Windows.Forms.MessageBox.Show(exc.ToString());
            }
        }
예제 #10
0
 public ScreenCapture(ImageFormatHandler formatHandler)
 {
     this.doc.PrintPage += new PrintPageEventHandler(this.printPage);
     this.formatHandler  = formatHandler;
 }
 public ScreenCapture()
 {
     doc.PrintPage += new PrintPageEventHandler(printPage);
     formatHandler  = new ImageFormatHandler();
 }