Press "Enter" to skip to content

[태그:] C#

Visual Studio C# 개발시 ActiveX(OCX) 추가하기

키움API로 자동거래 시스템을 만들어 보려고 하는데 OpenAPI가 Ocx로 제공되는데 추가 하는게 완전 헷깔려서 기록합니다.

1. 도구 상자에 OCX 를 추가하여 컨트롤 나오게하기

메뉴 -> 도구(T) -> 도구 상자 항목 선택(X) -> COM 구성 요소 탭 선택

간혹 크리스탈 리포트 베이직 어쩌구 하면서 설치 파일을 요구하지만 취소를 몇번 눌러준다.

저 같은 경우 삽입하려고 하는 것이 KHOpenAPI Control 인데.. 처음에는 안나타날 겁니다.

그럴경우에는 “찾아보기(B)…” 버튼을 클릭해서 삽입하고자 하는 ActiveX(OCX) 파일을 찾아서 지정합니다.

이제 폼 디자인화면으로 이동하면 도구 상자 -> 구성 요소 에 방금 추가한 ActiveX(OCX) 컨트롤이 보입니다.

2. OpenAPI의 경우 KHOpenAPILib를 참조 추가해줘야 한다.

솔루션 탐색기에서 참조 에서 마우스 우클릭 -> 참조추가(R) 를 선택한다.

참조 관리자가 뜨면 좌측에서 “COM” 선택 -> 우측 상단 검색에서 KH만 입력하면 검색되서 나온다.

KHOpenAPILib 체크박스를 체크해서 참조 추가 한다.

이제서야 OCX를 C# 프로젝트에서 사용할 수 있게 설정이 끝났다.

C # GDI + 게이지 컨트롤 사용자 컨트롤

C #의 예 : 무료 그리기 .Net GDI + 게이지 컨트롤 사용자 컨트롤

원문 : http://www.ucancode.net/Visual_C_MFC_Samples/CSharp_Example_Free_DOTNET_Gauge_Control_Draw_Source_Code.htm

자동 번역된 원문 : https://translate.googleusercontent.com/translate_c?depth=1&hl=en&ie=UTF8&prev=_t&rurl=translate.google.com&sl=auto&sp=nmt4&tl=ko&u=http://www.ucancode.net/Visual_C_MFC_Samples/CSharp_Example_Free_DOTNET_Gauge_Control_Draw_Source_Code.htm&xid=17259,15700023,15700043,15700124,15700149,15700186,15700191,15700201,15700214,15700215,15700218&usg=ALkJrhjgwnWG0C7Gdwu9LnRAInCVhzJabg

파일 보관 : 데모프로젝트, 소스

 AquaGauge_dll.zip AquaGauge_src.zip

자동 번역된 원문 갈무리
[그림이 보이지 않으면 원문이 삭제되거나 변경된 것임]

스크린 샷 - AquaGauge.gif
[그림1]


소개

쉽고 강력한 .NET GDI + 를 탐색하기 위해 .NET 사용자 정의 컨트롤 을 개발하기로 결정했습니다. .NET 2.0을 사용하여 개발 된이 간단한 계기 제어 는 모니터링 목적의 전체 범위를 충족시킬 수 있습니다. GDI +를 사용하여 광택 컨트롤을 개발하는 방법을 살펴 보겠습니다.

재정의 된 사용자 정의 컨트롤 메서드

일반적으로 사용자가 완전히 그려진 사용자 정의 컨트롤을 만들면 OnPaint 및 OnPaintBackground 메서드를 재정의해야 합니다. 또한 컨트롤 스타일을 적절하게 설정해야합니다. 이 공통 스타일은 this .SetStyle(ControlStyles.XXXXX, true/false); .

SupportsTransparentBackColor이렇게하면 Gauge 컨트롤 이 true 설정된 경우 투명한 배경색을 지원할 수 true .
ControlStyles.ResizeRedraw컨트롤 크기를 조정할 때 다시 칠할 수 있습니다.
ControlStyles.AllPaintingInWmPainttrue 인 경우 컨트롤 은 깜박임을 줄이기 위해 WM_ERASEBKGND 창 메시지를 무시합니다 . 
이 스타일은 UserPaint 비트가 true 로 설정된 경우에만 적용해야 true .
ControlStyles.UserPainttrue 컨트롤 은 운영 체제가 아니라 자체를 그립니다.
ControlStyles.OptimizedDoubleBuffertrue 경우, 컨트롤은 화면에 직접적으로가 아니라 버퍼에 먼저 그려 지기 때문에 깜박임을 줄일 수 있습니다. 이 속성을 true 설정하면 AllPaintingInWmPaint 도 true 설정해야 true .

