336x280(권장), 300x250(권장), 250x250, 200x200 크기의 광고 코드만 넣을 수 있습니다.
닷넷에서 제공하는 Reflection을 이용하면 클래스 내부의 프로퍼리 목록, 또는 메소드 목록을 가져와서
값을 지정하거나 가져올 수 있다. 

1.네임스페이스 선언

using System.Reflection;

 
2.소스코드 (콘솔 어플리케이션)

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Reflection;

namespace ConsoleApplication1
{
	class Program
	{
		static void Main(string[] args)
		{

			StaticGetProPertyList();
			StaticGetMethodList();

			Console.WriteLine(Environment.NewLine);

			InstanceAddress address = new InstanceAddress();
			InstanceGetProPertyList(address);
		}

		public static void StaticGetProPertyList()
		{ 
			PropertyInfo[] propertyinfos ;
			propertyinfos = typeof(StaticAddress).GetProperties(BindingFlags.Public | BindingFlags.Static);

			Console.WriteLine("----- StaticAddress's Property List -----");
			foreach (PropertyInfo info in propertyinfos)
			{
				Console.WriteLine(string.Format("Property Name: {0} type:{1}", info.Name, info.PropertyType.Name));
			}
			Console.WriteLine(Environment.NewLine);

			StaticSetAge(20);
			StaticGetAge();

			StaticSetAge(0);
			StaticGetAge();

		}

		public static void StaticGetMethodList()
		{
			MethodInfo[] methodinfos;
			methodinfos = typeof(StaticAddress).GetMethods(BindingFlags.Public | BindingFlags.Static);

			Console.WriteLine("----- StaticAddress's Method List -----");
			foreach (MethodInfo info in methodinfos)
			{
				Console.WriteLine(string.Format("Method Name: {0} Return type:{1}", info.Name, info.ReturnType));
			}
			
		}

		public static void StaticSetAge(int age)
		{
			PropertyInfo ageProperty = typeof(StaticAddress).GetProperty("age");
			ageProperty.SetValue(null, age, null);
		
		}

		public static void StaticGetAge()
		{
			PropertyInfo ageProperty = typeof(StaticAddress).GetProperty("age");
			Console.WriteLine("Age is: " + ageProperty.GetValue(null, null));
		
		}


		public static void InstanceGetProPertyList(InstanceAddress instance)
		{
			
			PropertyInfo[] propertyinfos;

			propertyinfos =typeof(InstanceAddress).GetProperties(BindingFlags.Public | BindingFlags.Instance);

			Console.WriteLine("----- InstanceAddress's Property List -----");
			foreach (PropertyInfo info in propertyinfos)
			{
				Console.WriteLine(string.Format("Property Name: {0} type:{1}", info.Name, info.PropertyType.Name));
			}
			Console.WriteLine(Environment.NewLine);

			InstanceSetAge(50, instance);
			InstanceGetAge(instance);

			InstanceSetAge(0, instance);
			InstanceGetAge(instance);

		}

		public static void InstanceGetMethodList(InstanceAddress instance)
		{
			MethodInfo[] methodinfos;
			methodinfos = typeof(InstanceAddress).GetMethods(BindingFlags.Public | BindingFlags.Instance);

			Console.WriteLine("----- InstanceAddress's Method List -----");
			foreach (MethodInfo info in methodinfos)
			{
				Console.WriteLine(string.Format("Method Name: {0} Return type:{1}", info.Name, info.ReturnType));
			}
			Console.WriteLine(Environment.NewLine);
		}

		public static void InstanceSetAge(int age,InstanceAddress instance)
		{
			PropertyInfo ageProperty = instance.GetType().GetProperty("instanceage");
			ageProperty.SetValue(instance, age, null);

		}

		public static void InstanceGetAge(InstanceAddress instance)
		{
			PropertyInfo ageProperty = instance.GetType().GetProperty("instanceage");
			Console.WriteLine("Age is: " + ageProperty.GetValue(instance, null));

		}


	}

	public class StaticAddress
	{
		private static int _age;
		public static string name { get; set; }
		public static string address { get; set; }
		public static int age
		{ get
			{
				return _age;
			}	 			
		 set{
			if(value<= 0)
			{
				Console.WriteLine("Input Error. Set Default value is 10");
				_age = 10;
				return;
			}
			_age = value;
		 }
		
		}

		public static string GetFullName()
		{
			return string.Format("name: {0}, address: {1}, age: {2}", name, address, age);
		}
	
	}

