Click to See Complete Forum and Search --> : Picturebox Problem
fordev
July 1st, 2009, 10:52 PM
Dear ALL,
I am student of engineering and i am trying to clone one of the online available application as my semester project please help me out
here I gave link to my .doc files. because file size limit I have to split my problem into 4 doc files.
Even I posted my problem under Graphics Programming forum thread name is
"picturebox problem" but I am trying to code in C# so thought this is better place.
http://www.codeguru.com/forum/attachment.php?attachmentid=25046&d=1246474053
http://www.codeguru.com/forum/attachment.php?attachmentid=25047&d=1246474135
http://www.codeguru.com/forum/attachment.php?attachmentid=25048&d=1246474226
http://www.codeguru.com/forum/attachment.php?attachmentid=25049&d=1246474340
JonnyPoet
July 2nd, 2009, 05:13 AM
Dear ALL,
I am student of engineering and i am trying to clone one of the online available application as my semester project please help me out
Now I have looked to the adress you gave in the other post. I can only download the working program. So maybe you do not talk about cloning, but you are talking about you want to create a similar program like CD Printexpress with similar functionallity for your own ? Is it that way.? This would be generally OK, but as this program is Copyright protected you still need to create your own design. So please show what you already have and what yor problems are so we maybe can help you.
For a first idea about drawing to Canvas look here
http://www.codeproject.com/KB/cs/BizDraw__for_net.aspx?msg=3104702#xx3104702xx
fordev
July 2nd, 2009, 06:38 AM
Now I have looked to the adress you gave in the other post. I can only download the working program. So maybe you do not talk about cloning, but you are talking about you want to create a similar program like CD Printexpress with similar functionallity for your own ? Is it that way.? This would be generally OK, but as this program is Copyright protected you still need to create your own design. So please show what you already have and what yor problems are so we maybe can help you.
For a first idea about drawing to Canvas look here
http://www.codeproject.com/KB/cs/BizDraw__for_net.aspx?msg=3104702#xx3104702xx
yes you are right I want to create program which has same functionality as CD Printexpress. Here I attach rought work which I did
please have look on it. it contains 2 forms
JonnyPoet
July 2nd, 2009, 07:37 AM
yes you are right I want to create program which has same functionality as CD Printexpress. Here I attach rought work which I did
please have look on it. it contains 2 formsIts really necessary to be carefully with words, because as i read cloning at first I had already set an answer about students cloning code and believe me it was harsh :D Cloning is really bad. Using wrong expressions this way could result in simple getting no answers.
Only because I found your other post and the adress was there I looked and downloaded the original program where I could see there is no code included, but a copyright note when installing the program.
fordev
July 2nd, 2009, 07:54 AM
Its really necessary to be carefully with words, because as i read cloning at first I had already set an answer about students cloning code and believe me it was harsh :D Cloning is really bad. Using wrong expressions this way could result in simple getting no answers.
Only because I found your other post and the adress was there I looked and downloaded the original program where I could see there is no code included, but a copyright note when installing the program.
I repent myself for it.
JonnyPoet
July 2nd, 2009, 08:09 AM
I repent myself for it.Its OK, it is only you should know about, so you will not wonder about why no one is answering such things. :D
I have done a short look into your code. I wouldn't do it that way. Its not working well that way. Even if you look to the working solution ;) you will find that the drawing in the inner part is not updated as long as you are moving the main picture.! Hve you seen that.
IMHO the link I gave you is a great way to use any canvas to draw on it and there are some corrections and notes in the bottom of the link made of 'nussknacker' which is me in that forum ( nutcracker in English :D) where I added some code corrections and gave suggestions about how to add layers.
I would use that design or a similar to that, having all my needed controls in some nice toolstrips and the needed output like position details in the statusbar. This way you may scroll your main picture like shown and on a layer in front -Toplayer) I would have my CD mask drawn all the time as a fixed foreground, which doesn't move
Having the picture itself on an invisible bitmap you can move on that template and only draw just the needed pixels. Moving the picture with the mouse this way means changing the sector in your bitmap array from where you are copying pixels to the canvas.
Something like that.
fordev
July 2nd, 2009, 09:17 AM
Its OK, it is only you should know about, so you will not wonder about why no one is answering such things. :D
I have done a short look into your code. I wouldn't do it that way. Its not working well that way. Even if you look to the working solution ;) you will find that the drawing in the inner part is not updated as long as you are moving the main picture.! Hve you seen that.
IMHO the link I gave you is a great way to use any canvas to draw on it and there are some corrections and notes in the bottom of the link made of 'nussknacker' which is me in that forum ( nutcracker in English :D) where I added some code corrections and gave suggestions about how to add layers.
I would use that design or a similar to that, having all my needed controls in some nice toolstrips and the needed output like position details in the statusbar. This way you may scroll your main picture like shown and on a layer in front -Toplayer) I would have my CD mask drawn all the time as a fixed foreground, which doesn't move
Having the picture itself on an invisible bitmap you can move on that template and only draw just the needed pixels. Moving the picture with the mouse this way means changing the sector in your bitmap array from where you are copying pixels to the canvas.
Something like that.
I downloaded that code. and tried to run that but I got following error please let me know what I suppose to do. I am using Visual Studio 2008
"A project with an Output Type of Class Library cannot be started directly.
In order to debug this project, add an executable project to this solution which references the library project. set the executable project as the startup project."
JonnyPoet
July 2nd, 2009, 01:18 PM
I downloaded that code. and tried to run that but I got following error please let me know what I suppose to do. I am using Visual Studio 2008
"A project with an Output Type of Class Library cannot be started directly.
In order to debug this project, add an executable project to this solution which references the library project. set the executable project as the startup project."Yes this is a library containing a control, which does the full work. But there should also be a demo project to be downloaded where this project is used. This way then you can use and study the whole code.
Also look at the code repairs which are added by the user comments under 'nussknacker.'
fordev
July 2nd, 2009, 10:03 PM
Yes this is a library containing a control, which does the full work. But there should also be a demo project to be downloaded where this project is used. This way then you can use and study the whole code.
Also look at the code repairs which are added by the user comments under 'nussknacker.'
Yes I had glance on it. also I copied your suggested code for zooming features. coming to Original working application(CD Printexpress) how I can draw that CD Mask in my application independent of inside image. will you please put light on it. which will helpful for me..
thanking you...
JonnyPoet
July 3rd, 2009, 08:56 AM
Yes I had glance on it. also I copied your suggested code for zooming features. coming to Original working application(CD Printexpress) how I can draw that CD Mask in my application independent of inside image. will you please put light on it. which will helpful for me..
thanking you...
As aleady told I would have the picture as an invisible bitmap in the background from whee you can copy pixel to pixel to the canvas
Calculation of movement needs to calculate where in your picture the center is. Then calculating an array of x/y positions of each point of the border circle (This is a calculation only needed to be done one time and storing that array of points.
Pseudocode:
Witing picture from left to write and from top to bottom line by line
if point to daw is left of leftCircleBorderPoint or right of rightCicleBorderPoint draw grey else get point from picture at this position +/- offset
Offset depends on mouse motion stats counting when Mouse down event occurs
This is the direct way.
An other way would be drawing the picture in full size as copies fom the hidden bitmap and after that drawing the top layer in gray for the area outside the circle.
fordev
July 3rd, 2009, 09:08 AM
As aleady told I would have the picture as an invisible bitmap in the background from whee you can copy pixel to pixel to the canvas
Calculation of movement needs to calculate where in your picture the center is. Then calculating an array of x/y positions of each point of the border circle (This is a calculation only needed to be done one time and storing that array of points.
Pseudocode:
Witing picture from left to write and from top to bottom line by line
if point to daw is left of leftCircleBorderPoint or right of rightCicleBorderPoint draw grey else get point from picture at this position +/- offset
Offset depends on mouse motion stats counting when Mouse down event occurs
This is the direct way.
An other way would be drawing the picture in full size as copies fom the hidden bitmap and after that drawing the top layer in gray for the area outside the circle.
I am still struggling to run BizDraw.. I followed instructions which was given by author.
I build solution of Bizdraw from which I got my drive/Bizdraw/bin/debug/Bizdraw.dll
then I created new app. and right clicked on my app name, selected add reference, under browse tag selected my drive/Bizdraw/bin/debug/Bizdraw.dll. but I didn't get Documentspace in toolbox...
may I know am I correct... or Did I mistaken somewhere
thanking you
JonnyPoet
July 3rd, 2009, 09:30 AM
I am still struggling to run BizDraw.. I followed instructions which was given by author.
I build solution of Bizdraw from which I got my drive/Bizdraw/bin/debug/Bizdraw.dll
then I created new app. and right clicked on my app name, selected add reference, under browse tag selected my drive/Bizdraw/bin/debug/Bizdraw.dll. but I didn't get Documentspace in toolbox...
may I know am I correct... or Did I mistaken somewhere
thanking youThere should also be a project named Bizdaw Client where all this is put together. Thee are diffeent namespaces to be added to a project
using BizDraw.Core;
using BizDraw.Controls ;
using BizDraw.IO;
using BizDraw.Printing;
If you cannot find the BizDraw Client project PM me and I'll send you that complete project by email (Add your emailadress only in a PM not here in forum !!
fordev
July 4th, 2009, 01:06 PM
received your e-mail. It worked successfully. now I am trying to understand the code.
will it be possible for you to guide me specific part of code which will be more useful for my application.. which will make me to understand it very well...
thanking you
JonnyPoet
July 4th, 2009, 05:01 PM
received your e-mail. It worked successfully. now I am trying to understand the code.
will it be possible for you to guide me specific part of code which will be more useful for my application.. which will make me to understand it very well...
thanking youAt a first step try to use it by drawing some different items then running using debugger to see how it works to draw on a canvas. As a next try to use the method I suggested to simple draw your backgroundpicture as a copy of a hidden bitmap copying the data bit by bit to to a standard rectangle in the white canvase which yo can see. This will give you some feeling how such design works. You will not need the scrolling method in your case, but something similar together with mouse move delegate.
I'm sure when you are playing around a bit and debugging the design you will get the idea. If you have some specific questions feel free to ask.
fordev
July 27th, 2009, 09:15 AM
At a first step try to use it by drawing some different items then running using debugger to see how it works to draw on a canvas. As a next try to use the method I suggested to simple draw your backgroundpicture as a copy of a hidden bitmap copying the data bit by bit to to a standard rectangle in the white canvase which yo can see. This will give you some feeling how such design works. You will not need the scrolling method in your case, but something similar together with mouse move delegate.
I'm sure when you are playing around a bit and debugging the design you will get the idea. If you have some specific questions feel free to ask. I am not able to follow that code.. will it be possible for you to help with some basic code on which i can put my act. :confused:
please let me know
JonnyPoet
July 28th, 2009, 07:06 AM
I'll see what I can do for you in the evening
----------
edit: Sorry was to busy yesterday I'll hopefully see this evening what I can do
Have you tried to debug that BizDraw example to see how it works ?
fordev
July 29th, 2009, 12:48 AM
thank you
JonnyPoet
July 29th, 2009, 05:07 PM
thank youHere are some other examples which may help you using the bitmap class
http://ondotnet.com/pub/a/dotnet/2002/05/20/drawing.html?page=3
At first draw a black circle to an empty white bitmap.
Then read out the x/y data of each black point in that bitmap so you get an array of that positions. If you read them reading from left to right and from top to bottom then you will get at least two or more black points in each line. left from the first and right from the last in each line you will have to fill color grey.
Inside the circle is the bitmap.
As a first step dont care about motion of the picture.
Simple you have after the first group og black points which is the left borders line you have to copy in the bitmap. Until you reach the first black point of the right circles border.
For copying parts of the bitmap at first fill an Image with that pictrure and then you can copy the data using ownerdrawing Draw method to the real Form surface.
Give this a try and show what you have. Then I'll have a look on it.
I have added a drawing that shows the idea I described showing one pixel line
fordev
July 31st, 2009, 02:31 AM
ok . I will do as you said.
JonnyPoet
July 31st, 2009, 03:06 AM
ok . I will do as you said.Yep and when you have done a bit show it ( zip the project and post it ) and I'll have a look on and give you some hints if needed
fordev
July 31st, 2009, 03:07 AM
ok
fordev
August 2nd, 2009, 01:48 AM
I tried to code piece of code using Bitmap class.I will send it to you right now to your e-mail. please have a look on it.
HanneSThEGreaT
August 5th, 2009, 03:07 AM
I tried to code piece of code using Bitmap class.I will send it to you right now to your e-mail. please have a look on it.
You can attach it here as well, so that we all can benefit from it as well :)
JonnyPoet
August 5th, 2009, 03:11 AM
I tried to code piece of code using Bitmap class.I will send it to you right now to your e-mail. please have a look on it.In the first program you have sent me the MouseMove Delegate code moves the whole picturebox, that is impossible.
Additional: You will really need to draw it ownerdrawn. Using Picturebox.Image and calculating the changes outside of it by always adding the changed picture during movement will not work
I have done some changes to your first code a) regarding MouseMove
b) reading bitmap in an two dimensional array and from there copying the correct picture to the needed picture. But because I simple used your method to send the created result as a full image to the picturebox you will see that moving the picture will give people hard time. So all needs to be done ownerdrawn. I had tried to send it yesterday night, but your email had some problems with it and refused to accept it. ( Maybe there was an exe file in it as I simple zipped the project. ) So I'll see to send it in a few hours. Its only to get you the idea. You then need to redo that conceipt as an ownerdrawn issue
codeguru.com
Copyright Internet.com Inc., All Rights Reserved.