<?xml version="1.0" encoding="utf-8"?>

<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/">
	<channel>
		<title>DaniWeb IT Discussion Community</title>
		<link>http://www.daniweb.com/forums/</link>
		<description>Tech support, programming, web development, and internet marketing community. Forums to get free computer help and support.</description>
		<language>en-US</language>
		<lastBuildDate>Mon, 21 Dec 2009 23:42:20 GMT</lastBuildDate>
		<generator>vBulletin</generator>
		<ttl>60</ttl>
		<image>
			<url>http://www.daniweb.com/alphaimages/misc/rss.jpg</url>
			<title>DaniWeb IT Discussion Community</title>
			<link>http://www.daniweb.com/forums/</link>
		</image>
		<item>
			<title>Problem applying multipile color transformations on an image.</title>
			<link>http://www.daniweb.com/forums/thread247829.html</link>
			<pubDate>Sun, 20 Dec 2009 15:30:24 GMT</pubDate>
			<description>if you have ever used adobe lightroom you would have noticed that there is an awesome sidebar with 15 or so sliders on it. they can all be adjusted from the same screen and you watch as they edit the image in real time. This is what I am trying to replicate. and here is where my problem lies... 
...</description>
			<content:encoded><![CDATA[<div>if you have ever used adobe lightroom you would have noticed that there is an awesome sidebar with 15 or so sliders on it. they can all be adjusted from the same screen and you watch as they edit the image in real time. This is what I am trying to replicate. and here is where my problem lies...<br />
<br />
I have written some methods that apply color matrices to an image and return that transformed image. works great. i can put a slider on drag the tick and watch the brightness change ect. but in order for the transformation to be accurate, I must always pass the source image to each one. not the edited image. let me elaborate.<br />
<br />
say I increase the brightness and contrast of an image using a complicated color matrix. but now i want to increase the saturation a bit, so i pass the new adjusted image into my hsl class and return a new image, now the image has been changed twice. If I feel like the image is too bright, and I want to move the brighness slider down. I the value assigned to the slider will be wrong, and its effects not accurate using the newly edited image, I must use the original image. so that means I must store and reapply the saturation values, but this means, given all the adjustments my final program will be using will have to be applied every time, this will be sluggish, and not a instant preview like lightroom provides.<br />
<br />
Is there something I am missing? Am I going about his wrong?<br />
<br />
I don't want it to be like photoshop, where a change is permanent. I want the lightroom type experience where everything can be changed and reset easily.</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum61.html">C#</category>
			<dc:creator>Diamonddrake</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread247829.html</guid>
		</item>
		<item>
			<title>Image Manipulation tricks?</title>
			<link>http://www.daniweb.com/forums/thread247049.html</link>
			<pubDate>Thu, 17 Dec 2009 04:49:09 GMT</pubDate>
			<description>I am working on a little image program aimed at having a simple interface but a strong backend. Its mostly just for basic bulk settings and looping through files. but will allow for all the images to be loaded in a thumbnail strip and be able to be edited before all the actual work happens. 
...</description>
			<content:encoded><![CDATA[<div>I am working on a little image program aimed at having a simple interface but a strong backend. Its mostly just for basic bulk settings and looping through files. but will allow for all the images to be loaded in a thumbnail strip and be able to be edited before all the actual work happens.<br />
<br />
that's the setting, here's the question. Anyone have any interesting image manipulation snippets laying around? I'm not sure what all I am interested in seeing it do. I just know I want it to do more. It currently crops, flips horizontal and vertical, adjusts hue saturation and luminance and rotates.<br />
<br />
I'm thinking maybe some white balance stuff or really any kind of suggestion or code snippet. I just want more options, I'm thinking about maybe a plug ins interface. but basic filter or image tricks would be nice for now.<br />
<br />
Thanks!</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum61.html">C#</category>
			<dc:creator>Diamonddrake</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread247049.html</guid>
		</item>
		<item>
			<title>Posting data to an asp page from a winforms app.</title>
			<link>http://www.daniweb.com/forums/thread246163.html</link>
			<pubDate>Mon, 14 Dec 2009 04:14:21 GMT</pubDate>
			<description><![CDATA[I am able to post data to a form so long as its strings. by creating a dictinary of keys and values, then creating a string in the style of key+ "=" + value "+ & repeat. then passing it to a method kinda like  
 
  <div class="codeblock"> <div class="spaced"> <div style="float:right;...]]></description>
			<content:encoded><![CDATA[<div>I am able to post data to a form so long as its strings. by creating a dictinary of keys and values, then creating a string in the style of key+ &quot;=&quot; + value &quot;+ &amp; repeat. then passing it to a method kinda like <br />
<br />
 <pre style="margin:20px; line-height:13px"><br />
private string PostData(string url, string postData)<br />
{<br />
HttpWebRequest request=null;<br />
<br />
Uri uri = new Uri(url);<br />
request = (HttpWebRequest) WebRequest.Create(uri);<br />
request.Method = &quot;POST&quot;;<br />
request.ContentType = &quot;application/x-www-form-urlencoded&quot;;<br />
request.ContentLength = postData.Length;<br />
using(Stream writeStream = request.GetRequestStream())<br />
{<br />
UTF8Encoding encoding = new UTF8Encoding();<br />
byte[] bytes = encoding.GetBytes(postData);<br />
writeStream.Write(bytes, 0, bytes.Length);<br />
}<br />
<br />
string result=string.Empty;<br />
using (HttpWebResponse response = (HttpWebResponse) request.GetResponse())<br />
{<br />
using (Stream responseStream = response.GetResponseStream())<br />
{<br />
using (StreamReader readStream = new StreamReader (responseStream, Encoding.UTF8))<br />
{<br />
result = readStream.ReadToEnd();<br />
}<br />
}<br />
}<br />
return result;</pre><br />
but this doesn't work for files.<br />
<br />
I am working on an application that is going to make it DIRT simple for  my friends and family to quickly edit, crop, resize, and optimize for email, pictures from a digital camera. then using my web server for my website, so the users don't have to worry about smtp server stuff, the app will automatically zip and email the pictures just by specifying the address to send it to.<br />
<br />
i have finished a asp file that will accept a multipart form's post data. automatically uploading any &quot;file&quot; type data to a temp diretory, and then emailing the files to the email address sent to it. then deleting the temp data. It works great so long as I use a simple form and let the browser handle the post. but I can't seem to figure out how to do it in my C# application.<br />
<br />
If anyone could help me out with how this is done i would appreciate it. Google isn't cooperating with me today.</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum61.html">C#</category>
			<dc:creator>Diamonddrake</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread246163.html</guid>
		</item>
		<item>
			<title>Moving a selection rectangle, keeping it on the image</title>
			<link>http://www.daniweb.com/forums/thread244199.html</link>
			<pubDate>Sun, 06 Dec 2009 22:29:03 GMT</pubDate>
			<description><![CDATA[I am working on a picturebox that adds a in-depth cropping feature, I am a centered junkie, that is to say I don't find left justified images aesthetically pleasing. I just have to have everything centered. Add to this that the zoom mode of the picture box ensures that the image will be show in its...]]></description>
			<content:encoded><![CDATA[<div>I am working on a picturebox that adds a in-depth cropping feature, I am a centered junkie, that is to say I don't find left justified images aesthetically pleasing. I just have to have everything centered. Add to this that the zoom mode of the picture box ensures that the image will be show in its entirety and be centered. I can't pass that up.<br />
<br />
I have worked it out to perform a simple drag and drop selection rectangle system. Once the rectangle it drawn you can resize it by simply clicking on a edge of the rectangle and dragging it.  If you click on the center of the rectangle you can move the entire rectangle.<br />
<br />
My problem is that if you move the rectangle you can drag it off the image, I would like it to stop once the rectangle reaches the edge. I have worked out a way to do this, but it is really buggy and over all just doesn't work right. below is an excerpt showing how I am doing it. if anyone show me whats wrong, or help me find another method I would appreciate it.<br />
<br />
 <pre style="margin:20px; line-height:13px">//some vars<br />
&nbsp; &nbsp; &nbsp; &nbsp; bool m_mover = false;<br />
&nbsp; &nbsp; &nbsp; &nbsp; Size m_mover_size;<br />
&nbsp; &nbsp; &nbsp; &nbsp; Point m_distance;<br />
<br />
<br />
//mouse down event handler<br />
Rectangle mini = new Rectangle(selection.Location.X + 4, selection.Location.Y + 4, selection.Width - 8, selection.Height - 8);<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if (mini.Contains(e.Location))<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; m_mover = true;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; m_distance = new Point(e.Location.X - selection.Location.X, e.Location.Y - selection.Location.Y);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; m_mover_size = new Size(selection.Width, selection.Height);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
<br />
<br />
// THIS IS THE ON MOUSE MOVE event handler<br />
if(m_mover)<br />
{<br />
&nbsp;else if (this.SizeMode == PictureBoxSizeMode.Zoom)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Point rectloc = e.Location;<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  if((e.Location.X - m_distance.X) &lt; ConvertToZoomed(new Point(0,0)).X)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  rectloc.X = ConvertToZoomed(new Point(0, 0)).X;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  else if (((e.Location.X - m_distance.X) + m_mover_size.Width) &gt;= ConvertToZoomed(new Point(Image.Width, 0)).X)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  int rectWidth = m_mover_size.Width;<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  float num = Math.Min((float)(((float)this.ClientRectangle.Width) / ((float)Image.Width)), (float)(((float)this.ClientRectangle.Height) / ((float)Image.Height)));<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  rectWidth = (int)((rectWidth+1) / num);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  //rectHeight = (int)(rect.Height / num);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  rectloc.X = ConvertToZoomed(new Point(Image.Width - rectWidth, 0)).X;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  else<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  rectloc.X = e.Location.X - m_distance.X;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  }<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  if ((e.Location.Y - m_distance.Y) &lt; ConvertToZoomed(new Point(0, 0)).Y)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  rectloc.Y = ConvertToZoomed(new Point(0, 0)).Y;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  else if (((e.Location.Y - m_distance.Y) + m_mover_size.Height) &gt;= ConvertToZoomed(new Point(0, Image.Height)).Y)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  int rectHeight = m_mover_size.Height;<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  float num = Math.Min((float)(((float)this.ClientRectangle.Width) / ((float)Image.Width)), (float)(((float)this.ClientRectangle.Height) / ((float)Image.Height)));<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  //rectWidth = (int)((rectWidth + 1) / num);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  rectHeight = (int)((rectHeight + 1) / num);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  rectloc.Y = ConvertToZoomed(new Point(0, Image.Height - rectHeight)).Y;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  else<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  rectloc.Y = e.Location.Y - m_distance.X;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  }<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  selection = new Rectangle(rectloc.X, rectloc.Y, m_mover_size.Width, m_mover_size.Height);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //save the start point<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; m_Start = selection.Location;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //save the intermediate point<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; m_droploc = new Point(selection.Location.X + selection.Width, selection.Location.Y + selection.Height);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //Update selection<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //m_distance = new Point(e.Location.X - selection.Location.X, e.Location.Y - selection.Location.Y);<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; this.Invalidate();<br />
}<br />
<br />
// here are the methods used in the above calculations most of it is modified versions of coded provided by Ryshad<br />
<br />
&nbsp; &nbsp; &nbsp;  private Point ConvertPointToImage(Point clicked)<br />
&nbsp; &nbsp; &nbsp;  {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  if (this.SizeMode != PictureBoxSizeMode.Zoom)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  return clicked;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  //get size of original image<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  Size size = this.Image.Size;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  //get value of scale<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  float num = Math.Min((float)(((float)ClientRectangle.Width) / ((float)size.Width)), (float)(((float)ClientRectangle.Height) / ((float)size.Height)));<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  //scale size to calculate translation<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  size.Width = (int)(size.Width * num);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  size.Height = (int)(size.Height * num);<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  //reverse translation<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  clicked.X -= (ClientRectangle.Width - size.Width) / 2;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  clicked.Y -= (ClientRectangle.Height - size.Height) / 2;<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  //reverse scale<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  clicked.X = (int)(clicked.X / num);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  clicked.Y = (int)(clicked.Y / num);<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  //return image coordinates<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  return clicked;<br />
&nbsp; &nbsp; &nbsp;  }<br />
<br />
&nbsp; &nbsp; &nbsp;  private Rectangle ConvertRectangleToImage(Rectangle clicked)<br />
&nbsp; &nbsp; &nbsp;  {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  if (this.SizeMode != PictureBoxSizeMode.Zoom)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  return clicked;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  //get size of original image<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  Size size = this.Image.Size;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  //get value of scale<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  float num = Math.Min((float)(((float)ClientRectangle.Width) / ((float)size.Width)), (float)(((float)ClientRectangle.Height) / ((float)size.Height)));<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  //scale size to calculate translation<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  size.Width = (int)(size.Width * num);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  size.Height = (int)(size.Height * num);<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  //reverse translation<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  clicked.X -= (ClientRectangle.Width - size.Width) / 2;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  clicked.Y -= (ClientRectangle.Height - size.Height) / 2;<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  //reverse scale<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  clicked.X = (int)(clicked.X / num);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  clicked.Y = (int)(clicked.Y / num);<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  clicked.Width = (int)(clicked.Width / num);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  clicked.Height = (int)(clicked.Height / num);<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  //return image coordinates<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  return clicked;<br />
&nbsp; &nbsp; &nbsp;  }<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; // image coordinates to zoomed methods<br />
<br />
&nbsp; &nbsp; &nbsp;  private Point ConvertToZoomed(Point image)<br />
&nbsp; &nbsp; &nbsp;  {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  //get size of original image<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  Size size = this.Image.Size;<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  //get value of scale<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  float num = Math.Min((float)(((float)ClientRectangle.Width) / ((float)size.Width)), (float)(((float)ClientRectangle.Height) / ((float)size.Height)));<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  //scale size to calculate translation<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  size.Width = (int)(size.Width * num);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  size.Height = (int)(size.Height * num);<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  //apply scale to Point<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  image.X = (int)(image.X * num);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  image.Y = (int)(image.Y * num);<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  //apply translation to Point<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  image.X += (ClientRectangle.Width - size.Width) / 2;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  image.Y += (ClientRectangle.Height - size.Height) / 2;<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  //return Zoomed Point<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  return image;<br />
<br />
&nbsp; &nbsp; &nbsp;  }<br />
<br />
&nbsp; &nbsp; &nbsp;  private Rectangle ConvertToZoomed(Rectangle selection)<br />
&nbsp; &nbsp; &nbsp;  {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  //get size of original image<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  Size size = this.Image.Size;<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  //get value of scale<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  float num = Math.Min((float)(((float)ClientRectangle.Width) / ((float)size.Width)), (float)(((float)ClientRectangle.Height) / ((float)size.Height)));<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  //scale size to calculate translation<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  size.Width = (int)(size.Width * num);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  size.Height = (int)(size.Height * num);<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  //apply scale to Selection<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  selection.X = (int)(selection.X * num);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  selection.Y = (int)(selection.Y * num);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  selection.Width = (int)(selection.Width * num);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  selection.Height = (int)(selection.Height * num);<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  //apply translation to Selection<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  selection.X += (ClientRectangle.Width - size.Width) / 2;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  selection.Y += (ClientRectangle.Height - size.Height) / 2;<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  //return Zoomed Selection<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  return selection;<br />
<br />
&nbsp; &nbsp; &nbsp;  }</pre></div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum61.html">C#</category>
			<dc:creator>Diamonddrake</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread244199.html</guid>
		</item>
		<item>
			<title>Point to Client type problem...</title>
			<link>http://www.daniweb.com/forums/thread242938.html</link>
			<pubDate>Wed, 02 Dec 2009 04:47:01 GMT</pubDate>
			<description><![CDATA[I need to be able to take a point on an image and convert it into a point relative to a picturebox with the pictureSizeMode set to zoom 
 
here is the code that the picturebox uses to scale and center the image 
 
  <div class="codeblock"> <div class="spaced"> <div style="float:right;...]]></description>
			<content:encoded><![CDATA[<div>I need to be able to take a point on an image and convert it into a point relative to a picturebox with the pictureSizeMode set to zoom<br />
<br />
here is the code that the picturebox uses to scale and center the image<br />
<br />
 <pre style="margin:20px; line-height:13px"> Size size = this.image.Size;<br />
&nbsp;float num = Math.Min((float)(((float)base.ClientRectangle.Width) / ((float)size.Width)), (float)(((float)base.ClientRectangle.Height) / ((float)size.Height)));<br />
&nbsp;rectangle.Width = (int)(size.Width * num);<br />
rectangle.Height = (int)(size.Height * num);<br />
rectangle.X = (base.ClientRectangle.Width - rectangle.Width) / 2;<br />
&nbsp;rectangle.Y = (base.ClientRectangle.Height - rectangle.Height) / 2;<br />
return rectangle;</pre><br />
I realize this returns a rectangle, but I need it to accept a point for example 0,0 on an image, if the image was tall it would be scaled by height so the the Y would stay 0 but if the image was say 359px wide and the picuture box was 417 pixles wide the point would go from 0,0 to 35,0.<br />
<br />
I can get it to work so long as I use 0,0 but if I need other points I cant seem to make it happen. I'm not very good a geometry.<br />
<br />
Any help would be appreciated.</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum61.html">C#</category>
			<dc:creator>Diamonddrake</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread242938.html</guid>
		</item>
		<item>
			<title>Translating rectangles of sorts.</title>
			<link>http://www.daniweb.com/forums/thread242857.html</link>
			<pubDate>Tue, 01 Dec 2009 20:48:41 GMT</pubDate>
			<description><![CDATA[I have inherited from a picturebox and modified it to allow a selection rectangle to be drawn. Everything works well, except I would like for it to work in all sizeModes. center is simple, normal is simple. but I cant' seem to get "Zoom" to work. I have used reflector to strip the out the code that...]]></description>
			<content:encoded><![CDATA[<div>I have inherited from a picturebox and modified it to allow a selection rectangle to be drawn. Everything works well, except I would like for it to work in all sizeModes. center is simple, normal is simple. but I cant' seem to get &quot;Zoom&quot; to work. I have used reflector to strip the out the code that is responsible for the zoom rectangle in the picturebox. Its simple, it just devides the client width by the image width and the client height by the image high and gets the smaller value and scales by that.<br />
<br />
When I try to do this with my rectangle I don't get the correct size,<br />
<br />
I'm not the best at math, especially geometry. but this seems like it should be more simple.<br />
<br />
The image is centered in the control, and scaled to fit. I draw a rectangle on the control representing a crop region. the rectangle then needs to be translated to the acutall image coordinates. I found a codeproject site that translates points. but It seems to be off, and I can't seem to get the size of the rectangle right.<br />
<br />
Any help would be appreciated.</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum61.html">C#</category>
			<dc:creator>Diamonddrake</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread242857.html</guid>
		</item>
		<item>
			<title>Help needed testing a patch</title>
			<link>http://www.daniweb.com/forums/thread240563.html</link>
			<pubDate>Mon, 23 Nov 2009 02:52:44 GMT</pubDate>
			<description>When I installed windows 7 I opted to do a fresh clean install, but the key I purchased was an upgrade key and required that I performed an upgrade. The disk itself was bootable so I performed a clean install and modified some registry keys and ran a vb script in the system32 folder and this...</description>
			<content:encoded><![CDATA[<div>When I installed windows 7 I opted to do a fresh clean install, but the key I purchased was an upgrade key and required that I performed an upgrade. The disk itself was bootable so I performed a clean install and modified some registry keys and ran a vb script in the system32 folder and this enabled me to enter my upgrade key to activate window even though the system knew I performed a clean install.<br />
<br />
This isn't illegal, Its just a workaround. Since I had a legal copy of windows to upgrade from, I didn't break the EULA. I decided to automate this by writing a little application that applies the patch automatically. I am 90% sure it works, but I can't test it. So if anyone out there is about to install windows 7 with a clean install from an upgrade key. Please try out my patch and tell me if it works!<br />
<br />
Thanks.</div>  <br /> <div style="padding:5px">     <fieldset class="fieldset"> <legend>Attached Files</legend> <table cellpadding="0" cellspacing="5" border="0"> <tr> <td><img class="inlineimg" src="http://www.daniweb.com/forums/images/attach/zip.gif" alt="File Type: zip" width="16" height="16" border="0" style="vertical-align:baseline" /></td> <td><a href="http://www.daniweb.com/forums/attachment.php?attachmentid=12683&amp;d=1258944741">win7UpgradeKeyEnabler.zip</a> (19.3 KB)</td> </tr> </table> </fieldset>  </div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum61.html">C#</category>
			<dc:creator>Diamonddrake</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread240563.html</guid>
		</item>
		<item>
			<title>understanding threading and calling methods</title>
			<link>http://www.daniweb.com/forums/thread232794.html</link>
			<pubDate>Sat, 24 Oct 2009 03:39:16 GMT</pubDate>
			<description><![CDATA[I have a class that in one of its methods creates a new thread that makes some http requests, serializes the results, packs them up in an event object and then it Should call broadcast an event returning its data. but I can't figure out how. 
 
the class is not a form, so it doesn't have the invoke...]]></description>
			<content:encoded><![CDATA[<div>I have a class that in one of its methods creates a new thread that makes some http requests, serializes the results, packs them up in an event object and then it Should call broadcast an event returning its data. but I can't figure out how.<br />
<br />
the class is not a form, so it doesn't have the invoke method, and I need to pass data back to the class. I'm stuck on this.<br />
<br />
here is a stripped down version<br />
<br />
 <pre style="margin:20px; line-height:13px">class someclass<br />
{<br />
&nbsp; &nbsp; &nbsp;  public someclass()<br />
&nbsp; &nbsp; &nbsp; {<br />
<br />
&nbsp; &nbsp; &nbsp;  }<br />
//my event<br />
&nbsp; &nbsp;  public delegate void onTimelineHandler(object sender ,TimelineArgs e);<br />
&nbsp; &nbsp;  public event onTimelineHandler OnTimelineRecieved;<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; private void TimelineAsyncStart(string url)<br />
&nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Thread myAsyncer = new Thread(new ParameterizedThreadStart(doTimelineAsync));<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; string[] objar = new string[] { url, username, password };<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; myAsyncer.Start(objar);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; }<br />
<br />
&nbsp;private void doTimelineAsync(object objar)<br />
&nbsp; &nbsp; &nbsp; &nbsp; {<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; string[] sa2 = (string[])objar;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; string url = sa2[0];<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; string username = sa2[1];<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; string password = sa2[2];<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //some stuff happens here<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  TimelineArgs targs = new TimelineArgs(myobject);<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="font-weight:bold">//here I need to call the event on the class that created&nbsp; &nbsp; this thread, passing to that event the TImelineArgs object.</span><br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; }<br />
<br />
<br />
]</pre><br />
I could really use some help on this, threading is not my things, I learned using background worker, guess I could have done that here, but really i would like to know how this is done.</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum61.html">C#</category>
			<dc:creator>Diamonddrake</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread232794.html</guid>
		</item>
		<item>
			<title>Code Snippet check if a Yahoo! IM user is online</title>
			<link>http://www.daniweb.com/code/snippet231466.html</link>
			<pubDate>Mon, 19 Oct 2009 19:46:24 GMT</pubDate>
			<description>This simple static class contains a static method called sOnline that accepts a username as a string param. it make a call to an old yahoo api that will determine if a Y! user is online. This only returns true if the user is not using stealth, this will return false if a user is online but...</description>
			<content:encoded><![CDATA[<div>This simple static class contains a static method called sOnline that accepts a username as a string param. it make a call to an old yahoo api that will determine if a Y! user is online. This only returns true if the user is not using stealth, this will return false if a user is online but &quot;invisible&quot;<br />
<br />
I'm not sure what enticed me to write this class. but I guess it was a fun 4 minutes anyway. :) hope someone finds use for it.</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum61.html">C#</category>
			<dc:creator>Diamonddrake</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread231466.html</guid>
		</item>
		<item>
			<title>Getting a dynamic IP address</title>
			<link>http://www.daniweb.com/forums/thread229248.html</link>
			<pubDate>Sun, 11 Oct 2009 07:13:04 GMT</pubDate>
			<description><![CDATA[I have been working with desktop server/client applications today, making pretty good progress when I came across a problem. the webserver I use for my website is shared and doesn't allow me access to start programs so I must use my desktop as a server. The problem with this is I don't have a...]]></description>
			<content:encoded><![CDATA[<div>I have been working with desktop server/client applications today, making pretty good progress when I came across a problem. the webserver I use for my website is shared and doesn't allow me access to start programs so I must use my desktop as a server. The problem with this is I don't have a static IP address. I have come up with a solution to this. But I would like to know if anyone else has any other solutions for this problem.<br />
<br />
my solution is I created a simple asp script that gets the IP address of the computer that calls it and saves it as an XML doc to the webserver. My desktop server application periodically calls this asp script so that the XML document on the webserver stays current. Then on my client application. it checkd my webserver for the xml document, downloads it and parses it to an IP address. so that my client application always knows the IP address of my desktop server to connect to.<br />
<br />
it works well, for now.<br />
<br />
any suggestions on the topic I would appreciate. Code is available for anyone interested.</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum61.html">C#</category>
			<dc:creator>Diamonddrake</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread229248.html</guid>
		</item>
		<item>
			<title>sending files over TCP</title>
			<link>http://www.daniweb.com/forums/thread228973.html</link>
			<pubDate>Fri, 09 Oct 2009 21:58:30 GMT</pubDate>
			<description><![CDATA[I recently started messing with tcp socket programming. I hacked up a little instant messaging application that seems to work has some little problems but the world isn't in need of more IM clients. but I wanted to know a good practice for sending large files over tcp sockets. 
 
i made a simple...]]></description>
			<content:encoded><![CDATA[<div>I recently started messing with tcp socket programming. I hacked up a little instant messaging application that seems to work has some little problems but the world isn't in need of more IM clients. but I wanted to know a good practice for sending large files over tcp sockets.<br />
<br />
i made a simple client server app pair that will let the client send messages to the server. I have the server check the messages for special strings to tell it how to respond, if &quot;#FILE&quot; is sent it knows to write the next stream byte array to disk as a file. and this works great for a 25kb image. but as for a large file. how is this done?<br />
<br />
also, how would progress data be sent?<br />
<br />
i currently only know how to send the fully byte array in a single chuck, and I can't seem to find any GOOD, documented code examples.<br />
<br />
if anyone knows and good links or code examples I would appreciate it. I would like to create a a simple app that runs on the system tray that would let me and my friends easily transfer files of any size back and fourth. there are a BILLION google result titles &quot;C# sending files with TCP.&quot; but I looked at hundreds, the were either poorly written with no understandable comments, or they were other people asking my question with no answers.</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum61.html">C#</category>
			<dc:creator>Diamonddrake</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread228973.html</guid>
		</item>
	</channel>
</rss>