	public class InstanceAddress
	{
		private int _instanceAge;
		public string instancename { get; set; }
		public string instanceaddress { get; set; }
		public int instanceage
		{
			get
			{
				return _instanceAge;
			}
			set
			{
				if (value <= 0)
				{
					Console.WriteLine("Input Error. Set Default value is 10");
					_instanceAge = 10;
					return;
				}
				_instanceAge = value;
			}

		}

		public string instanceGetFullName()
		{
			return string.Format("name: {0}, address: {1}, age: {2}", instancename, instanceaddress, instanceage);
		}
	}
}

GetProperties()메소드에서 파라메터로 넘어가는 BindingFlags 값을 합쳐서 특정 조건을 가진 항목만 가져올 수 있다.
Static Class 클래스의 경우는 SetValue나 GetValue에서 첫번째 파라메터인 object가 null로 들어간다. (#58, #65 라인)
Instance된 클래스의 경우는 SetValue나 GetValue에서 첫번째 마라메터에는 인스턴스된 객체가 들어간다. (#113, #120 라인)

3. 실행 결과




Posted by shunman

댓글을 달아 주세요

336x280(권장), 300x250(권장), 250x250, 200x200 크기의 광고 코드만 넣을 수 있습니다.

vs2010  asp.net MVC프로젝트에 기본으로 포함되어 있는 jquery를 사용하였음.

<script src="../Scripts/jquery-1.4.1.min.js" type="text/javascript"></script>

jquery를 프로젝트에 첨부하고 위와 같이 경로를 지정해주면 된다.
아래의 코드를 head부분에 집어넣고 작동이 되면 성공

<head >
    <title></title>
    <script src="../Scripts/jquery-1.4.1.min.js" type="text/javascript"></script>

   <script type="text/javascript">
              
        $(document).ready(function()
        {
            alert('load');
        });

    </script>

</head>
Posted by shunman

댓글을 달아 주세요

336x280(권장), 300x250(권장), 250x250, 200x200 크기의 광고 코드만 넣을 수 있습니다.


 프로그램이 실행되자 마자 타이머를 하나 실행시키고
두개의 키를 따로 누르거나 동시에 눌렀을때 누른만큼 사각형을 X축으로 이동시켜보는 소스가 되겠습니다

흠 소스 다운받아서 한번 실행해보세요

혹시 잘못된 부분 있으면 지적해주시면 감사하겠습니다 ㅋ 저도 배우는 입장이니까요~

visual studio2008 이 설치되어야 실행이 됩니다

multikeyinput.rar


Posted by shunman

댓글을 달아 주세요

336x280(권장), 300x250(권장), 250x250, 200x200 크기의 광고 코드만 넣을 수 있습니다.
web.config 파일에 아래 내용을 추가해준다

 <system.serviceModel>
    <serviceHostingEnvironment aspNetCompatibilityEnabled="false" >
        <baseAddressPrefixFilters>
            <add prefix="http://shunman.pe.kr" />
        </baseAddressPrefixFilters>
    </serviceHostingEnvironment>
 <system.serviceModel>

ps: 몇달동안 이거 안해줘도 잘쓰고 있었는데 왜 갑자기 이걸 해줘야지 사이트가 작동하는걸까...


Posted by shunman

댓글을 달아 주세요

336x280(권장), 300x250(권장), 250x250, 200x200 크기의 광고 코드만 넣을 수 있습니다.

====================================================[location 객체 설명]

[속성]

- hash : 문서의 표식이름을 알려줍니다

- host : 도메인 이름을 포함한 호스트의 주소와 포트번호를 알려줍니다

- hostname : 문서의 URL 주소중에 호스트 이름을 알려줍니다

- href : 문서의 URL 주소를 알려주거나 특정(지정한) URL로 이동합니다

            이 속성에 URL 을 지정하여 지정 사이트로 이동하게 되죠

            그러나 이속성은 temp에 저장된 문서를 로딩할 가능성이 있습니다

- path : 문서의 디렉토리 위치를 설정하거나 알아냅니다

- protocol : 프로토콜 종류를 설정하거나 알아냅니다

 

[메서드]

- reload(true) : 브라우저가 현재 문서를 다시 로드합니다

- replace("특정 URL") : 현제 문서를 지정한 특정 URL로 이동합니다

---------------------------------------------------------------------

location 객체의 속성과 메서드를 설명한 것이구요

문서를 이동할 경우

location.href="이동할 URL"; 처럼 속성값을 바꾸거나

location.replace("이동할 URL"); 처럼 메서드를 이용할 수 있습니다

href 는 이전에 이미 접속했던 사이트일 경우 temp에 저장된 문서를 보여줄 가능성이

있다고합니다

그래서 replace() 함수를 이용한 페이지 이동을 추천합니다


Posted by shunman

댓글을 달아 주세요

336x280(권장), 300x250(권장), 250x250, 200x200 크기의 광고 코드만 넣을 수 있습니다.

	IE6을 제외한 브라우저에서는 min-height: 를 사용한다
              IE6에서는 _height 라는 편법을 사용해서 지정해 줄수 있다.


Posted by shunman

댓글을 달아 주세요

336x280(권장), 300x250(권장), 250x250, 200x200 크기의 광고 코드만 넣을 수 있습니다.
팝업 윈도우 띄우기

window.open(URL,'popup', 'width=400,height=400,resizable=no,scrollbars=no,top=200,left=300');

URL -> 팝업을 띄우고자 하는 HTML 페이지가 있는 경로
'popup' -> 흠? 창의 이름을 지정해주는곳 같네요
width=400,height=400,resizable=no,scrollbars=no,top=200,left=300
-> 높이, 폭은 400픽셀, 창의 크기 조절 불가, 스크롤바 없음, 창의 위치를 위에서부터 200픽셀 간격 왼쪽에서 300픽셀 간격


EX:)

window.open('ex.html','popup', 'width=400,height=400,resizable=no,scrollbars=no,top=200,left=300');

팝업창 여러개 띄우기

window.open(URL,'popup1', 'width=400,height=400,resizable=no,scrollbars=no,top=200,left=300');

window.open(URL,'popup2', 'width=400,height=400,resizable=no,scrollbars=no,top=200,left=300');

이렇게 두번째 인자값을 바꿔주시면 됩니다.


Posted by shunman

댓글을 달아 주세요

336x280(권장), 300x250(권장), 250x250, 200x200 크기의 광고 코드만 넣을 수 있습니다.
1. fckeditor 소스를 Visual studio를 이용해서 연다
2.소스에서 filebrowser폴더 안에 있는 fileworkerbase.cs파일을 연다
3. 다음의 라인으로 이동하여 아래의 라인내용을 바꾼다

119라인으로 이동

[원본]
Replace: Response.Write( @"(function(){var d=document.domain;while (true){try{var A=window.top.opener.document.domain;break;}catch(e) {};d=d.replace(/.*?(?:\.|$)/,'');if (d.length==0) break;try{document.domain=d;}catch (e){break;}}})();" );

[아래와같이 변경]
Replace with: Response.Write(@"(function(){var d=document.domain;while (true){try{var A=window.parent.OnUploadCompleted;break;}catch(e) {};d=d.replace(/.*?(?:\.|$)/,'');if (d.length==0) break;try{document.domain=d;}catch (e){break;}}})();");
Posted by shunman

댓글을 달아 주세요

336x280(권장), 300x250(권장), 250x250, 200x200 크기의 광고 코드만 넣을 수 있습니다.
익스플로러7에서는 png파일의 투명도가 지원이 되서 투명이 들어간 이미지도 정상적으로 잘 보입니다.
하지만 익스플로러6에서는 투명이 들어가면 투명하게 보여야할 부분이 회색으로 나오더군요.

아 물론 자바스크립트를 사용하면 투명하게 나오게 할수 있더군요.
Posted by shunman

댓글을 달아 주세요

336x280(권장), 300x250(권장), 250x250, 200x200 크기의 광고 코드만 넣을 수 있습니다.
와 이거 진짜 어이없습니다 ㅡㅡ 익스 7에서는 잘 보이는데 익스 6에서만 이런거네

원래 코드는
<div style="float:left;width:227px;height:38px;padding:0px;">
    <img alt="" src="mainimage/topimg1.png" />
</div>

이렇게 되어 있죠. 가독성이 좋으라고 줄넘김이 잘 되어있는데 자꾸 공백이 생기는 겁니다.

그래서 혹시나 하고
<div style="float:left;width:227px;height:38px;padding:0px;"><img alt="" src="mainimage/topimg1.png" /></div>

처럼 한줄로 바꿔 보았습니다.

그랬더니 잘 되네요 ㅡㅡ;;;;;;;;;;;;;

Posted by shunman

댓글을 달아 주세요