{"id":1436,"date":"2008-10-17T23:54:00","date_gmt":"2008-10-17T14:54:00","guid":{"rendered":"https:\/\/hdmr.org\/d\/?e=157"},"modified":"2008-10-17T23:54:00","modified_gmt":"2008-10-17T14:54:00","slug":"blogn-157","status":"publish","type":"post","link":"https:\/\/hdmr.org\/d\/?e=157","title":{"rendered":"\u3053\u3064\u3053\u3064Form\u3092\u7d44\u307f\u7acb\u3066\u3066\u3044\u304d\u307e\u3057\u3087\u3046\u304b"},"content":{"rendered":"<p>\u30a4\u30f3\u30bf\u30fc\u30cd\u30c3\u30c8\u306e\u30cb\u30e5\u30fc\u30b9\u3092\u898b\u3066\u308b\u3068\u3001\u3084\u305f\u3089\u3001\u300c\u65e5\u672c\u306e\u6b7b\u5211\u5236\u5ea6\u306b\u4e0d\u6e80\u76f8\u6b21\u3050\u300d\u3068\u304b\u66f8\u3044\u3066\u3042\u308b\u3002<br \/>\u306a\u3093\u305e\u3084\u3068\u601d\u3063\u3066\u8aad\u3093\u3067\u307f\u308b\u3068\u3001\u56fd\u9023\u304b\u3089\u3048\u3089\u3044\u3044\u308d\u3044\u308d\u8a00\u308f\u308c\u305f\u3068\u3002<br \/>\u307e\u3041\u5f53\u7136\u3068\u8a00\u3048\u3070\u5f53\u7136\u306a\u3093\u3067\u3059\u3051\u3069\u306d\u3002<br \/>\u3057\u304b\u3057\u3001\u3044\u304f\u3089\u56fd\u9023\u304c\u5727\u529b\u3092\u304b\u3051\u3066\u304d\u3066\u3001\u6cd5\u52d9\u7701\u304c\u300c\u5211\u6cd5\u7b49\u306e\u4e00\u90e8\u3092\u6539\u6b63\u3059\u308b\u6cd5\u5f8b\u300d\u3068\u304b\u51fa\u3057\u3066\u3001<br \/>\u6b7b\u5211\u3092\u5ec3\u6b62\u3057\u3088\u3046\u3068\u3057\u3066\u3082\u3001\u56fd\u4f1a\u3092\u901a\u3089\u306a\u3044\u3068\u610f\u5473\u304c\u306a\u3044\u3002<br \/>\u307e\u3041\u305d\u3046\u3044\u3046\u610f\u5473\u3067\u8a00\u3048\u3070\u3001\u300c\u6b7b\u5211\u5236\u5ea6\u306e\u5b58\u5ec3\u3092\u4e16\u8ad6\u8abf\u67fb\u3067\u6c7a\u3081\u308b\u306e\u306f\u304a\u304b\u3057\u3044\u300d\u3068\u3044\u3046\u306e\u306f\u304a\u304b\u3057\u3044\u308f\u3051\u3067\u3002<br \/>\u305d\u308c\u306f\u305d\u3046\u3068\u3057\u3066\u3001\u304b\u306a\u308a\u60b2\u60e8\u306a\u904b\u7528\u65b9\u6cd5\u306a\u306e\u306f\u78ba\u304b\u3060\u304b\u3089\u3001\u3068\u308a\u3042\u3048\u305a\u305d\u3053\u304b\u3089\u304b\u3002<br \/>\u77e5\u3089\u3055\u308c\u3066\u304b\u3089\u6bba\u3055\u308c\u308b\u307e\u3067\u305d\u3093\u306a\u306b\u6642\u9593\u304c\u306a\u3044\u3068\u3002\u90e8\u5c4b\u306e\u7247\u4ed8\u3051\u3082\u3067\u304d\u306a\u3044\u3068\u3059\u3089\u8a00\u308f\u308c\u308b\u307b\u3069\u3002<br \/>\u307e\u3041\u3048\u3089\u3044\u3053\u3068\u3067\u3059\u3002\u3053\u3046\u3044\u3046\u3068\u3053\u308d\u304b\u3089\u8abf\u3079\u3066\u3044\u304f\u3068\u308f\u304b\u308b\u3068\u3053\u308d\u3082\u3042\u308b\u306e\u304b\u306a\u3068\u3002<\/p>\n<hr \/>\n<p>\u6700\u8fd1IronPython\u3067\u305d\u308c\u306a\u308a\u306b\u5de8\u5927\u306a\u30d7\u30ed\u30b0\u30e9\u30e0\u3092\u66f8\u3053\u3046\u3068\u3057\u3066\u3044\u308b\u3002<br \/>\u306a\u3093\u3067IronPython\u3084\u306d\u3093\u3068\u3044\u3046\u306e\u306f\u3042\u308b\u304c\u3001\u307e\u3041\u30c7\u30d0\u30c3\u30b0\u304c\u304a\u3082\u3057\u308d\u3044\u304b\u3089\u304b\u3002<br \/>IronPython\u306f\u5b9f\u884c\u3057\u3066\u521d\u3081\u3066\u30a8\u30e9\u30fc\u304c\u3067\u308b\u3068\u3044\u3046\u306e\u304c\u7d50\u69cb\u591a\u3044\u3002<br \/>\u305d\u308a\u3083\u305d\u3046\u3067\u3059\u304c\u3002<br \/>\u307e\u3041\u305d\u308c\u306f\u305d\u3046\u3068\u3001\u30d5\u30a9\u30fc\u30e0\u306e\u4f5c\u308a\u3084\u3059\u3055\u306f\u304b\u306a\u308a\u3059\u3070\u3089\u3057\u3044\u3082\u306e\u304c\u3042\u308a\u307e\u3059\u3002<br \/>\u305d\u308c\u306fVB\u306b\u3057\u3066\u3082C#\u306b\u3057\u3066\u3082\u540c\u3058\u3067\u3059\u304c\u2026<\/p>\n<pre>#encoding:utf-8<br \/>import clr<br \/>clr.AddReferenceByPartialName(\"System.Windows.Forms\")<br \/>clr.AddReferenceByPartialName(\"System.Drawing\")<br \/>import System<br \/>from System.Windows.Forms import Form,Button,FormBorderStyle,MessageBox,MessageBoxButtons,MessageBoxIcon<br \/>def main():<br \/>  myform=Form()<br \/>  myform.Text=\"IronPython\u3067Windows Form\"<br \/>  myform.FormBorderStyle=FormBorderStyle.Fixed3D<br \/>  myform.ClientSize=System.Drawing.Size(500,200)<br \/>  def click(button,e):<br \/>    MessageBox.Show('%s\u306e\u30dc\u30bf\u30f3\u304c\u62bc\u3055\u308c\u307e\u3057\u305f!!'%button.Text,'\u304a\u305b\u3063\u304b\u3044\u60c5\u5831',MessageBoxButtons.OK,MessageBoxIcon.Information)<br \/>  for i in range(0,9):<br \/>    for j in range(0,10):<br \/>      button=Button()<br \/>      button.Text=\"(%d,%d)\"%(i,j)<br \/>      button.Size=System.Drawing.Size(50,20)<br \/>      button.Location=System.Drawing.Point(50*j,20*i)<br \/>      button.Click+=click<br \/>      myform.Controls.Add(button)<br \/>  buttonsdict={}<br \/>  def clickclose(button,e):<br \/>    button.Parent.Close()<br \/>  def clickcolor(button,e):<br \/>    button.Parent.BackColor=getattr(System.Drawing.Color,button.Text)<br \/>  buttonsdict={'Close':clickclose,'Snow':clickcolor,'Khaki':clickcolor,'Plum':clickcolor,'Azure':clickcolor}<br \/>  j=0<br \/>  for key,val in buttonsdict.iteritems():<br \/>    button=Button()<br \/>    button.Text=key<br \/>    button.Size=System.Drawing.Size(50,20)<br \/>    button.Location=System.Drawing.Point(50*j,20*9)<br \/>    j+=1<br \/>    button.Click+=val<br \/>    myform.Controls.Add(button)<br \/>  myform.ShowDialog()<br \/>if(__name__=='__main__'):<br \/>  main()<\/pre>\n<p>System.Windows.Forms\u3082System.Drawing\u3082\u4e21\u65b9\u53c2\u7167\u8a2d\u5b9a\u3092\u8ffd\u52a0\u3059\u308b\u5fc5\u8981\u304c\u3042\u308a\u307e\u3059\u3002<br \/>\u307e\u3041\u305d\u308c\u3067Form\u306e\u30a4\u30f3\u30b9\u30bf\u30f3\u30b9\u4f5c\u3063\u3066\u3001\u3053\u308c\u306bControls.Add\u3067\u30dc\u30bf\u30f3\u3092\u307a\u305f\u307a\u305f\u8cbc\u308a\u4ed8\u3051\u3066\u3044\u304f\u3068\u3002<br \/>\u305d\u308c\u3067\u30a4\u30d9\u30f3\u30c8\u306e\u8ffd\u52a0\u306f\u30e1\u30bd\u30c3\u30c9\u3092\u4ee3\u5165\u3059\u308b\u3060\u3051\u3067OK\u3002<br \/>\u305d\u306e\u30e1\u30bd\u30c3\u30c9\u306f\u30e1\u30bd\u30c3\u30c9\u5185\u306b\u4f5c\u308b\u3068\u4fbf\u5229\u304b\u3082\u77e5\u308c\u306a\u3044\u3002<br \/>\u6700\u5f8c\u306bShowDialog\u3067\u8868\u793a\u3055\u305b\u3066\u308b\u3002<br \/>\u4ed6\u306b\u3044\u3044\u3084\u308a\u65b9\u304c\u3042\u308b\u3088\u3046\u306a\u6c17\u304c\u3059\u308b\u304c\u3001ShowDialog\u304c\u307e\u3041\u6271\u3044\u3084\u3059\u3044\u304b\u306a\u3068\u3002<br \/>\u3059\u308c\u3070\u3001(1,1)\u3092\u30af\u30ea\u30c3\u30af\u3059\u308b\u3068\u3001\u300c(1,1)\u306e\u30dc\u30bf\u30f3\u304c\u62bc\u3055\u308c\u307e\u3057\u305f!!\u300d\u306e\u30c0\u30a4\u30a2\u30ed\u30b0\u304c\u3001<br \/>Snow\u3092\u30af\u30ea\u30c3\u30af\u3059\u308c\u3070\u80cc\u666f\u8272\u304c\u96ea\u8272\u306b\u3001Close\u306f\u9589\u3058\u3089\u308c\u308b\u3002<\/p>\n<hr \/>\n<p>\u57fa\u672c\u7684\u306b\u306f\u4e0a\u306e\u3088\u3046\u306b\u3059\u308c\u3070\u3001\u3044\u308d\u3093\u306a\u30d5\u30a9\u30fc\u30e0\u304c\u4f5c\u308c\u307e\u3059\u306d\u3002<br \/>\u8907\u96d1\u306a\u30d5\u30a9\u30fc\u30e0\u3092\u3001System.Windows.Forms.Form\u3092\u7d99\u627f\u3057\u305f\u30af\u30e9\u30b9\u3092\u4f5c\u3063\u3066\u4f5c\u3063\u3066\u3082\u3088\u308d\u3057\u3044\u3057\u3001<br \/>\u307e\u3041\u3044\u308d\u3044\u308d\u3084\u308a\u65b9\u306f\u3042\u308b\u3067\u3057\u3087\u3046\u3002<br \/>\u3068\u3053\u308d\u3067\u3001clickcolor\u30e1\u30bd\u30c3\u30c9\u306bgetattr(System.Drawing.Color,button.Text)\u3068\u3044\u3046\u306e\u304c\u3042\u308b\u3002<br \/>\u3053\u308c\u306a\u3093\u3060\u304c\u3001Python\u306e\u30ea\u30d5\u30ec\u30af\u30b7\u30e7\u30f3\u3089\u3057\u3044\u3002<br \/>\u4f55\u304c\u3084\u308a\u305f\u3044\u304b\u3068\u3044\u3046\u3068\u3001button.Text\u304c&#8221;White&#8221;\u306a\u3089\u3070\u3001System.Drawing.Color.White\u3092\u53d6\u5f97\u3057\u305f\u3044\u3068\u3002<br \/>\u306a\u3093\u304b\u5909\u306a\u3053\u3068\u3092\u3084\u3063\u3066\u307e\u3059\u3051\u3069\u306d\u3002<br \/>\u3044\u308d\u3044\u308d\u8abf\u3079\u3066\u305f\u304c\u3001\u3046\u307e\u304f\u5b9f\u73fe\u3067\u304d\u305f\u306e\u3067\u66f8\u3044\u3066\u307f\u305f\u3002<br \/>getattr(T,&#8217;attr&#8217;)\u306fT.attr\u3068\u66f8\u304f\u3053\u3068\u3068\u540c\u3058\u3067\u3042\u308b\u3068\u3002<br \/>\u540c\u69d8\u306e\u3053\u3068\u3092.NET Framework\u3092\u4f7f\u3063\u3066C#\u3067\u66f8\u304f\u3068\u3053\u3046\u306a\u308b\u306e\u304b\u306a\u2026<\/p>\n<pre>typeof(System.Drawing.Color).GetProperty(button.Text).GetValue(null,null)<\/pre>\n<p>GetValue\u306e\u5f15\u6570\u306e1\u3064\u76ee\u306f\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u30012\u3064\u76ee\u306f\u30a4\u30f3\u30c7\u30af\u30b5\u306e\u5f15\u6570\u3089\u3057\u3044\u3002<br \/>\u3057\u304b\u3057\u3001\u3053\u306eSystem.Drawing.Color.Snow\u3068\u304b\u306f\u3001\u9759\u7684\u30d7\u30ed\u30d1\u30c6\u30a3\u3060\u304b\u3089\u3001<br \/>\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u3092\u5f15\u6570\u306b\u53d6\u308b\u3068\u8a00\u308f\u308c\u3066\u3082\u306a\u3044\u306e\u3067\u3001null\u3002\u5f53\u7136\u30a4\u30f3\u30c7\u30af\u30b5\u3058\u3083\u306a\u3044\u306e\u3067\u3053\u308c\u3082null\u3002<br \/>\u3068\u3044\u3046\u308f\u3051\u3067\u3059\u304c\u3001\u307e\u3041\u305b\u3063\u304b\u304fPython\u306a\u3089\u3070Python\u306e\u305d\u308c\u3092\u4f7f\u3048\u3070\u3044\u3044\u306e\u3067\u305d\u308c\u3067OK\u3068\u3002<br \/>\u3068\u307e\u3041\u3001IronPython\u3067\u30d5\u30a9\u30fc\u30e0\u3092\u4f5c\u3063\u3066\u307f\u305f\u304c\u3001<br \/>\u3069\u3061\u3089\u304b\u3068\u3044\u3046\u3068C#\u3068\u304b\u3067\u4f5c\u3063\u305f\u30d5\u30a9\u30fc\u30e0\u3092IronPython\u304c\u64cd\u4f5c\u3059\u308b\u3068\u3044\u3046\u65b9\u304c\u6d41\u884c\u307f\u305f\u3044\u3060\u3051\u3069\u306d\u3002<br \/>\u307e\u3041\u305d\u306e\u8fba\u306f\u3044\u308d\u3044\u308d\u3042\u308b\u3068\u601d\u3046\u3057\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u30a4\u30f3\u30bf\u30fc\u30cd\u30c3\u30c8\u306e\u30cb\u30e5\u30fc\u30b9\u3092\u898b\u3066\u308b\u3068\u3001\u3084\u305f\u3089\u3001\u300c\u65e5\u672c\u306e\u6b7b\u5211\u5236\u5ea6\u306b\u4e0d\u6e80\u76f8\u6b21\u3050\u300d\u3068\u304b\u66f8\u3044\u3066\u3042\u308b\u3002\u306a\u3093\u305e\u3084\u3068\u601d\u3063\u3066\u8aad\u3093\u3067\u307f\u308b\u3068\u3001\u56fd\u9023\u304b\u3089\u3048\u3089\u3044\u3044\u308d\u3044\u308d\u8a00\u308f\u308c\u305f\u3068\u3002\u307e\u3041\u5f53\u7136\u3068\u8a00\u3048\u3070\u5f53\u7136\u306a\u3093\u3067\u3059\u3051\u3069\u306d\u3002\u3057\u304b\u3057\u3001\u3044\u304f\u3089\u56fd\u9023\u304c\u5727\u529b\u3092\u304b\u3051 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4],"tags":[],"class_list":["post-1436","post","type-post","status-publish","format-standard","hentry","category-computer"],"_links":{"self":[{"href":"https:\/\/hdmr.org\/d\/index.php?rest_route=\/wp\/v2\/posts\/1436","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/hdmr.org\/d\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/hdmr.org\/d\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/hdmr.org\/d\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/hdmr.org\/d\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1436"}],"version-history":[{"count":0,"href":"https:\/\/hdmr.org\/d\/index.php?rest_route=\/wp\/v2\/posts\/1436\/revisions"}],"wp:attachment":[{"href":"https:\/\/hdmr.org\/d\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1436"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/hdmr.org\/d\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1436"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/hdmr.org\/d\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1436"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}