objarni's picture

Try 2..

OK so I got an idea, why not just put the PNG file path in the Clipboard..? Naively I typed "Clipboard" and what do you know, there is a "SetText" method in there ;)

Could it be any simpler..?

    private void button1_Click(object sender, EventArgs e)
    {
        var path = Path.GetTempFileName() + ".PNG";
        glControl1.GrabScreenshot().Save(path, ImageFormat.Png);
        Process.Start("http://www.opentk.com/node/add/blog");
//        Process.Start(new FileInfo(path).DirectoryName);
        Clipboard.SetText(path);
    }

Catch: Don't know whether this works using Mono. Anyone wanna test? I'm quite satisfied with this. I don't know how to make it any simpler.

Images

Comments

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
the Fiddler's picture

It works on Mono, but the clipboard functions behaves a little differently on Linux (no idea about MacOS). Among other things, it is emptied when you close the application (so you can copy text, close the application and paste the text - you have to keep the app open throughout) and non-textual formats may not work.

objarni's picture

It doesn't with my setup (mono 2.0.1). I tried to paste using middle-mouse-wheel, Ctrl+V and right-click-menu.

In the blog entry field, not the upload image field.

objarni's picture

If you want to try, here's a .zip with the .exe. The button calls the blog-screenshot-thingie ;)

Uses OpenTK 0.9.8 binary release. Would have put it into the zip if it wouldn't have made the archive just a little too big (528 kb! 512 was max dooh!)

AttachmentSize
temp.zip5.09 KB
the Fiddler's picture

Will try tomorrow. Lzma (7z) could have brought you below the limit, but it would have been a waste of bandwidth. A little annoying, granted, but this should get better once OpenTK becomes eligible for the GAC.

objarni's picture

Wow that's a huge difference! Approx 350kb with .7z!

.. but that didn't work because the "disc quota" was reached (2 mb). Plz Fiddler, will you give me some more quota? Or tell me how I can remove big files I've uploaded?

triton's picture

Nice to see some progress. My hands are full at the moment but I'm gonna see if I find some time to help you. :)

objarni's picture

triton: thanks :)

Especiall platform-independancy would be great. And support for GameWindow.