Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

Hi all,

 

Is it possible to create a new .jpg file from 2 colors that a user selects in a WinForms app?

 

What I want to do is give the user an option to select 2 colors using a colorpicker. When they click "save", I want to create a new 1px wide by 1050px high gradient style image to be used as a webpage background, and save it so that it can be uploaded to a web server via FTP. The uploading I can handle, but I need to know if there's a way to create the image file.

 

Thanks in advance,

 

-Chris

if(computer.speed == "slow")
    {  
       hamster.feed();  
    }
if(computer.speed == "really slow")
    {  
        hamster.kill();
        BuyNewHamster();
    }

  • Administrators
Posted

The following should get you started

          LinearGradientBrush b = new LinearGradientBrush(new Rectangle(0,0,100,100),Color.Red, Color.Blue, 45f );
           Bitmap bmp = new Bitmap(100,100);
           Graphics g = Graphics.FromImage(bmp);
           g.FillRectangle(b,0,0,100,100);
           bmp.Save("c:\\test.bmp");

Posting Guidelines FAQ Post Formatting

 

Intellectuals solve problems; geniuses prevent them.

-- Albert Einstein

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...