Deleted articles cannot be recovered. Draft of this article would be also deleted. Are you sure you want to delete this article?
è¤æ°ãã¿ã³ã«å¯¾å¿ãããã³ãã© ã¤ãã³ãã®ä¾¡å¤ãå®æããããã«ããã1åã®ãµã³ãã«ã½ã¼ã¹ãè¦ã¦ã¿ãããã¾ããä¸è¨ã®ãµã³ãã«ã¨åæ§ã«æ°ããWindowsããã¸ã§ã¯ããä½ãããã©ã¼ã ä¸ã«3åã®ãã¿ã³ãè²¼ãä»ããã 1: using System; 2: using System.Drawing; 3: using System.Collections; 4: using System.ComponentModel; 5: using System.Windows.Forms; 6: using System.Data; 7: 8: namespace WindowsApplication3 9: { 10:  /// <summary> 11:  /// Form1 ã®æ¦è¦ã®èª¬æã§ãã 12:  /// </summary> 13:  public class Form1 : Syste
ã¦ã£ã³ãã¦ã«ãããã¤ãã³ãã®ä½¿ããæ¹ ã¤ãã³ããæãæ´»èºããã®ã¯ã¦ã£ã³ãã¦ã®ã¤ãã³ãå¦çã ãããå®éã®ä½¿ããæ¹ãè¦ã¦ã¿ããã以ä¸ã®ãµã³ãã«ã¯ä»¥ä¸ã®ããã«ä½æãã¦ãããã¾ããæ°è¦ããã¸ã§ã¯ãã§ãWindowsã¢ããªã±ã¼ã·ã§ã³ãé¸ã¶ãããã¦ããã©ã¼ã ä¸ã«ãã¿ã³ã1åå¼µãä»ããã 1: using System; 2: using System.Drawing; 3: using System.Collections; 4: using System.ComponentModel; 5: using System.Windows.Forms; 6: using System.Data; 7: 8: namespace WindowsApplication2 9: { 10:  /// <summary> 11:  /// Form1 ã®æ¦è¦ã®èª¬æã§ãã 12:  /// </summary
ç¬èªã®ãã³ãã©ç®¡ç é常ãã¤ãã³ãã¸ã®ãã³ãã©ã®è¿½å ã¨åé¤ã¯ãã·ã¹ãã å´ããè³ç«ã¦ãç¨æãã¦ãã¦ããããããèªåã§ã³ã¼ããæ¸ãå¿ è¦ããªããã°ã詳細ãç¥ãå¿ è¦ããªãããããããã³ãã©ã®ç®¡çãããã°ã©ããèªåã§è¨è¿°ãããã¨ãã§ããã以ä¸ãããã®æ¹æ³ã示ããä¾ã§ããã 1: using System; 2: using System.ComponentModel; 3: 4: namespace ConsoleApplication57 5: { 6:  public delegate void SampleEventHandler(object sender, EventArgs e); 7:  class Class1 8:  { 9:    public static event SampleEventHandler sampleEvent 10:    { 11:     Â
ãã¦ãã¦ããã® blogãåºæ¬çã«ã¯ç人åãã«æ¿ã話é¡ã°ã£ããæ¸ãã¦ããã®ã§ãããå®ã¯æè¿ãæ°äººããã®æ¹ã ã«ãå²ã¨èªãã§ããã ãã¦ãããã¨ãå¤æãã¡ãããããã«ããããæå³ä¸æãªã¨ã³ããªãå¤ãã®ã§ã¯ï¼ï¼ ã¨ãæã£ããããã®ã§ããããããªæãã ã¨ãã¾ã«ã¯å²ã¨å ¥éè åãã®ã¨ã³ããªãæ¸ãã¦ã¿ãããªãã¾ãããããªããã§ãä»æ¥ã¯ãã¾ã«ã¯åºæ¬ã«ç«ã¡è¿ã£ã¦ãã¹ã¬ããã¨ãªãã¸ã§ã¯ãã¤ã³ã¹ã¿ã³ã¹ã®è©±é¡ãæ¸ãã¦ã¿ã¾ãããã®ãã¿ãåãä¸ãããã¨æã£ãã®ã¯ããã人ããã®è³ªåã¡ã¼ã«ãï¼ã¡ãã£ã¨å¾®ä¿®æ£ãã¾ããã^^ï¼ ãæè¿ã3 é層ã®ã¢ããªã±ã¼ã·ã§ã³ãã課é¡ã§ä½ã£ã¦ãããã§ããã ããã¦ããã® UI 層ã®å ¥åãã§ãã¯ã¡ã½ãããã ã¡ã³ãã¡ã½ããã«ãã¹ãã static ã¡ã½ããã«ããããèãã¦ãã¦ã ãµã¨æ°ã«ãªã£ããã¨ãããã¾ãã static ã¡ã½ããã ã¨ãã¡ã³ãã¡ã½ããã¨éã£ã¦ãæ¯åã¤ã³ã¹ã¿ã³ã¹ã çæããå¿ è¦
éè¦ ä¸é¨ã®æ å ±ã¯ããªãªã¼ã¹åã«å¤§ããå¤æ´ãããå¯è½æ§ããããã¬ãªãªã¼ã¹ããã製åã«é¢ãããã®ã§ãã Microsoft ã¯ãããã«è¨è¼ããã¦ããæ å ±ã«ã¤ãã¦ãæ示ã¾ãã¯é»ç¤ºãåãããä¸åä¿è¨¼ãã¾ããã public delegate void EventHandler(System::Object ^ sender, EventArgs ^ e); public delegate void EventHandler(object sender, EventArgs e); public delegate void EventHandler(object? sender, EventArgs e); [System.Serializable] public delegate void EventHandler(object sender, EventArgs e); [System.Ser
以ä¸ã®æé ã§ã¯ãã¯ã©ã¹ã«ã¤ãã³ããå®è£ ããæ¹æ³ã«ã¤ãã¦èª¬æãã¾ãã æåã®æé ã§ã¯ãé¢é£ä»ãããããã¼ã¿ãæããªãã¤ãã³ããå®è£ ãã¾ãããã®ã¤ãã³ãã¯ãã¤ãã³ã ãã¼ã¿ã¨ã㦠System.EventArgs ã¯ã©ã¹ã使ç¨ããããªã²ã¼ã ãã³ãã©ã¼ã¨ã㦠System.EventHandler ã¯ã©ã¹ã使ç¨ãã¾ãã 2 çªç®ã®æé ã§ã¯ãã«ã¹ã¿ã ãã¼ã¿ãæã¤ã¤ãã³ããå®è£ ãã¾ãããã®ã¤ãã³ãã¯ãã¤ãã³ã ãã¼ã¿ããã³ã¤ãã³ã ãã³ãã©ã¼ã®ã«ã¹ã¿ã ã¯ã©ã¹ãå®ç¾©ãã¾ãã 注æ ããã§ã¯ãã¯ã©ã¹ã§ã¤ãã³ãã宣è¨ããæ¹æ³ã¨çºçãããæ¹æ³ã«ã¤ãã¦èª¬æãã¾ãããã®ã¤ãã³ããå¦çããã¤ãã³ã ãã³ãã©ã¼ã®å®ç¾©æ¹æ³ã«ã¤ãã¦ã¯èª¬æãã¾ãããã¤ãã³ããå¦çããæ¹æ³ã«ã¤ãã¦ã¯ããã¤ãã³ãã®å©ç¨ãããã³ãæ¹æ³ : ã¤ãã³ããçºçããã/å¦çããããåç §ãã¦ãã ããã ã¤ãã³ãã®çºçã¨å¦çã説æãã詳細ãªãµã³ãã«
ã¢ããªã±ã¼ã·ã§ã³ã§ã¤ãã³ããå©ç¨ããã«ã¯ãã¤ãã³ãã«å¿çãã¦ããã°ã©ã ãã¸ãã¯ãå®è¡ããã¤ãã³ã ãã³ãã©ã¼ (ã¤ãã³ãå¦çã¡ã½ãã) ãç¨æãããã®ã¤ãã³ã ãã³ãã©ã¼ãã¤ãã³ã ã½ã¼ã¹ã«ç»é²ããå¿ è¦ãããã¾ãã ãã®å¦çãã¤ãã³ãæ¥ç¶ã¨å¼ã³ã¾ãã Windows ãã©ã¼ã ç¨ããã³ Web ãã©ã¼ã ç¨ã®ãã¸ã¥ã¢ã« ãã¶ã¤ãã¼ã«ã¯ãã¤ãã³ãæ¥ç¶ã®è©³ç´°ãç°¡åã«ããããé ãããããããã®ãRAD (Rapid Application Development) ãã¼ã«ãç¨æããã¦ãã¾ãã ãã®ãããã¯ã§ã¯ãã¤ãã³ãå¦çã®ä¸è¬çãªãã¿ã¼ã³ã«ã¤ãã¦èª¬æãã¾ãã .NET Framework ã§ã®ã¤ãã³ã ã¢ãã«ã®æ¦è¦ã«ã¤ãã¦ã¯ããã¤ãã³ãã¨ããªã²ã¼ãããåç §ãã¦ãã ããã Windows ãã©ã¼ã ã§ã®ã¤ãã³ã ã¢ãã«ã®è©³ç´°ã«ã¤ãã¦ã¯ããæ¹æ³ : Windows ãã©ã¼ã ã¢ããªã±ã¼ã·ã§ã³ã§ã¤ãã³ã
C#ã®ã¤ãã³ãæ©è½ã¨ã¯ä½ã? C#ã®ã¤ãã³ãæ©è½ã¯ãããã¯ã©ã¹ã§çºçããåºæ¥äºãï¼ãããããç»é²ãããä¸ç¾¤ã®ã¡ã½ããã«å¯¾ãã¦ã1åã®å¼ã³åºãã«ãã£ã¦ãã§ãã¹ã¦ä¼ããæ©è½ã¨è¨ãããã¨è¨ã£ã¦ãããããªèª¬æã§ã¯ãã£ã±ãåãããªãã¨ãã人ã大åã ã¨æãã®ã§ãä»åã¯å®ä¾ãè¦ãªããã1ã¤ãã¤ã¤ãã³ãæ©è½ã®ä½¿ãæ¹ã¨ã使ãæ義ãæ¢ã£ã¦ã¿ããããªããã¤ãã³ãã¯ãã¬ã²ã¼ãã¨å¼ã°ããæ©è½ãæ´»ç¨ãã¦ä½¿ç¨ãããããä»åã®èª¬æã®ä¸ã«ã¯å®ã¯ãã¬ã²ã¼ãã説æãã¦ããé¨åããããããããC#ããã°ã©ãã³ã°ã§ã¯ããã¬ã²ã¼ããåä½ã§ä½¿ãæ©ä¼ããããã¤ãã³ãã¨ãã¦ä½¿ãæ©ä¼ã®æ¹ãé¥ãã«å¤ãã®ã§ããããã¬ã²ã¼ãåä½ã使ãããªãè½åã¯å¿ ãããè¦æ±ãããªãããã¤ãã³ãã¯ã¦ã£ã³ãã¦ã¢ããªã±ã¼ã·ã§ã³ãªã©ãè¨è¿°ããã¨çµ¶å¯¾ã«é¿ãã¦ã¯éããªãã®ã§ããããã®ãããä»åã¯ã¤ãã³ãã¨ãã¦ä¸æ¬ãã¦æ±ã£ãããã詳ãããã¬ã²ã¼ãåä½ã®è§£èª¬ã¯ãããããã®é£è¼ã§
Visual C# ã§æ°ããããã¸ã§ã¯ããä½ã£ã¦ããã©ã¼ã ãã¶ã¤ãã§ä½ããªããã©ã¼ã ã®ä¸ã«ãã¼ã«ããã¯ã¹ãããã¿ã³ãä¸åã ãè²¼ãä»ãã¦ã¿ãããä½è£½ããã button1 ãé¸æãã¦ããã«ã¯ãªãã¯ããã¨ãForm1.cs ãéããã¦button1 ã® Click ã«å¯¾å¿ããã·ã°ã©ãã«ãã³ãã©ã private void button1_Click(object sender, EventArgs e) ããèªåçã«ä½æããã¦ãããããã«ããã¿ã³ãã¯ãªãã¯ãããæã®ããã°ã©ã ãè¨è¿°ãã¦ããã°ããã®ã ãããã®ã¤ãã³ããã³ããã«ã¯ãobject åã® sender 㨠EventArgs åã® e ã¨ããäºã¤ã®å¼æ°ã渡ããã¦ããã ã©ããªå¼æ°ãè¿ããã¦ãããã調ã¹ãã«ã¯ããªãã¸ã§ã¯ãã®ToString() ã¡ã½ãããå©ç¨ããã®ã便å©ã ã ä¾ãã°ãsender ã®å 容ãç¥ãããã«ã¯ãForm1 ã«
質å 2012å¹´12æ17æ¥æææ¥ 1:06 EventHandlerå ã§ãã¤ãã³ããçºçããããªãã¸ã§ã¯ãï¼ã¯ã©ã¹ã®ã¡ã³ãï¼ãåç §ãããå ´åãã¡ã³ãã¨senderã®ãã£ã¹ããã©ã¡ãã好ã¾ããã§ããããã ã¤ã¾ããä¸ã®ãããªã¯ã©ã¹ã§ã¯ãobj.MyEventã®ã¤ãã³ããã³ãã©ã¨ãã¦ãobj_MyEvent1ã¨obj_MyEvent2ã®ã©ã¡ãã®ããã«æ¸ãã®ã好ã¾ããã§ããããããã®çç±ããææãã ããã class sample { private EventSourceClass obj; private void obj_MyEvent1(object sender, EventArgs e) { this.obj.DoSomething(); } private void obj_MyEvent2(object sender, EventArgs e) { ((EventSourceC
ã¤ãã³ããã³ãã©ã¨ã¯ãªãããã ã¤ãã³ããã³ãã©ã¯ãããªã²ã¼ãã§ãã (ããªã²ã¼ãããåãããã¼ã£ã¦äººã¯ã³ãã©ã) ç¾èã¯ä¸è¦ã«å¦ããã ã¾ãã¯ãWindowsãã©ã¼ã ã¢ããªã±ã¼ã·ã§ã³ãä½æãã¦ãFormã«ãã¿ã³ãã²ã¨ã¤é ç½®ãã¦ããã¿ã³ãããã«ã¯ãªãã¯ãããªããã¦ã¤ãã³ããã³ãã©ãèªåçæããMessageBoxãç½®ãã ãã¿ã³ãæ¼ãã°ãHellowã¨ã¡ãã»ã¼ã¸ããã¯ã¹ãéãã private void button1_Click(object sender, EventArgs e) { MessageBox.Show("Hellow"); } ã¨ããã§ããã®button1_Clickã¡ã½ããã¯ãªããåãã®ãã ãã®ã¡ã½ãããåç §ããã¨ãä¸è¨ã®ããã«ã³ã¼ããèªåçæããã¦ããã this.button1.Click += new System.EventHandler(this.butt
ã¤ãã³ã ãã³ãã©ã¼ã¯ãã¤ãã³ãã«ãã¤ã³ãããã¦ããã¡ã½ããã§ãã ã¤ãã³ããçºçããã¨ãã¤ãã³ã ãã³ãã©ã¼å ã®ã³ã¼ããå®è¡ããã¾ãã åã¤ãã³ã ãã³ãã©ã¼ã«ã¯ãã¤ãã³ããé©åã«å¦çããããã® 2 ã¤ã®ãã©ã¡ã¼ã¿ã¼ãç¨æããã¦ãã¾ãã 次ã®ä¾ã¯ãButton ã³ã³ããã¼ã«ã® Click ã¤ãã³ãã®ã¤ãã³ã ãã³ãã©ã¼ã示ãããã®ã§ãã Private Sub button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles button1.Click End Sub private void button1_Click(object sender, System.EventArgs e) { } private: void button1_Click(System::Object ^ se
æ´æ° : 2007 å¹´ 11 æ ã¢ããªã±ã¼ã·ã§ã³ã§ã¤ãã³ããå©ç¨ããã«ã¯ãã¤ãã³ãã«å¿çãã¦ããã°ã©ã ãã¸ãã¯ãå®è¡ããã¤ãã³ã ãã³ãã© (ã¤ãã³ãå¦çã¡ã½ãã) ãç¨æãããã®ã¤ãã³ã ãã³ãã©ãã¤ãã³ã ã½ã¼ã¹ã«ç»é²ããå¿ è¦ãããã¾ãããã®å¦çãã¤ãã³ãæ¥ç¶ã¨å¼ã³ã¾ããWindows ãã©ã¼ã ç¨ããã³ Web ãã©ã¼ã ç¨ã®ãã¸ã¥ã¢ã« ãã¶ã¤ãã«ã¯ãã¤ãã³ãæ¥ç¶ã®è©³ç´°ãç°¡åã«ããããé ãããããããã®ãRAD (Rapid Application Development) ãã¼ã«ãç¨æããã¦ãã¾ãã ãã®ãããã¯ã§ã¯ãã¤ãã³ãå¦çã®ä¸è¬çãªãã¿ã¼ã³ã«ã¤ãã¦èª¬æãã¾ãã.NET Framework ã§ã®ã¤ãã³ã ã¢ãã«ã®æ¦è¦ã«ã¤ãã¦ã¯ããã¤ãã³ãã¨ããªã²ã¼ãããåç §ãã¦ãã ãããWindows ãã©ã¼ã ã§ã®ã¤ãã³ã ã¢ãã«ã®è©³ç´°ã«ã¤ãã¦ã¯ããæ¹æ³ : Windows ãã©ã¼ã ã¢ããª
ãªãªã¼ã¹ãé害æ å ±ãªã©ã®ãµã¼ãã¹ã®ãç¥ãã
ææ°ã®äººæ°ã¨ã³ããªã¼ã®é ä¿¡
å¦çãå®è¡ä¸ã§ã
j次ã®ããã¯ãã¼ã¯
kåã®ããã¯ãã¼ã¯
lãã¨ã§èªã
eã³ã¡ã³ãä¸è¦§ãéã
oãã¼ã¸ãéã
{{#tags}}- {{label}}
{{/tags}}