OnPaint 및 OnPaintBackground 메서드는 컨트롤을 다시 칠해야 할 때마다 호출됩니다. 예를 들어 컨트롤의 크기를 조정하거나 폼을 최소화하고 최대화하면 OnPaint 메서드가 호출됩니다.

OnPaintBackground 대 OnPaint

OnPaintBackground 는 Window의 배경 (그리하여 모양)을 OnPaintBackground 빠른 속도를 보장합니다. 반대로 OnPaint 는 세부 사항을 칠하고 개별 페인트 요청 을 다시 그려야하는 모든 영역을 포함하는 하나의 Paint 이벤트 로 결합하므로 속도가 느려질 수 있습니다 . 예를 들어 컨트롤에 그라디언트 색상의 배경을 그리려 는 경우 OnPaintBackground 를 호출 할 수 있습니다 .

OnPaintBackground 에는 이벤트와 같은 명명법이 있고 OnPaint 메서드 와 동일한 인수가 사용되지만 OnPaintBackground 는 true 이벤트 메서드 가 아닙니다 . PaintBackground 이벤트 가없고 PaintBackground 가 이벤트 대리자를 호출하지 않습니다. OnPaintBackground 메서드를 재정의 할 때 파생 클래스는 기본 클래스 의 OnPaintBackground 메서드 를 호출 할 필요가 없습니다 .

게이지 다이얼 그리기

먼저 다이얼을 그려 보는 법을 봅시다. 다이얼에는 눈금, 임계 값 표시기, 일부 텍스트 및 현재 값이 표시되어야합니다.

눈금을 그리 려면 원주에서 그려지 는 규칙의 위치를 ​​계산해야합니다. 다이얼에서 90도에서 270도 사이의 각도에서 0부터 10까지의 크기로 그려야 한다고 가정 해 봅시다. 이 경우도 (270-90 = 180)의 차이는 10 부분으로 나누어야합니다. 그려야 할 각 파트의 위치를 ​​찾으려면 다음 수식이 필요합니다.

  x = centerX + radius * cos (180 / partNo)   y = 중심 Y + 반경 * sin (180 / partNo) 

참고 : Math.Cos 또는 Math.Sin 을 사용할 때 각도를 라디안 단위로 지정해야합니다.

서클 수식
[그림2]

위치를 찾은 후 원주에 모든 유형의 눈금 표시를 그릴 수 있습니다. 나는 눈금으로 선을 그리기 로했다. 다이얼 영역은 자주 변경되지OnPaintBackground 재정의 된 OnPaintBackground 메서드 에서 그릴 수 있습니다 .

포인터 그리기

포인터를 자주 다시 칠할 필요가 있습니다. 따라서 OnPaint 메서드 에서 그리는 것이 좋습니다 . 포인터 위치를 찾는 것은 척도 그리기 의 논리와 같습니다. 포인터는 graphicsObj.FillPolygon() 메서드를 사용하여 그릴 수 있으며 현재 값을 나타내는 모든 각도로 변환 할 수 있습니다. 그렇지 않으면 현재 값에 대한 모든 변경 사항에 대해 포인터를 다시 그릴 수 있습니다.

광택을 그리기

광택을 그리는 것은 매우 간단합니다. 모든 다이얼과 포인터를 페인팅 한 후에 그라디언트 색상으로 두 개의 타원을 채우면됩니다.LinearGradientBrush 클래스는 그라디언트 칠을 그릴 수있는 기능을 제공합니다. 다이얼 위로 그라디언트 레이어를 설정하면 아래 그림과 같이 광택이 생깁니다.

광택
[그림3]

Aqua Gauge 컨트롤 사용하기

이 Aqua Gauge 컨트롤 은 Windows에서 제공하는 다른 사용자 컨트롤로 사용할 수 있습니다. 다음은 요구 사항에 맞게이 게이지를 구성하는 데 사용할 수있는 컨트롤 관련 속성입니다.

