Click here to Skip to main content
15,919,879 members
Home / Discussions / C#
   

C#

 
Questionretrieving a command button property strored from the database Pin
Cagalli17-Mar-06 19:34
Cagalli17-Mar-06 19:34 
QuestionStrategy Issue, Please Help Pin
student_rhr17-Mar-06 18:12
student_rhr17-Mar-06 18:12 
AnswerRe: Strategy Issue, Please Help Pin
leppie17-Mar-06 22:23
leppie17-Mar-06 22:23 
GeneralRe: Strategy Issue, Please Help Pin
student_rhr18-Mar-06 8:58
student_rhr18-Mar-06 8:58 
QuestionGDI+, resize image QUALITY! Pin
knoppis17-Mar-06 14:09
knoppis17-Mar-06 14:09 
AnswerRe: GDI+, resize image QUALITY! Pin
leppie17-Mar-06 14:39
leppie17-Mar-06 14:39 
AnswerRe: GDI+, resize image QUALITY! Pin
Nicholas Butler18-Mar-06 1:18
sitebuilderNicholas Butler18-Mar-06 1:18 
GeneralRe: GDI+, resize image QUALITY! Pin
knoppis18-Mar-06 4:24
knoppis18-Mar-06 4:24 
<br />
<br />
	public static ImageCodecInfo GetImageCodecInfo(ImageFormat format)<br />
	{<br />
		ImageCodecInfo[] codecs = ImageCodecInfo.GetImageEncoders();<br />
		foreach(ImageCodecInfo codec in codecs)<br />
		{<br />
			if(codec.FormatID == format.Guid)<br />
			{<br />
				return codec;<br />
				return null;<br />
			}<br />
		}<br />
	}<br />
<br />
	void makeThumbnail()<br />
	{<br />
		System.Drawing.Image image = System.Drawing.Image.FromFile("C:\\Inetpub\\wwwroot\\heli.jpg");<br />
		Bitmap canvas = new Bitmap(200, 283, image.PixelFormat);<br />
<br />
		Graphics g = Graphics.FromImage(canvas);<br />
<br />
		g.DrawImage(image, 0, 0, 200, 283);<br />
<br />
		int quality = 90;<br />
		EncoderParameters parameters = new EncoderParameters(1);<br />
		parameters.Param[0] = new EncoderParameter(System.Drawing.Imaging.Encoder.Quality, quality);<br />
<br />
		ImageCodecInfo codec = GetImageCodecInfo(ImageFormat.Jpeg);<br />
		canvas.Save("C:\\Inetpub\\wwwroot\\1.jpg", codec, parameters);<br />
<br />
		image.Dispose();<br />
		canvas.Dispose();<br />
	}<br />
<br />


Gives the following error:

Compiler Error Message: CS0161: 'ASP.image_aspx.GetImageCodecInfo(System.Drawing.Imaging.ImageFormat)': not all code paths return a value

On line:

<br />
public static ImageCodecInfo GetImageCodecInfo(ImageFormat format)<br />


-- modified at 10:29 Saturday 18th March, 2006
AnswerRe: GDI+, resize image QUALITY! Pin
Nicholas Butler18-Mar-06 4:33
sitebuilderNicholas Butler18-Mar-06 4:33 
GeneralRe: GDI+, resize image QUALITY! Pin
knoppis18-Mar-06 4:36
knoppis18-Mar-06 4:36 
AnswerRe: GDI+, resize image QUALITY! Pin
Nicholas Butler18-Mar-06 4:40
sitebuilderNicholas Butler18-Mar-06 4:40 
GeneralRe: GDI+, resize image QUALITY! Pin
knoppis18-Mar-06 4:42
knoppis18-Mar-06 4:42 
GeneralRe: GDI+, resize image QUALITY! Pin
knoppis18-Mar-06 4:45
knoppis18-Mar-06 4:45 
QuestionRe: GDI+, resize image QUALITY! Pin
Nicholas Butler18-Mar-06 4:55
sitebuilderNicholas Butler18-Mar-06 4:55 
AnswerRe: GDI+, resize image QUALITY! Pin
knoppis18-Mar-06 5:21
knoppis18-Mar-06 5:21 
AnswerRe: GDI+, resize image QUALITY! Pin
Robert Rohde18-Mar-06 6:07
Robert Rohde18-Mar-06 6:07 
QuestionConnecting to DB2 in C# Pin
jjm40017-Mar-06 11:40
jjm40017-Mar-06 11:40 
AnswerRe: Connecting to DB2 in C# Pin
Mike Dimmick17-Mar-06 13:57
Mike Dimmick17-Mar-06 13:57 
QuestionRe: Connecting to DB2 in C# Pin
jjm40020-Mar-06 3:09
jjm40020-Mar-06 3:09 
QuestionDataview question Pin
Tom Wright17-Mar-06 10:36
Tom Wright17-Mar-06 10:36 
AnswerRe: Dataview question Pin
Tom Larsen17-Mar-06 10:43
Tom Larsen17-Mar-06 10:43 
GeneralRe: Dataview question Pin
Tom Wright17-Mar-06 10:47
Tom Wright17-Mar-06 10:47 
GeneralRe: Dataview question Pin
Tom Wright17-Mar-06 11:04
Tom Wright17-Mar-06 11:04 
Questionplease help C#.NET 2003 Pin
ap_sa17-Mar-06 10:11
ap_sa17-Mar-06 10:11 
AnswerRe: please help C#.NET 2003 Pin
Christian Graus17-Mar-06 10:13
protectorChristian Graus17-Mar-06 10:13 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.