OSDN Git Service

最小化時に落ちる不具合の修正,#regionの設定
[fugashi/fugashi.git] / Fugashi / BitSwitches4.cs
1 /*\r
2  *      Fugashi Project\r
3  *\r
4  *      This software is distributed under a BSD-style license.\r
5  *      See license.txt for more information.\r
6  */\r
7 \r
8 using System;\r
9 using System.Collections.Generic;\r
10 using System.ComponentModel;\r
11 using System.Drawing;\r
12 using System.Data;\r
13 using System.Text;\r
14 using System.Windows.Forms;\r
15 \r
16 namespace Fugashi\r
17 {\r
18     public partial class BitSwitches4 : UserControl\r
19     {\r
20         #region fields\r
21         private int startBit;\r
22         #endregion\r
23 \r
24         #region constructor\r
25 \r
26         public BitSwitches4()\r
27         {\r
28             InitializeComponent();\r
29         }\r
30         #endregion\r
31 \r
32         #region properties\r
33         [CategoryAttribute("Data")]\r
34         [DefaultValue(typeof(int), "-1")]\r
35         public int StartBit\r
36         {\r
37             get\r
38             {\r
39                 return startBit;\r
40             }\r
41             set\r
42             {\r
43                 startBit = value;\r
44                 Coordinate();\r
45             }\r
46         }\r
47 \r
48         public BitSwitch B0\r
49         {\r
50             get \r
51             {\r
52                 return b0;\r
53             }\r
54         }\r
55 \r
56         public BitSwitch B1\r
57         {\r
58             get\r
59             {\r
60                 return b1;\r
61             }\r
62         }\r
63 \r
64         public BitSwitch B2\r
65         {\r
66             get\r
67             {\r
68                 return b2;\r
69             }\r
70         }\r
71 \r
72         public BitSwitch B3\r
73         {\r
74             get\r
75             {\r
76                 return b3;\r
77             }\r
78         }\r
79         #endregion\r
80 \r
81         #region private methods\r
82         private void Coordinate()\r
83         {\r
84             int y = startBit < 32 ? label.Size.Height : 0;\r
85             table.Location = new Point(table.Location.X, y);\r
86             int labelY = startBit < 32 ? 0 : b0.Size.Height;\r
87             label.Location = new Point(label.Location.X, labelY);\r
88             label.Text = startBit.ToString();\r
89             PerformAutoScale();\r
90             PerformLayout();\r
91         }\r
92 \r
93         private void BitSwitches4_SizeChanged(object sender, EventArgs e)\r
94         {\r
95             table.Width = Width - Margin.Left - Margin.Right;\r
96             table.Height = Height - label.Height - Margin.Bottom - Margin.Top;\r
97             int y = startBit < 32 ? label.Size.Height : 0;\r
98             table.Location = new Point(table.Location.X, y);\r
99         }\r
100         #endregion\r
101     }\r
102 }\r