속성 이름유형기술
DialColorColor게이지의 배경색을 가져 오거나 Set .
DialTextString게이지 다이얼에 표시된 텍스트를 가져 오거나 Set 합니다.
EnableTransparentBackgroundbool투명한 배경색을 사용하거나 사용하지 않도록 설정합니다. 참고 :이 옵션을 사용하면 성능이 저하되고 컨트롤이 깜박일 수 있습니다.
GlossinessfloatGlossiness의 강도를 Get 거나 Set .
MaxValuefloats 또는 Set 게이지 스케일에 표시된 최대 값으로 가져옵니다.
MinValuefloats 또는 Set 게이지 눈금에 표시된 최소값으로 가져옵니다.
NoOfDivisionsint게이지 눈금의 분할 수를 s 또는 Set 으로 지정합니다.
NoOfSubDivisionsints 나 Set 을 각 디비전에 대한 눈금에 표시되는 세분화 수로 가져옵니다.
RecommendedValuefloat눈금에 s 또는 Set 권장 값으로 가져옵니다. 이것은 임계 영역을 그리기위한 피벗 점으로 사용됩니다.
ThresholdPercentfloat눈금에서 임계 값 영역 비율을 가져 오거나 Set .
Valuefloat포인터가 가리킬 값을 가져 오거나 Set 합니다.

가볼만한 곳

우리가 많은 조작으로 이미지를 그릴 때마다 이미지 객체에 그려서 페인트하는 것이 좋습니다. 예를 들어 계기판을 그리려면 CPU를 많이 사용하는 작업이 필요합니다. 따라서 다이얼로그를 이미지 위에 그린 다음 graphicsObj.DrawImage() 사용하여 그릴 수 있습니다. 다이얼 속성을 변경할 때마다 이미지 개체를 다시 만들 수 있습니다. 성능이 향상됩니다.

C# 사용자정의 컨트롤(게이지 컨트롤) 예제

공개된 사용자 정의 컨트롤 예제(게이지 컨트롤) C#

클라이언트 영역에 컨트롤을 그려넣는 고급 수준의 사용자 정의 컨트롤 예제임

원문 : http://www.ucancode.net/CSharp_Tutorial_GDI+_Gauge_Source_Code.htm

자동번역 : https://translate.googleusercontent.com/translate_c?depth=1&hl=en&rurl=translate.google.com&sl=auto&sp=nmt4&tl=ko&u=http://www.ucancode.net/CSharp_Tutorial_GDI%2B_Gauge_Source_Code.htm&xid=17259,15700023,15700043,15700124,15700149,15700186,15700191,15700201,15700214,15700215,15700218&usg=ALkJrhhyzJaaqUNZVYdwhf5ODUTWa2ApJg

소스파일 보관 AGaugeApp.zip
스크린샷

* 스크린샷이 안보이면 원문 사이트가 변경됬을 가능성이 높음.

* 라이센스 정책은 모름.(원문 사이트 참조)

C# 포켓 1945 게임???? 소스???

Pocket 1945 – A C# .NET CF Shooter
출처 : http://www.codeproject.com/KB/mobile/CfPocket1945.aspx

 pocket1945.zip pocket1945src.zip

Introduction
Pocket 1945 is a classic shooter inspired by the classic 1942 game. The game is written in C# targeting the .NET Compact Framework. This article is my first submission to Code Project and is my contribution to ongoing .NET CF competition.

As well as being my first article this is also my first game ever. My every day work consists of building data centric business applications, so game writing is something completely different. So, go easy on me.

One of my goals when starting this project was to make a game that other developers could use as a starting point when getting into C# game development. I focused on keeping the code as clear and simple as possible. I also wanted to build this game without introducing any third party components such as the Game Application Interface (GAPI). The reason I did this was that I wanted to see what I could do with the core framework. Another goal was to take this game/example a step further than most tic-tac-toe examples and actually build a game that?s fun, challenging and looks good.

One of the things I realized when working on this project is that games take time, no matter how simple they are. The game is still not at version 1.0, but it is playable in it’s current state. I?ve put the game up as a GotDotNet workspace and I encourage everyone that finds the game fun to join the workspace and help me build a fun shooter for the Pocket PC platform.

How to install/play Pocket 1945
In order to play you need a Pocket PC enabled device with the .NET Compact Framework 1.1 installed. To install simply copy the Pocket1945.exe file and the level XML files to a new folder on your device. No installation is required.

To play the game, you use the direction keys on your device. To exit, click the calendar button (first hardware button). To fire, click the second hardware button. Since I don?t own a real device I?m not sure what the ?name? of these buttons are. But, just give it a go!

