|
I try to write my own Paint program , and I wonder how to create the "layer system" , like Photoshop , Paint.NET 's features , I try to draw multiple stacked images on form , but it just works terribly .
Anyone got an idea of how to do it ? Thanks ^^
|
|
|
|
|
You may want to take a look at the source code for Paint.Net
The last time I saw it it was open source.
|
|
|
|
|
I got the Paint.Net source code , but without any idea in my mind , reading these codes just waste time and bring headache ^^ , anyone got ideas of how to do this ??
|
|
|
|
|
Having headaches is part of becoming a computer programmer so you might as well get use to it
Go into detail with what you have already attempted as far as layered graphics and the forums might be able to guide you based on the skills that you are showing with what you have tried so far. As you can tell layered graphics can get as complicated as Paint.NET (not to mention Photoshop), or they can be fairly simple. It just matters with how much time you want to put into the application.
Regards,
Thomas Stockwell
Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning.
Visit my Blog
|
|
|
|
|
Thomas Stockwell wrote: Having headaches is part of becoming a computer programmer so you might as well get use to it
Thomas Stockwell wrote: It just matters with how much time you want to put into the application.
And how much of a headache you want to put up with...
|
|
|
|
|
Hi All,
I have created VS2008 windows application and Setup project. Now I want to stop Installation process for some specific conditions. I used "Throw New Install Exception", but it shows me strange message. Can any one give me some other solution?
Thanks
Praful U
|
|
|
|
|
I understand the general difficulty of allowing an enumerable class to be modified within an enumerator. Nonetheless, there are times when it would be very useful to go through a dictionary and purge all items meeting some criterion. While it would be possible to produce a list of the keys of the items to be deleted and then iterate through that list, doing so would seem needlessly complex and expensive.
I've searched for messages related to this subject and none that I've found seem to offer a solution except to note the general difficulties of allowing modification to an object within an enumerator.
What would seem most useful would be to have an object that supported an interface similar to iEnumerable but with the addition of a method RemoveAndMoveNext. Use of that method would remove the currently-selected item from the collection and advance to the next one. It would disqualify any other enumerators that exist to the collection, but would do whatever was necessary to maintain its own correct operation.
An alternative would be to have a ConditionalRemove method which would call a function on all items in the collection and remove those for which the function returns true. Such an approach could work well, but could be a nuisance in languages which don't support anonymous delegates.
Are there any free dictionary-style collections that support anything like either of those suggestions?
|
|
|
|
|
Or you could instantiate a new Dictionary, then iterate the existing one, adding the items you do want to the new one.
|
|
|
|
|
That could be done, but it would seem rather wasteful.
In nearly all common practical algorithms for storing collections, support for DeleteAndMoveNext could be added relatively simply. In many cases, it would add no extra work to the iterator's normal operation; in others, it would add a small amount of work (e.g. a singly linked list would need to keep a pointer to the item before the current one). Given the number of tasks that require striking from a collection objects which meet a particular criterion, and given that an iterator will often have information that would facilitate the deletion of an object from a collection, having an extended iEnumerator interface would seem useful.
BTW, for some types of collection, where the enumerator contains all the information about an object (e.g. a KeyValuePair) it may be useful to have general-purpose Add and Delete functions within the enumerator itself. Such functions would invalidate any other enumerators to the root object, but would do whatever was necessary to maintain their own validity. Not sure that would have much added utility beyond DeleteAndMoveNext, though.
|
|
|
|
|
supercat9 wrote: Use of that method would remove the currently-selected item from the collection and
...invalidate the Enumerator all in one shot. As you've found out, you cannot modify a collection during an Enumeration ("for each" operation).
The only solution would be to use in Indexed (for(i=0;i<10;i++) item(i)...) operation, treating the collection as an array instead.
|
|
|
|
|
Dave Kreskowiak wrote: ...invalidate the Enumerator all in one shot. As you've found out, you cannot modify a collection during an Enumeration ("for each" operation).
The whole idea of having an object return an enumerator that supported a DeleteAndMoveNext object would be that such a function would do whatever was necessary to avoid jinxing the enumerator. Note that the DeleteAndMoveNext would not be a general-purpose delete; it could only delete the current object. A simple implementation for an array-based list, if one wanted deletes to be performed immediately, would be to move down all objects above the present object, without bumping the object index. A singly-linked list object whose iterator kept a pointer to the previous object could 'swing' that pointer to point to the object following the present one and then advance the present object (note that this would be much faster than doing a search-and-delete).
An alternative general approach to allow deletions while traversing an iEnumerable object would be to have the 'delete' function mark an item as invalid (using either a 'valid' flag or a sentinel value) and also set a flag in the collection to indicate that one or more deletions had taken place. If 'add' operations are not allowed during an enumeration, the next add operation could check whether any items are marked for deletion (using the collection's flag to start with) and then remove all items that are so marked. For an array-based implementation, this could be much faster than having all deletes performed 'instantly'.
|
|
|
|
|
Hi,
two comments:
1.
I too would like to have a non-resettable enumerator that remains operational when elements
are modified, deleted or new ones inserted at a point that has already been passed.
2.
There is a nice List.RemoveAll() Method that accepts a predicate. That should solve your problem.
|
|
|
|
|
Luc Pattyn wrote: There is a nice List.RemoveAll() Method that accepts a predicate.
Good to know. Unfortunately I need a collection that behaves like a dictionary. Perhaps the best approach would be to have something that's like a dictionary with the addition of RemoveForAll; unfortunately I know no good way to adapt the existing dictionary to fit that need except by having the removeForAll create a list of keys of objects to be deleted, which would likely take time n^2.
|
|
|
|
|
In case of typed dataset I want to pass as an array to the typed dataset so that i can have the all data of selected code in arrays filled in dataset
|
|
|
|
|
Hello,
I have to display HTML in desktop application. Not only a simple text but also images and maybe flash elements and movies... Problem is because the background is an image and the browser background must be transparent.
I tried several solutions but all of them failed...
Have You ever had the same problem or do You konw any solution? It may be even payable .NET control.
|
|
|
|
|
I've never seen, nor heard of, a browser control that is transparent to the form. I think you're going to have to write this one yourself.
|
|
|
|
|
I was really affraid to hear that there is not such component...
I've got idea how to write transparent browser, but I'm concerned about "blinking" effect... GDI+ is not a speed demon...
|
|
|
|
|
hello,every expertist
From debug the program, System shows if(dr.read()) == false, by the way, sql sentence is correct, test in SQL2005 Successfully!
i really confused, help me! Thank you!
private void button13_Click(object sender, EventArgs e)
{
if (this.textBox1.Text.Length > 11)
{
MessageBox.Show("please input correct number ",MessageBoxButtons.OK,MessageBoxIcon.Error);
this.textBox1.Clear();
}
else if(this.textBox1.Text.Length < 11)
{
MessageBox.Show("please input correct number ", MessageBoxButtons.OK, MessageBoxIcon.Error);
this.textBox1.Clear();
}
else
{
string sql = "select * from customer_colorring where cmobilephone ='" + this.textBox1.Text + "'and documentfile = 'g:\\song\\when i meet you.mp3'";
CDBSql q = new CDBSql();
SqlDataReader dr = q.getDataReader(sql);
if (dr.Read()) //here shows false,why????????????????????????????????????
{
string file = q.getScalar(sql).ToString();
Media.MP3Player mp3player = new Media.MP3Player();
mp3player.Open(file);
mp3player.Play();
mp3player.Pause();
mp3player.Stop();
mp3player.Close();
}
else
{
MessageBox.Show("no songs","error",MessageBoxButtons.OK,MessageBoxIcon.Error);
}
}
}
|
|
|
|
|
Try adding a space in "'and
|
|
|
|
|
Hello !
I'm a Chinese, i want to know how to use checkbox in datagridview. For example, there are 10 records in the datagridview, and i want to delete or modify them by clicking checkbox and a button. the checkbox is used for selecting the records,the button is used for deleting the records, i don't know how to write the codes.
if you know,please tell me, Thank you very much!
My e-mail address is : xurf@js.chinamobile.com
|
|
|
|
|
bozin wrote: i don't know how to write the codes.
What is going on here? Has someone outsourced this project to you? What are the requirements?
led mike
|
|
|
|
|
hello,led mike
no,i just do an exericise, not a project. simply speaking, i added checkbox to the datagridview checkboxcolumn, and when the checkbox is checked,and press "delete" button, the selected record will be deleted.
i want to know how to write the codes? if i write codes for "delete" button
private void button1_Click(object sender, EventArgs e)
{
// here i can't find the something about checkbox,so i have no ways to continue!
}
|
|
|
|
|
bozin wrote: no,i just do an exericise
Are you working through some sort of tutorial or Article? If not you should be, there will be many on the internet probably even some articles here on CodeProject.
led mike
|
|
|
|
|
i do that stuff (delete/add/edit row) directly to the database! sql server database (or a xml file!).
for exemple i delete a row in the database (not in the dgv) and afterwords refresh the dgv.
there´s no sense to me, to add or delete records in the dgv you know.
See you can do that but when you run the application other time the changs aren´t there so like i said i edit the database (not the dgv) and after i refresh dgv everytime i do my changes.
about the buttons, create a panel and place inside the dgv and a toolstrip with buttons for the operations you want, and textboxes for each column in the dgv, these textboxes will get the current row data, ok? here the id textbox get´s the current row (selected row in dgv) so that´s a easy way to get the row selected better that checking boxes.
little of coding there
nelsonpaixao@yahoo.com.br
trying to help & get help
|
|
|
|
|
Hi all,
I have created an Excel 2003 AddIn project and created one Setup project also for install the AddIns in target machines. My setup contains the primary out put of the AddIn project. I just came to know some registery entries are required for successful installation. Can any one help me in creating setup project with necessary registery entries.
|
|
|
|