본문 바로가기

Application179

HexToColor 이전에 RGB 를 Hex 로 변경하는 함수를 만들었다. 이번에 반대의 개념으로 Hex값으로 Color 값을 만들어 보자 굳이 사용법을 언급할 필요가 있을까~~~ public Color setHexToColor(string hex) { //# 제거 if (hex.IndexOf('#') != -1) hex = hex.Replace("#", ""); int red = 0; int green = 0; int blue = 0; if (hex.Length == 6) { //RRGGBB 형태의 경우 red = int.Parse(hex.Substring(0, 2), NumberStyles.AllowHexSpecifier); green = int.Parse(hex.Substring(2, 2), NumberStyles.A.. 2010. 4. 6.
RGBtoHex RGB 색상값을 Hex 형태로 변경해 보자 Html 와 RGB 와 변환에 필요해서 만들었다. public string setRgbtoHex(string rgb, string concatData) { int red = 0; int green = 0; int blue = 0; string[] rgbArr = rgb.Split('.'); red = int.Parse(rgbArr[0]); green = int.Parse(rgbArr[1]); blue = int.Parse(rgbArr[2]); System.Drawing.Color color = System.Drawing.Color.FromArgb(red, green, blue); return string.Concat(concatData, (color.ToArgb.. 2010. 4. 6.
VS2005 Remote Debug VS2005 에서 리모트 디버깅시 원격지에 설치하는 프로그램이다. VS DVD 에 포함되어 있는데 원격지에 설치할때마다 파일을 건너주는것도 귀찮은 일이다. 원격 디버깅 셋팅에 관련된 부분은 잘 나와 있다. http://support.microsoft.com/kb/910448 시간되면 설정 방법을 정리해서 올리겠다. 2010. 3. 26.
File.OpenText 의 인코딩 형식 파일을 쉽게 읽기 위한 방법으로 아래 방법을 자주 이용한다. StreamReader stream = File.OpenText(tempFile); //파일 열기 string strString = stream.ReadToEnd(); stream.Close(); 하지만 얼마전에 문제가 생기고 말았다. 보통 config 파일 같을걸 읽을때 사용했는데 한글이 없었다~ 한글이 들어간 파일은 제대로 읽지를 못한다. MSDN 을 찾아보니. File.OpenText() 는 UTF-8 형식을 기본 인코딩으로 사용한다. 인코딩 형식을 맞쳐서 읽기 위해서는 다음과 같이 해야 한다. StreamReader stream = new StreamReader(tempFile, System.Text.Encoding.Default); s.. 2010. 3. 24.