The current game is far from ?finished?, but it is safe to run the code and it is playable. The game consists of 4 levels. To add levels of your own, simply make new level XML files and copy them to the game folder on your device. Since I don?t have a level editor yet I would suggest that you build your new level based on the existing one. If you make any fun levels, place share them with us.

Game design
The game consists of one Visual Studio .NET solution called Pocket1945. The project contains 13 classes, 3 interfaces, 1 structure and 7 enumerators. I?ve supplied a screenshot of the class view in VS.NET to illustrate the class design of the game.

 
The GameForm class is the main class of the application. This class takes care of drawing and running the actual game. The Level class loads a level XML file and parses the XML out to objects. The Background class draws the map and background elements to the screen. The Player class defines the player character in the game. The Enemy class defines all enemy planes used in the game. The Bonus class is used for bonus elements such as an extra life or shield upgrade. The LevelGui class is used to draw a simple in-game user interface. This class is used to display information about health, progress, score and such to the player.

The Input and StopWatch class are taken from one of the MSND articles and gives you access to detected hardware buttons and a high performance counter. These classes are exactly the same as in the MSDN examples.

The IArmed interface is implemented on game objects that can fire bullets and get hit by other bullets. The ICollidable interface is implemented by items that can collide, such as bonus items. The IDrawable interface is implemented by all objects that can be drawn to the screen during the game.

The different enums are used for properties such as type of bonus, weapon, enemy, movement and so on.

Level design
Each level is a XML file containing an ASCII table with the level map and XML nodes for background elements (such as islands), enemies and bonus elements. The Level class takes a path in the constructor and loads the XML file passed into the constructor and builds objects based on the nodes.

The ASCII table contains a table with 8 columns and an unknown number of rows. Each character in the table represents a 32×32 pixel background tile. So if the ASCII table is 56 rows high and 8 columns wide the background size will be 1792×256 pixels. The level file also has a setting called speed which sets the speed in pixels per second. An average map is 1800 pixels high and scroll at 15 pixels per second giving you approximately 2 minutes of game play. An example of the ASCII map:view plaincopy to clipboardprint?

 <Map>  
 <![CDATA[AAAAAAAA  
 BBBBBBBB  
 AAAAAAAA  
 CCCCCCCC  
 CCCCCCCC  
 AAAAAAAA  
 BBBBBBBB  
 BBBCCCBB  
 ABCDABCD]]>  
</Map></P>  
<P>   

The enemy nodes contains all the settings for each enemy. The Y attribute tells the game engine when the enemy comes into play. So, for instance an enemy with Y=1500 starts to move when the player have scrolled to point 1500 on the map. Both enemies and bonus elements as positioned this way. An example enemy node looks something like this:

  <Enemy X="140" Y="1700" Speed="80" MovePattern="1"   
  EnemyType="1" BulletType="1" BulletPower="5" BulletSpeed="150"   
  BulletReloadTime="1000" Power="10" Score="100" />   

X = the horizontal start position for this enemy. 
Y = the vertical start position for this enemy (when it gets focus). 
Speed = the speed the enemy moves at (pixels pr second). 
MovePattern = the way the enemy moves. At the moment straight ahead is the only pattern supported. I?ll add patterns like zigzag, swipe, kamikaze and simple AI. The MovePattern enum defines the different move patterns. 
EnemyType = the type of enemy. There are currently 6 supported enemies. The EnemyType enum defines the different types of enemies. 
BulletType = the type of bulled fired by this enemy. The BulletType enum defines the different types of bullets. 
BulletPower = the power of the bullets fired by this enemy. This indicates how damaged the player gets by a hit. 
BulletSpeed = the speed the bullet is traveling at (pixels per second). 
BulletReloadTime = how long it takes for the enemy to reload (milliseconds). 
Power = how thick the enemy shield is (how hard it is to kill). 
Score = the score you collect by killing this enemy. 
As you probably can guess I?m planning on writing a XML based level designer to build new levels for the game. I?m also thinking about making a XML Web Service based game server where you can upload and download new level sets. The XML format also needs to be formalized by making schemas. This is all on the TODO list.

Bonus elements are implemented almost the same way as enemies so I won?t go into details on the bonus nodes. An example level file can be downloaded here: Level1.xml(zipped)

