Jump to content


Photo

How to open Paint.NET in c# application?


  • Please log in to reply
6 replies to this topic

#1 monire

monire
  • Newbies
  • 4 posts
  • Reputation:0

Posted 16 May 2008 - 12:06 PM

Hi All

I want to write a c# application that can draw pictures and edit images with the use of Paint.NET functionalities,
does anyone know how can I open the Paint.NET in my application?

I am not very good in c#
please help
Thanks in advance
  • 0

#2 Braiden

Braiden
  • Members
  • 39 posts
  • LocationNew Zealand
  • Reputation:0

Posted 16 May 2008 - 12:51 PM

Hi, welcome to the Forums,

Ill try not to 'bite the newbies'

If you wish to take your programming anywhere, 'ripping' proper softwares tools is not the way to go. Try doing that with Photoshop and youll find your self with either a Cease and Decist, or a Law Suit, or both.

Although this is Open-Source ( i think ? ), your better to start small dude, jumping straight into heavy code and missing out the rudimentary stuff is going to make you obsolete in the programming world.

Maybe ask for some advice on how to make your own functions, and usually someone will post a template, or some sample code to get you on your way!
  • 0

#3 harold

harold
  • Members
  • 374 posts
  • LocationNetherlands
  • Reputation:0

Posted 16 May 2008 - 02:31 PM

You'd want to have a PDN window inside your application?

Anyway, you could probably do a lot with System.Reflection..
  • 0
I would write plugins, if I knew what kind of plugins were needed.. :(

#4 monire

monire
  • Newbies
  • 4 posts
  • Reputation:0

Posted 16 May 2008 - 06:40 PM

Thanks harold for the reply,but could you please explain more about PDN window :?:
  • 0

#5 I Like Pi

I Like Pi
  • Members
  • 186 posts
  • Reputation:0

Posted 16 May 2008 - 08:48 PM

System.Diagnostics.Process.Start(string: location of the Paint.NET executable, string: file to open)
  • 0

#6 harold

harold
  • Members
  • 374 posts
  • LocationNetherlands
  • Reputation:0

Posted 16 May 2008 - 09:38 PM

You'd have to redirect the window output though.. otherwise it'd just be started..
  • 0
I would write plugins, if I knew what kind of plugins were needed.. :(

#7 Braiden

Braiden
  • Members
  • 39 posts
  • LocationNew Zealand
  • Reputation:0

Posted 19 May 2008 - 10:16 AM

Actually, building upon what Harold said,

You would have to do several things before you can use System.Reflection properly;

Build a project with:
Splash Screen, No Forms.

and also, Read through the \src of PDN, finding all the functions you want.
Then, using the Splash screen as a Proxy, Call System.Reflection on the dll's containing the functions you want, e.g.
Public effectloader ()
'Add a function to check registry key for default installation location
If File.Exist(.dll file location as string) = "true" then     'See :*:
          Dim Effectsapi as New System.Reflection(.dll file location as string)
     Else
          
End If

From that point onwards, you can just call the following code to use functions:

Effectsapi.linedraw(Parameters 'Usually a .X, .Y, Color, Width)

'Or Assign a function to an individual variable, to save code space

Dim linedraw As New Effectsapi.linedraw(Parameters 'Usually a .X, .Y, Color, Width)

'Then you can simply call:

linedraw("50","50","Blue","2")

Unfortunately i have had no luck with that, so yea, thats just a possible way of handling it.

/=====/

another idea you could look at is using a C++ .dll as a Proxy, by using code from the web, let the .dll handle all the heavy codes ( probably like 10kb of code, but it saves space in the program ) and just call the .dll in namespace.

Well, thats my idea anyhow!
  • 0