CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3
  1. #1
    Join Date
    Sep 2010
    Posts
    6

    Small Help with assignment

    Hey, I'm not sure if its against the rules asking for help with assignments and if it is then I'm sorry and you may delete this. I am nearly done with my assignment. I finished the hardest parts but I am stuck on two little bits.

    The assignment is to make a image editing application. It has to be very basic. I did all the colour correction sections but I don't know how to crop the image or clear it without using a picture box. I have uploaded my assignment, if someone can have a look and tell me what I missed. Any help is greatly appreciated
    Attached Files Attached Files
    Last edited by dr_goose91; May 18th, 2011 at 05:58 AM.

  2. #2
    Join Date
    Feb 2011
    Location
    United States
    Posts
    1,016

    Re: Small Help with assignment

    Hi,

    I didn't actually look at your source, but in terms of cropping, you might want to look at:

    Code:
    Bitmap sourceBmp = //Whatever
    Bitmap croppedBmp = new Bitmap(cropWidth, cropHeight);
    Graphics g = Graphics.FromImage(croppedBmp);
    
    g.DrawImage(sourceBmp, -cropLeft, -cropTop, cropWidth, cropHeight);
    
    g.Flush();
    g.Dispose();
    Where cropLeft and cropTop are the coordinates of the left and top crop region and cropWidth and cropHeight are the width and height of the crop region.
    Best Regards,

    BioPhysEngr
    http://blog.biophysengr.net
    --
    All advice is offered in good faith only. You are ultimately responsible for effects of your programs and the integrity of the machines they run on.

  3. #3
    Join Date
    Feb 2011
    Location
    United States
    Posts
    1,016

    Re: Small Help with assignment

    Oh, also I should remark: thanks for mentioning it was an assignment. You're free to ask for help here, but usually we want to see you have worked on it yourself and gotten stuck (sounds like your case).

    Most typically, it's easiest for us to help you if you show us the relevant code sections that you are having trouble with directly in the message (you can enclose them with [code] and [/code] tags so that the formatting looks nice). Most posters (I think) will not take the time to open up attached code files to look at them.

    Welcome to the forum.
    Best Regards,

    BioPhysEngr
    http://blog.biophysengr.net
    --
    All advice is offered in good faith only. You are ultimately responsible for effects of your programs and the integrity of the machines they run on.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured