<div>switch (info.gun)</div> <div>{</div> <div><span style="white-space:pre;"> </span>case "pistol":</div> <div><span style="white-space:pre;"> </span>pictureBox1.Image = Properties.Resources.pistol;</div> <div><span style="white-space:pre;"> </span>break;</div> <div><span style="font-size:9pt;white-space:pre;"> </span>case "revolver":</div> <div><span style="font-size:9pt;white-space:pre;"> </span>pictureBox1.Image = Properties.Resources.revolver;</div> <div><span style="font-size:9pt;white-space:pre;"> </span>break;</div> <div><span style="font-size:9pt;white-space:pre;"> </span>case "rifle":</div> <div><span style="font-size:9pt;white-space:pre;"> </span>pictureBox1.Image = Properties.Resources.rifle;</div> <div><span style="font-size:9pt;white-space:pre;"> </span>break;</div> <div><span style="font-size:9pt;white-space:pre;"> </span>default:</div> <div><span style="font-size:9pt;white-space:pre;"> </span><span style="font-size:9pt;white-space:pre;"> </span><span style="font-size:9pt;">return;</span></div> <div>}</div> <div><br></div> <div>위 코드처럼 info.gun변수와 <span style="font-size:9pt;">Properties.Resources.pistol 리소스에 있는 파일명이 같습니다.</span></div> <div><span style="font-size:9pt;"><br></span></div> <div>굳이 조건문을 사용하지 않고</div> <div><span style="font-size:9pt;"><br></span></div> <div><span style="font-size:9pt;">pictureBox1.Image = Properties.Resources.(info.gun);</span></div> <div><span style="font-size:9pt;"><br></span></div> <div><span style="font-size:9pt;">이런 느낌으로 한 줄로 작성할 수 있는 방법이 있으면 알려주시면 감사하겠습니다.</span></div>
댓글 분란 또는 분쟁 때문에 전체 댓글이 블라인드 처리되었습니다.