Answered Change the color of the drawn figures

Joined
May 25, 2020
Messages
8
Location
Sofia, Bulgaria
Programming Experience
Beginner
here is my form1 and you can see my options buttons:
Без име.png


this is for draw shapes:
C#:
private void drawBtn_Click(object sender, EventArgs e)
        {
            label1.Text = "Click somewhere to draw shape. The shape drawing when click with mouse.";
            option2Moving = false;
            option4ShowAreas = false;
            Form2 drawoptions = new Form2();
            drawoptions.ShowDialog();
        }

and this is form2, where the user selects one of the forms and then enters its' sides:
Без име1.png


when press enter - open form1 and where click with left button of the mouse, it's show the shape.

my question is: how change the color of drawn shape. i create "change color" button and i imagined it - by pressing the button to change the color and a shape like this will appear:

unnamed.gif


and choose one of these colors and change the color of that shape. is it possible what i want? Can someone help me, please?
 
I don't know how to respond to that last reply.

Nobody here is refusing to help you. You are refusing to let us help you by not showing the code you tried to write. Had you done so, we could have edited it and assisted you with any mistakes you encountered or made.

If you change your mind. You know where to find us. :cool:
 
which of my code do you want me to send you? Тhe code in which there are 100 or the one in which there are 200 errors?
As I have already said, you should show us your best attempt. Whichever you think is the most correct, based on your understanding of the problem. That doesn't necessarily mean the one with the fewest compilation errors, because that code might still not get anywhere near the desired result. Think about the problem, determine what you think the solution should be, write code to implement that solution and then show us that code. It's not rocket surgery.

Also, if you have code with that many errors then you're pretty much guaranteed to be approaching things in completely the wrong way and that's part of the problem. Many beginners treat any problem as a monolith and try to write the whole code in one go. That's flat out wrong. You need to break the problem down into smaller and smaller parts and address each part individually. Because each part is small, it is easier to research, easier to implement and guaranteed to only have a small number of errors. Once you have addressed all those errors and that part is working, you go on to the next. If any errors arise, you know that they are in the new part and not the already-working part, so they are easier to resolve. If you had done that and asked for help with specific issues with specific parts then you'd never get to the point of having 200 or even 100 errors.
I don't know how to send code that I don't have anymore because it's deleted.
If you took backups or used source control then you'd still have the code but, as you don't, write it again.

Basically, you're just wallowing in self-pity at the moment. As has been said, no one is refusing to help you. If we were then we'd have stopped replying long ago. We're here because we want to help but you're not helping us to do so. Helping is not just writing your code for you. Trying and failing is an important part of learning and it's also important that you learn from your mistakes. To that end, if we see your code and point out the mistakes you made and how to fix them, you will learn far more than if you just copy and paste code that we wrote for you. We want you to solve this issue but, more than that, we want to you to learn how to avoid more issues in future or to be able to solve them for yourself. That's what we're trying to achieve but you are refusing to help us.
 
I'm wondering if we are hitting some kind of culture barrier. Just like part of Japanese culture has pressure to save face and not show weakness or failure, I'm wondering if the same is true in the case of our OP, where her school or culture may have inculcated the thought that when asking for help, only present the successful steps so far, but don't show the missteps that were attempted.

This is an aside, but I feel relevant. If you intend to stay in the programming industry for the long haul: developing a thick skin and being able to divorce your ego from your code will be essential skills. Any comments people may make about your code is not a comment about you as person. It's just simply an opinion or perspective about the code. I recall many years ago, we had hired a brilliant young man who had done 2 internships at Apple and one at IBM. Unfortunately, also his projects in his internships were standalone prototype projects with nothing planned for production use. When we did his first team code review for a new feature we had him work on, he left the conference room and went home in tears about an hour into our planned 2 hour meeting. His new-hire mentor had to go to his home and explain that nothing in the code reviews were meant to be about him. It was simply just attempts to raise the quality of the code to get it ready to ship.
 
@Skydiver, fair points. I have seen a lot of people act as though criticism of their programming is a personal attack. "I'm a beginner" they cry, as though that should somehow shield them from criticism. No, you're a beginner so you write crap code so you need to be criticised so you know what you're doing wrong so you can get better. We all wrote crap code when we were beginners and we also know what it takes to get better. Having people write code that you can copy and paste sure is easier but and you can learn something from it but you learn far more by having your own code critiqued so that you can understand what you are doing wrong so you can avoid doing similar things again. Learning what not to do is just as important as learning what to do and copying other people's code can only go so far in teaching that.
 
Back
Top Bottom