Board index » Visual Studio » composing an image and sending it to sqlserver

composing an image and sending it to sqlserver

Visual Studio127
hi all



the situation

there is a picbox w a drawing, if the user clicks somewhere on the drawing a

cross is added where he clicked (the cross is a pic in a new picture box),

he can add as many crosses as he wants and if he clicks on a cross it is

removed again. the positions of the crosses are saved in an sql server. this

is all working like a charm.



the problem

i have to get that picture w the crosses in a cristal report.



w i was thinking

save the thing w crosses in an image field in sql server, i dont think

getting it on cr the will be a problem.

but how do i compose an image w a back image and coordinates of the crosses

(the crosses are icons but its no prob to convert them) if the proces is

invisible for the users thats better.



if anyone has an idea :) let me know.

If im not mistaking cor was doing some interesting things w images lately,

could be interesting.





eric


-
 

Re:composing an image and sending it to sqlserver

Hi Eric,



I'm not clear what you are saying. Is it one PictureBox with an image

and you are drawing crosses on that image, ie. still one PictureBox but

with crosses drawn all over it. Or is it one PictureBox with several

something with crosses overlaid?



|| i dont think getting it on cr the will be a problem.



What's 'on cr' ?



|| but how do i compose an image w a back image and coordinates

|| of the crosses



What do you mean by coordinates? I though you wanted the images of

the crosses.



|| (the crosses are icons but its no prob to convert them)



Convert them to what?



|| if the proces is invisible for the users thats better.



What do want them not to see?





So, more questions than answers I'm afraid.



Regards,

Fergus





-

Re:composing an image and sending it to sqlserver

Hi Eric,



I look to it tomorrow I think OK.

Is nothing more for tonight,

And when I forget, please remind me, I think we together can solve this very

easy.



Cor



"EricJ" <eric.juchtmansReMoVe@ThiSbitconsult.be>schreef in bericht

Quote
hi all



the situation

there is a picbox w a drawing, if the user clicks somewhere on the drawing

a

cross is added where he clicked (the cross is a pic in a new picture box),

he can add as many crosses as he wants and if he clicks on a cross it is

removed again. the positions of the crosses are saved in an sql server.

this

is all working like a charm.



the problem

i have to get that picture w the crosses in a cristal report.



w i was thinking

save the thing w crosses in an image field in sql server, i dont think

getting it on cr the will be a problem.

but how do i compose an image w a back image and coordinates of the

crosses

(the crosses are icons but its no prob to convert them) if the proces is

invisible for the users thats better.



if anyone has an idea :) let me know.

If im not mistaking cor was doing some interesting things w images lately,

could be interesting.





eric









-

Re:composing an image and sending it to sqlserver

* "EricJ" <eric.juchtmansReMoVe@ThiSbitconsult.be>scripsit:

Quote
there is a picbox w a drawing, if the user clicks somewhere on the drawing a

cross is added where he clicked (the cross is a pic in a new picture box),

he can add as many crosses as he wants and if he clicks on a cross it is

removed again. the positions of the crosses are saved in an sql server. this

is all working like a charm.



What's exactly the problem?



You can set up a new 'Bitmap' object, grab a 'Graphics' object using

'Graphics.FromImage'. Then you paint the cross onto the bitmap by using

the 'DrawImage' method of the 'Graphics' object. The position can be

obtained by the parameters passed into the PictureBox's 'MouseUp' event

handler. After finishing drawing you can show the bitmap in the

picturebox.



--

Herfried K. Wagner

MVP · VB Classic, VB.NET

<www.mvps.org/dotnet>">www.mvps.org/dotnet>

-

Re:composing an image and sending it to sqlserver

Hi Eric,



Now I read your message better.



First I thought you did want to make an area map or something. (That is

something I want to do after what I am making now, some kind of dynamic Area

map that floats with the size of the picture, would have a lot of HTML in

it).



But now I see it has to do with



Quote
i have to get that picture w the crosses in a cristal report.



I have seen all the regulars here don't like crystal reports and with that

it is me in front.



I dont know why, it is a terrific product, but I don't like it. Maybe the

same reason why I don't like SQL (Although that I don't find terrific, I

