Esempio n. 1
0
        private void contextMenu_Popup(object sender, EventArgs e)
        {
            if (Clipboard.ContainsImage())
            {
                if (null != fileSizeThread)
                {
                    fileSizeThread.Abort();
                }

                uploadMenuItem.Enabled = true;
                //uploadMenuItem.Text = "Upload from Clipboard" + " (" + GetImageSize(System.Drawing.Imaging.ImageFormat.Jpeg) / 1024 + " KB)";
                uploadMenuItem.Text = "Upload from Clipboard" + "          ";

                uploadAsPngMenuItem.Visible = true;
                //uploadAsPngMenuItem.Text = "Upload from Clipboard as PNG (lossless quality)" + " (" + GetImageSize(System.Drawing.Imaging.ImageFormat.Png) / 1024 + " KB)";
                uploadAsPngMenuItem.Text = "Upload from Clipboard as PNG (lossless quality)" + "          ";

                FileSizeWorker fileSizeWorker = new FileSizeWorker(Clipboard.GetImage());
                fileSizeThread = new Thread(new ParameterizedThreadStart(fileSizeWorker.Run));
                fileSizeThread.Start(this);
            }
            else
            {
                uploadMenuItem.Enabled = false;
                uploadMenuItem.Text    = "(No Image in Clipboard)";

                uploadAsPngMenuItem.Visible = false;
            }
        }
        private void contextMenu_Popup(object sender, EventArgs e)
        {
            if (Clipboard.ContainsImage()) {
                if (null != fileSizeThread) fileSizeThread.Abort();

                uploadMenuItem.Enabled = true;
                //uploadMenuItem.Text = "Upload from Clipboard" + " (" + GetImageSize(System.Drawing.Imaging.ImageFormat.Jpeg) / 1024 + " KB)";
                uploadMenuItem.Text = "Upload from Clipboard" + "          ";

                uploadAsPngMenuItem.Visible = true;
                //uploadAsPngMenuItem.Text = "Upload from Clipboard as PNG (lossless quality)" + " (" + GetImageSize(System.Drawing.Imaging.ImageFormat.Png) / 1024 + " KB)";
                uploadAsPngMenuItem.Text = "Upload from Clipboard as PNG (lossless quality)" + "          ";

                FileSizeWorker fileSizeWorker = new FileSizeWorker(Clipboard.GetImage());
                fileSizeThread = new Thread(new ParameterizedThreadStart(fileSizeWorker.Run));
                fileSizeThread.Start(this);
            } else {
                uploadMenuItem.Enabled = false;
                uploadMenuItem.Text = "(No Image in Clipboard)";

                uploadAsPngMenuItem.Visible = false;
            }
        }