• Hello and welcome to our new forums. We upgraded our forum sites to a more robust and modern system which we hope you will enjoy. Be sure to check out your profile by clicking the button on the top right and configure your preferences, signature, time zone, avatar, etc. as you wish. If you need help with using this new forum'ware try the help link on the bottom right.

    Click here to review your account now.

Search results

  1. J

    Question how to provide resize feature based on the mouse wheel up and down to a shape on the picture box

    If you wanted to be able to scale multiple shapes separately then you'd have to store separate scale values for each shape and only modify the right one in the MouseWheel event handler, then create a new Matrix with the appropriate translation and scale before drawing each shape.
  2. J

    Question how to provide resize feature based on the mouse wheel up and down to a shape on the picture box

    Just note that the code above still scales the entire canvas so, if you're drawing multiple shapes, the others would still move. If you want to be able to scale multiple shapes without moving then you need to translate the origin prior to drawing each shape and then draw each one at the origin...
  3. J

    Question how to provide resize feature based on the mouse wheel up and down to a shape on the picture box

    You're not just scaling the rectangle but the entire canvas. That code draws the top, left corner at 10 pixels below and 10 pixels right of the origin so those values will also be scaled. If you don't want the top, left corner of the rectangle to move when the canvas is scaled then you have to...
  4. J

    Extra rows when exporting Datagridview to .csv

    Even if you use Write instead of WriteLine, you are still writing a line break at the end of each record, so your file will still have an empty line at the end. That's not really a problem because any CSV reader worth its salt will correctly read that as the end of the data and not add a blank...
  5. J

    Extra rows when exporting Datagridview to .csv

    You are calling AppendLine when you create the StringBuilder and then you call WriteLine when writing to the file. Why do you need to write a line break to the file if you have already written line breaks into the text?
  6. J

    Question how to provide resize feature based on the mouse wheel up and down to a shape on the picture box

    This is the sort of thing you want: private float scale = 1.0F; private void Form1_Load(object sender, EventArgs e) { pictureBox1.MouseWheel += PictureBox1_MouseWheel; pictureBox1.Paint += PictureBox1_Paint; } private void PictureBox1_MouseWheel(object sender, MouseEventArgs e) {...
  7. J

    Converting C to C#, handling lack of local static vars

    That seems reasonable to me.
  8. J

    Sort an array

    Oops! I made a mistake in that code. I should have compared result to 0 rather than 1. I have corrected my previous post.
  9. J

    Sort an array

    The Array.Sort method is overloaded and allows you to sort arrays in various ways. The simplest way to do an ad hoc sort as you describe is by calling the overload that takes a Comparison<T> delegate: Point[] points; // ... Array.Sort(points, (p1, p2) => { var result =...
  10. J

    Simplify the creation of events and their call

    I think that you're asking a question but I'm not sure. Firstly, you don't need to define your own delegate. You either use the EventHandler delegate if your event requires no data or the EventHandler<TEventArgs> if your event does require data. public event EventHandler EventWithoutData...
  11. J

    Referencing Dynamic Control Array Data

    We've all been there. :cautious:
  12. J

    Referencing Dynamic Control Array Data

    That's because, when you index the Controls property, you get a Control reference back and the Control class has no ImageIndex property. That property is a member of ButtonBase so, if you are referring to controls that have that property, you need to cast them as an appropriate type to be able...
  13. J

    Referencing Dynamic Control Array Data

    If you can't determine the index of the current image then how are you changing which image is displayed when you click a Button?
  14. J

    Basic AF programmer needs help.

    I've provided guidance on what you should do with regards to inheritance. Follow those instructions first and then, if there's an issue with that implementation, I can help further.
  15. J

    Question Color

    A String has no colour so you will need to store the colour along with the text somehow and then, whenever you display a text value, you do so using the associated colour. For instance, you might define a class with a property of type String and another of type ConsoleColor and store instances...
  16. J

    Question Color

    You're going to have to be more specific. Are you simply saying that you want to display the next text you write to the console in a particular colour or you want a specific element in an array to always be displayed in a specific colour?
  17. J

    No error

    Also, don't call Main recursively like that. As it stands, that application will never exit.
  18. J

    No error

    Look into the TryParse method of the appropriate numeric type. Such methods validate and convert without throwing exceptions on failure.
  19. J

    Question Code error

    Perhaps you could tell us what you think and why and we can see whether we agree.
  20. J

    Basic AF programmer needs help.

    If you are supposed to inherit a class then you need a class to inherit. Without more specific guidance, it sounds like you need a Vehicle class with a Horsepower property and a GetTopSpeed method or read-only TopSpeed property that uses the value of the Horsepower property in its calculation...
Top Bottom