Points of interests ? Sprite list
One of the things that might be useful to look at is how I?ve implemented sprites. All the game graphics are embedded bitmap resources. At first I only used one single bitmap with all sprites, but I soon realized this would make the file hard to maintain and adding new sprites would cause problems with sprite indexes. I spited the image into logic sections like bullets, enemies, player, tiles, and bonuses.

All sprites are managed by the SpriteList class. The class implements the singleton pattern to ensure that there is only one instance of this class trough out the game. The class consists of one public method called LoadSprites() and several public Bitmap arrays holding each sprite. The LoadSprites() method reads the embedded resources and call a private method called ParseSpriteStrip() that reads a sprite strip (one large bmp with several sprite on it) and splits it into a Bitmap array. Each game object (like a bonus item, a bullet or an enemy) draws it self by reading a bitmap from one of the public Bitmap arrays.

By handling sprites this way you have a consistent way to access your graphical resources. By making the class a singleton you can be sure there is only one instance of the class trough out the application. All loading is done on game initialization making this a fast way to read sprites.

The following code shows the LoadSprites() method and the ParseSpriteStrip() method.

/// <summary>  
/// Metod loading the sprites from the assembly resource files  
/// into the public bitmap array. To be sure the sprites are only loaded  
/// once a private bool is set to true/false indicating if the sprites  
/// have been loaded or not.  
/// </summary>  
public void LoadSprites()  
{  
 if(!doneLoading)  
 {      
  //Accessing the executing assembly to read embeded resources.  
  Assembly asm = Assembly.GetExecutingAssembly();  
    
  //Reads the sprite strip containing the sprites you want to "parse".  
  Bitmap tiles = new Bitmap(asm.GetManifestResourceStream(  
   "Pocket1945.Data.Sprites.Tiles.bmp"));  
  Bitmap bonuses = new Bitmap(asm.GetManifestResourceStream(  
   "Pocket1945.Data.Sprites.Bonuses.bmp"));  
  Bitmap bullets = new Bitmap(asm.GetManifestResourceStream(  
   "Pocket1945.Data.Sprites.Bullets.bmp"));  
  Bitmap smallPlanes = new Bitmap(asm.GetManifestResourceStream(  
   "Pocket1945.Data.Sprites.SmallPlanes.bmp"));  
  Bitmap smallExplotion = new Bitmap(asm.GetManifestResourceStream(  
   "Pocket1945.Data.Sprites.SmallExplotion.bmp"));  
  Bitmap bigBackgroundElements = new Bitmap(asm.GetManifestResourceStream(  
   "Pocket1945.Data.Sprites.BigBackgroundElements.bmp"));  
  Bitmap bigExplotion = new Bitmap(asm.GetManifestResourceStream(  
   "Pocket1945.Data.Sprites.BigExplotion.bmp"));  
  Bitmap bigPlanes = new Bitmap(asm.GetManifestResourceStream(  
   "Pocket1945.Data.Sprites.BigPlanes.bmp"));</P>  
<P>  //Parse the sprite strips into bitmap arrays.  
  Tiles = ParseSpriteStrip(tiles);  
  Bullets = ParseSpriteStrip(bullets);  
  Bonuses = ParseSpriteStrip(bonuses);  
  SmallPlanes = ParseSpriteStrip(smallPlanes);  
  SmallExplotion = ParseSpriteStrip(smallExplotion);  
  BigBackgroundElements = ParseSpriteStrip(bigBackgroundElements);  
  BigExplotion = ParseSpriteStrip(bigExplotion);  
  BigPlanes = ParseSpriteStrip(bigPlanes);</P>  
<P>  //Clean up.  
  tiles.Dispose();  
  bullets.Dispose();  
  bonuses.Dispose();  
  smallPlanes.Dispose();  
  smallExplotion.Dispose();  
  bigBackgroundElements.Dispose();  
  bigExplotion.Dispose();  
  bigPlanes.Dispose();</P>  
<P>  doneLoading = true;  
 }  
}</P>  
<P>/// <summary>  
/// Method parsing a sprite strip into a bitmap array.  
/// </summary>  
/// <param name="destinationArray">  
/// The destination array for the sprites.</param>  
/// <param name="spriteStrip">The sprite strip to   
/// read the sprites from.</param>  
private Bitmap[] ParseSpriteStrip(Bitmap spriteStrip)  
{         
 Rectangle spriteRectangle = new Rectangle(1, 1,   
   spriteStrip.Height - 2, spriteStrip.Height - 2);  
 Bitmap[] destinationArray = new Bitmap[(spriteStrip.Width - 1)   
   / (spriteStrip.Height - 1)];</P>  
<P> //Loop drawing the sprites into the bitmap array.      
 for(int i = 0; i < destinationArray.Length; ++i)  
 {  
  destinationArray[i] = new Bitmap(spriteRectangle.Width, spriteRectangle.Height);  
  Graphics g = Graphics.FromImage(destinationArray[i]);  
  spriteRectangle.X = i * (spriteRectangle.Width + 2) - (i - 1);      
  g.DrawImage(spriteStrip, 0, 0, spriteRectangle, GraphicsUnit.Pixel);      
  g.Dispose();  
 }</P>  
<P> return destinationArray;  
}   

