Click here to Skip to main content
15,909,030 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
I want to change these two lines of code in wpf,can anybody help me on this?
C#
LinearGradientBrush b = new LinearGradientBrush(new RectangleGeometry(0, 0, bmpout.Width, bmpout.Height / 6F), color1, color2, LinearGradientMode.Vertical);


C#
g.FillRectangle(b2, new Rectangle(0, Convert.ToInt32((double)bmp.Height / 6.0), bmp.Width, Convert.ToInt32((double)bmp.Height / 6.0)));
Posted
Comments
Sandeep Mewara 6-Jun-12 6:54am    
Why? What to?
SASS_Shooter 6-Jun-12 15:29pm    
These two lines of code are not even related. You create one gradient brush that fills a rectangle and the other fills a rectangle but with a completely different brush. Both do the job. Why change? What are you planning on changing these to and why?
Sandeep Mewara 7-Jun-12 2:18am    
Comment form OP:
I'm converting a winform app into wpf,so i need the alternative to these.
SASS_Shooter 7-Jun-12 18:00pm    
The reason for all of the questions is the answer changes dramatically based on what you use if for. For example, if this is just the background of the form, then you just set the gradient brush in the background property. And if you have Blend, it is even easier and more flexible. Also you can do a styling for almost any form and implement a form of gradient brush without the need for creating a rectangle.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900