have found it forever the worst scripting language that has ever been made

in my eyes).



I have seen that from the regulars there is only one who gives sometimes a

real helpfull (no policeman) answer on a Crystal report question and that is

Armin.



Sorry, I thought a nice chalenge that area map



Cor





-

Re:composing an image and sending it to sqlserver

sorry for the late replies but i had a long weekend ;p



"Fergus Cooney" <filter@post.com>wrote in message

Quote
Hi Eric,



I'm not clear what you are saying. Is it one PictureBox with an image

and you are drawing crosses on that image, ie. still one PictureBox but

with crosses drawn all over it. Or is it one PictureBox with several

something with crosses overlaid?





one picturebox w several pictureboxes (with crosses overlaid)



Quote
|| i dont think getting it on cr the will be a problem.



What's 'on cr' ?





getting a correct image on a cristal report



Quote
|| but how do i compose an image w a back image and coordinates

|| of the crosses



What do you mean by coordinates? I though you wanted the images of

the crosses.





in the db i store the coordinates of the crosses so the user can remove add

new crosses or remove old ones



Quote
|| (the crosses are icons but its no prob to convert them)



Convert them to what?





never mind that



Quote
|| if the proces is invisible for the users thats better.



What do want them not to see?





that im converting and saving the image







-

Re:composing an image and sending it to sqlserver

hi cor



the problem would be is there an alternative to crystal reports included in

visual studio?



but this problem isn't really crystal related, the final image will end up

in a crystal report thats all.



it seems its rather difficult to explain w i am doing w this but ill give it

another go



imagine 2 pictures from a magazine where you have to find 5 differences



on one of the pics the user can click and where he clicks a cross appears,

if he was wrong he can click the cross and it will dissepear



the original pic is contained in a picturebox and all the crosses are

contained in there own picturebox that i add dinamicly to the original

picture box, i store the coordinates of the crosses in the original

picturebox in a db.

to reproduce this image w crosses in a way the user can still remove them, i

loop the records in the db relevant to the picture and put a picturebox w a

cross in place for each one.



that works, but i need 1 image that contains the background image w the

crosses on it.



to be clear no i'm not making a find the differences game ;p





i think the sollution will be in the direction of herfrieds post







-

Re:composing an image and sending it to sqlserver



Quote
What's exactly the problem?



You can set up a new 'Bitmap' object, grab a 'Graphics' object using

'Graphics.FromImage'. Then you paint the cross onto the bitmap by using

the 'DrawImage' method of the 'Graphics' object. The position can be

obtained by the parameters passed into the PictureBox's 'MouseUp' event

handler. After finishing drawing you can show the bitmap in the

picturebox.



that sounds like w i want (i already have the coordinates) i will try this

next saturday (i work for a different firm on saturdays)





-

Re:composing an image and sending it to sqlserver

Hi Eric,



In the VB resource kit are two sample solutions,



When you mix them up I think you have basicly your solution.



I think you would not use that in that way because they look terrible, but

you can take snippets from it.



As you say I am busy with something like that and very much on the route

now.



So when you want to discusse something (a dip to come over, tell me and I

will try to help you).



It are in the resource kit:

In Data Access Samples, Read and Write images from a Database

(very nice sample describing the memory Stream)



In Window Applications Samples, Use GDI+ to manipulate images .Net .....



I thought first it was very difficult but when you know a few tricks it is

simple.

(Fergus did made a nice sample for me, and with that start I got it very

fast in the fingers)



I never could work with rectangle's and so, but that is now also in the

past.



The only thing that for me still is a problem now is the different "codec"

formats from a picture.

I did not find how to get that from a pic, but that is not really necessary

till now.

That format you need when you want to write a picture back or to change

the formats, but when you have the formats that also is not a big deal I use

it (when you search it, it is the encoder class, samples almost only in C#

but those samples are mostly .Net members).



I think with this you will have it done very soon.



Cor







-

Re:composing an image and sending it to sqlserver

i'll have a look at them next saturday (i don't think my boss here (normal

job) would appreciate it if i'm working on another project while he is

paying me ;) )



the codec things shouldn't be a prob for me (since i can choose w i make of

it myself)





eric







-