Points of interests ? Double buffering
Another thing worth mentioning is how I draw each game frame. I?m using a common technique called double buffering. Basically what this mean is that I draw the entire frame in memory before moving it onto the screen. By doing this I avoid unwanted flickering. I don?t own a real pocket pc, but I?ve been told that the game performs really well on them. I?m hoping to win a Pocket PC so that I can test this for my self.

The GameForm class (the main class of the game) has three private fields used for drawing:

private Bitmap offScreenBitmap;  
private Graphics offScreenGraphics;   
private Graphcis onScreenGraphics;  

The offScreenBitmap is the bitmap used to hold the in-memory version of each game frame. The offScreenGraphics is a Graphics object used to draw to the in-memory bitmap. onScreenGraphics is a Graphics object used to draw the in-memory bitmap onto the screen at the end of each game loop. All game elements that can be drawn implements the IDrawable interface which has one method called Draw(Graphics g), which is used to draw itself onto the game form. In the game loop you call player.Draw(offScreenGraphic) to make the player draw itself onto the off screen bitmap. Here is an example of the level loop showing how you pass the offScreenGraphcis object to game object and move the offScreenBitmap onto the screen at the end of the loop:

private void DoLevel(string filename)  
{   
 CurrentLevel = new Level(GetFullPath(filename));  
 StopWatch sw = new StopWatch();  
 bool levelCompleted = false;  
 bool displayMenu = false;</P>  
<P> while((playing) && (!levelCompleted))  
 {  
  // Store the tick at which this frame started  
  Int64 startTick = sw.CurrentTick();      
  input.Update();  </P>  
<P>  //Update the rownumber.  
  TickCount++;      
       
  //Draw the background map.       
  CurrentLevel.BackgroundMap.Draw(offScreenGraphics);    </P>  
<P>  //Update bullets, enemies and bonuses.  
  HandleBonuses();  
  HandleBullets();      
  HandleEnemies();    </P>  
<P>  //Update and draw the player.  
  Player.Update(input);   
  Player.Draw(offScreenGraphics);  
  playing = (Player.Status != PlayerStatus.Dead);</P>  
<P>  //Draw in-game user interface  
  levelGui.Draw(offScreenGraphics);  
       
  //Move the offScreenBitmap buffer to the screen.  
  onScreenGraphics.DrawImage(offScreenBitmap, 0, 0,   
   this.ClientRectangle, GraphicsUnit.Pixel);      
    
  //Process all events in the event que.  
  Application.DoEvents();      
 }     
}   

TODO
There are tons of things that need to be done before this can be considered a ?real? fun and exiting game. But, we?re getting there. I won?t go into details of everything that needs to be done, but I?ll add some important points:

A good level editor. 
A set of XML Web Services to upload and downloads levels and post scores. 
New move patterns (how the enemies move). 
A game GUI (main menu, title screen, high score list etc). 
XML Schemas defining the rules for the level files. 
Better designed levels that are well balanced and challenging. 
Bosses. We need big bad bosses. 
Much more. 
Any suggestions are greatly appreciated, either here on Code Project or on the workspace site.

Resources
I?ve used several online resources when building this game. First of all I have to credit Ari Feldman for the great graphics I?ve used in the game. Ari has published several sprite sets on his website under the SpriteLib GPL foil. The sprites can be found on http://www.arifeldman.com/games/spritelib.html.

I would also like to mention everyone on #ms.net on EFNet. Special thanks to ^CareBear for instant feedback on how the game is performing on a real device.

Other resources used are series of game articles published on MSDN:

