(構造化 COBOL で GOTO 使用禁止運動が起きたのと同様、CUIアプリケーションでは new キーワードを使用禁止にすべきです )
| 1 | using System; |
| 2 | using SYS; |
| 3 | using Fz; |
| 4 | using Fz.Widgets; |
| 5 | using Fz.Widgets.ValueTypes; |
| 6 | |
| 7 | namespace ZKMK_KSN_PRG |
| 8 | { |
| 9 | public class START_ROUTINE : Form |
| 10 | { |
| 11 | |
| 12 | public static Label W_HDI_LBL = new Label(); |
| 13 | |
| 14 | public static Label W_ZBT_HDI_LBL = new Label(); |
| 15 | |
| 16 | public static TextField W_ZBT_NRK_TXT = new TextField(); |
| 17 | |
| 18 | public static Label W_ZKM_HDI_LBL = new Label(); |
| 19 | |
| 20 | public static Label W_ZKM_DSP_LBL = new Label(); |
| 21 | |
| 22 | public static PushButton W_KSN_BTN = new PushButton(); |
| 23 | |
| 24 | public static PushButton W_SRO_BTN = new PushButton(); |
| 25 | |
| 26 | public static Form W_PROG_GMN; |
| 27 | |
| 28 | public static int W_ZBT_KKK_DATA; |
| 29 | |
| 30 | public static int W_ZKM_KKK_DATA; |
| 31 | |
| 32 | public static string W_NRK_DATA; |
| 33 | |
| 34 | public static string W_DSP_DATA; |
| 35 | |
| 36 | |
| 37 | |
| 38 | |
| 39 | |
| 40 | public static void START_ROUTINE_0001( Object I_SSN_DATA, EventArgs I_EVNT_DATA ) |
| 41 | { |
| 42 | |
| 43 | |
| 44 | |
| 45 | CLIB.INITIALIZE( out W_ZBT_KKK_DATA ); |
| 46 | CLIB.INITIALIZE( out W_ZKM_KKK_DATA ); |
| 47 | CLIB.INITIALIZE( out W_NRK_DATA ); |
| 48 | CLIB.INITIALIZE( out W_DSP_DATA ); |
| 49 | |
| 50 | |
| 51 | |
| 52 | |
| 53 | |
| 54 | W_PROG_GMN.FormLayout.FractionBase = 14; |
| 55 | |
| 56 | |
| 57 | W_HDI_LBL.Text = "消費税計算プログラム"; |
| 58 | W_HDI_LBL.TopAnchor = WidgetLayout.ByPosition( 0 ); |
| 59 | W_HDI_LBL.BottomAnchor = WidgetLayout.ByPosition( 1 ); |
| 60 | W_HDI_LBL.LeftAnchor = W_HDI_LBL.RightAnchor = WidgetLayout.ByForm( 2 ); |
| 61 | |
| 62 | |
| 63 | W_ZBT_HDI_LBL.Text = "税別価格"; |
| 64 | W_ZBT_HDI_LBL.TopAnchor = WidgetLayout.ByPosition( 2 ); |
| 65 | W_ZBT_HDI_LBL.BottomAnchor = WidgetLayout.ByPosition( 3 ); |
| 66 | W_ZBT_HDI_LBL.LeftAnchor = W_ZBT_HDI_LBL.RightAnchor = WidgetLayout.ByForm( 2 ); |
| 67 | |
| 68 | |
| 69 | W_ZBT_NRK_TXT.Text = ""; |
| 70 | W_ZBT_NRK_TXT.TopAnchor = WidgetLayout.ByPosition( 3 ); |
| 71 | W_ZBT_NRK_TXT.BottomAnchor = WidgetLayout.ByPosition( 5 ); |
| 72 | W_ZBT_NRK_TXT.LeftAnchor = W_ZBT_NRK_TXT.RightAnchor = WidgetLayout.ByForm( 2 ); |
| 73 | |
| 74 | |
| 75 | W_ZKM_HDI_LBL.Text = "税込価格"; |
| 76 | W_ZKM_HDI_LBL.TopAnchor = WidgetLayout.ByPosition( 6 ); |
| 77 | W_ZKM_HDI_LBL.BottomAnchor = WidgetLayout.ByPosition( 7 ); |
| 78 | W_ZKM_HDI_LBL.LeftAnchor = W_ZKM_HDI_LBL.RightAnchor = WidgetLayout.ByForm( 2 ); |
| 79 | |
| 80 | |
| 81 | W_ZKM_DSP_LBL.Text = ""; |
| 82 | W_ZKM_DSP_LBL.BorderWidth = 1; |
| 83 | W_ZKM_DSP_LBL.TopAnchor = WidgetLayout.ByPosition( 7 ); |
| 84 | W_ZKM_DSP_LBL.BottomAnchor = WidgetLayout.ByPosition( 9 ); |
| 85 | W_ZKM_DSP_LBL.LeftAnchor = W_ZKM_DSP_LBL.RightAnchor = WidgetLayout.ByForm( 2 ); |
| 86 | |
| 87 | |
| 88 | W_KSN_BTN.Text = "計算"; |
| 89 | W_KSN_BTN.TopAnchor = WidgetLayout.ByPosition( 10 ); |
| 90 | W_KSN_BTN.BottomAnchor = WidgetLayout.ByPosition( 12 ); |
| 91 | W_KSN_BTN.LeftAnchor = W_KSN_BTN.RightAnchor = WidgetLayout.ByForm( 2 ); |
| 92 | W_KSN_BTN.Click += new EventHandler( START_ROUTINE_0002 ); |
| 93 | |
| 94 | |
| 95 | W_SRO_BTN.Text = "終了"; |
| 96 | W_SRO_BTN.TopAnchor = WidgetLayout.ByPosition( 12 ); |
| 97 | W_SRO_BTN.BottomAnchor = WidgetLayout.ByPosition( 14 ); |
| 98 | W_SRO_BTN.LeftAnchor = W_SRO_BTN.RightAnchor = WidgetLayout.ByForm( 2 ); |
| 99 | W_SRO_BTN.Click += new EventHandler( START_ROUTINE_0003 ); |
| 100 | |
| 101 | |
| 102 | W_PROG_GMN.Controls.Add( W_HDI_LBL ); |
| 103 | W_PROG_GMN.Controls.Add( W_ZBT_HDI_LBL ); |
| 104 | W_PROG_GMN.Controls.Add( W_ZBT_NRK_TXT ); |
| 105 | W_PROG_GMN.Controls.Add( W_ZKM_HDI_LBL ); |
| 106 | W_PROG_GMN.Controls.Add( W_ZKM_DSP_LBL ); |
| 107 | W_PROG_GMN.Controls.Add( W_KSN_BTN ); |
| 108 | W_PROG_GMN.Controls.Add( W_SRO_BTN ); |
| 109 | |
| 110 | } |
| 111 | |
| 112 | |
| 113 | |
| 114 | |
| 115 | |
| 116 | public static void START_ROUTINE_0002( Object I_SSN_DATA, EventArgs I_EVNT_DATA ) |
| 117 | { |
| 118 | |
| 119 | CLIB.MOVE( W_ZBT_NRK_TXT.Text, ref W_NRK_DATA ); |
| 120 | |
| 121 | if( W_NRK_DATA != "" ) |
| 122 | { |
| 123 | |
| 124 | if( W_NRK_DATA == "999" ) |
| 125 | { |
| 126 | |
| 127 | W_PROG_GMN.Destroy(); |
| 128 | |
| 129 | return; |
| 130 | } |
| 131 | try |
| 132 | { |
| 133 | |
| 134 | CLIB.MOVE( int.Parse( W_NRK_DATA ), ref W_ZBT_KKK_DATA ); |
| 135 | }catch( Exception ) |
| 136 | { |
| 137 | |
| 138 | throw new S0C7(); |
| 139 | } |
| 140 | |
| 141 | |
| 142 | |
| 143 | |
| 144 | MK0001.MK0001_0001( ref W_ZKM_KKK_DATA, W_ZBT_KKK_DATA ); |
| 145 | |
| 146 | |
| 147 | |
| 148 | |
| 149 | |
| 150 | CLIB.MOVE( "税込価格:" + W_ZKM_KKK_DATA.ToString() + "円", ref W_DSP_DATA ); |
| 151 | |
| 152 | |
| 153 | W_ZKM_DSP_LBL.Text = W_DSP_DATA; |
| 154 | } |
| 155 | |
| 156 | } |
| 157 | |
| 158 | |
| 159 | |
| 160 | |
| 161 | |
| 162 | public static void START_ROUTINE_0003( Object I_SSN_DATA, EventArgs I_EVNT_DATA ) |
| 163 | { |
| 164 | |
| 165 | W_PROG_GMN.Destroy(); |
| 166 | } |
| 167 | |
| 168 | |
| 169 | |
| 170 | |
| 171 | public static int Main( string [] I_SYSIN ) |
| 172 | { |
| 173 | |
| 174 | W_PROG_GMN = new START_ROUTINE(); |
| 175 | W_PROG_GMN.Load += new EventHandler( START_ROUTINE_0001 ); |
| 176 | |
| 177 | |
| 178 | Application.Run( W_PROG_GMN ); |
| 179 | |
| 180 | return CLIB.RETURN_CODE; |
| 181 | } |
| 182 | } |
| 183 | } |
| 184 | |