Writing Mobile Games Using the Microsoft .NET Compact Framework (http://msdn.microsoft.com/mobility/default.aspx?pull=/library/en-us/dnnetcomp/html/netcfgaming.asp). 
Gaming with the .NET Compact Framework (http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnnetcomp/html/GManGame.asp). 
Gaming with the .NET Compact Framework: A Simple Example (http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnnetcomp/html/BustThisGame.asp). 
Closing comment
There are still several things I?d like to mention, but in order to get this article/game submitted in time to be a part of the competition I really need to finish it up now.

Part II of this article will be available in X days/months/years/or maybe never. The game is far from finished, but is playable in it’s current state. I hope you download it and give it a go. If you find the project fun and promising I would encourage you to join the workspace up on http://workspaces.gotdotnet.com/pocket1945 and take part of the on-going development of this game. The workspace will also be the place to get your hands on the latest releases of the game.

All comments on this article and the game in general are greatly appreciated.

 
 
License
This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here

About the Author
Jonas Follesø


Member  I’m a C# developer from Norway. I’m a co-founder of a small ISV called GreIT AS. Our company site can be found at http://www.greit.no (all information in norwegian).

My everyday work consists of building ASP.NET web applications and work on our content management system, Webpakken. I use my spare time on side projects such as Pocket 1945 (http://workspaces.gotdotnet.com/pocket1945), a shooter game for the Pocket PC platform. It’s almost the opposite of my everyday work since games are small, focus on graphics and entertainment, while our CMS is large, focus on businesses and data.

When I’m not sitting in front of the computer I go snowboarding or skateboarding, depending on which time of the year it is.

I also enjoy fly fishing for salmon and trout in the summer. My personal record is a 10.5 KG salmon caught in Lakselva last summer and a 2 KG trout caught some where secret place in Finnmark. A bragging picture of me holding the salmon can be found at http://jonas.greit.no/pictures/salmon.jpg .

I did start blogging some time back, but I haven’t been to good at updating my blogg. I just got so much stuff going on that it’s hard to find time to add blogg posts. You can view my blogg at http://jonas.greit.no, just don’t expect too much.
Occupation:  Web Developer 

Location:   Norway 

C# 윈폼에 올린 브라우저에서 웹페이지 로그인 및 자바스크립트 실행시키기

참조 추가 Microsoft Internet Controls(SHDocVw)와 Microsoft.mshtml 를 하고

using System.Runtime.InteropServices;

using SHDocVw;
using mshtml;

한다.

그 후

InternetExplorer ex = new InternetExplorer();      
ex.Visible = true;
Object obj = null;

ex.Navigate("http://space4u.co.kr", ref obj, ref obj, ref obj, ref obj);

위와 같이 익스플로러를 실행시키고 (space4u.co.kr 로 접속)

굳이 익스플로러가 아니더라도.. WebBrowser를 사용하셔도 됩니다.

private void button3_Click(object sender, EventArgs e)
        {
            IHTMLDocument2 hd;
            hd = (IHTMLDocument2)ex.Document;
            IHTMLElementCollection hCollection = (IHTMLElementCollection)hd.all;
            object obj = "input";                    //input 태그 찾으려고
            IHTMLElementCollection he = (IHTMLElementCollection)hCollection.tags(obj);
            foreach (IHTMLElement helem in he)
            {
                if (helem.getAttribute("name", 0) != null)
                {
                    if (helem.getAttribute("name", 0).ToString() == "email")    //소스를 보고 name속성의 값을 적는다, 아이디 항목
                    {
                        helem.setAttribute("value", (Object)"아이디", 0);       //value 속성에 아이디를 대입
                    }
                    if (helem.getAttribute("name", 0).ToString() == "passwd")
                    {
                        helem.setAttribute("value", (Object)"비밀번호", 0);
                    }
                }
            }
        }

function closeAction(){
alert("종료합니다");
}

function closeActionAA(aa){
alert(aa + "호출");
}

이런 식의 자바스크립트가 있다면,
윈폼에서

this.webBrowser1.Document.InvokeScript("closeAction");
this.webBrowser1.Document.InvokeScript("closeActionAA", new object[] { "하하하"});

이런 식으로 호출할 수 있습니다.

따라서,

this.webBrowser1.Document.InvokeScript("load", new object[] { "code123","3","1","1","1"}); 

요렇게 가능하겠습니다. 


출처 : http://ultragostop.tistory.com/84?srchid=BR1http%3A%2F%2Fultragostop.tistory.com%2F84