質問編集履歴
6
不要な追記の削除
title
CHANGED
File without changes
|
body
CHANGED
@@ -12,174 +12,4 @@
|
|
12
12
|
### 試したこと
|
13
13
|
・ボタン2(button2)を(100, 100)の位置に`Form1.cs[デザイン]`にて手動で配置して`Console.WriteLine(button2);`として実行すると出力には`{X=75,Y=80}`と出る
|
14
14
|
・ボタン1(button1)を`button1.Location = new Point(100, 100);`でボタン2((100, 100)に手動で配置)に重ねようとしても、右下にずれて表示される
|
15
|
-
・新規プロジェクトを作成してボタン2つだけ配置して試しても同様
|
15
|
+
・新規プロジェクトを作成してボタン2つだけ配置して試しても同様
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
追記
|
20
|
-
以下、app.config
|
21
|
-
```C#
|
22
|
-
<?xml version="1.0" encoding="utf-8" ?>
|
23
|
-
<configuration>
|
24
|
-
<System.Windows.Forms.ApplicationConfigurationSection>
|
25
|
-
<add key="DpiAwareness" value="PerMonitorV2" />
|
26
|
-
<add key="EnableWindowsFormsHighDpiAutoResizing" value="false" />
|
27
|
-
</System.Windows.Forms.ApplicationConfigurationSection>
|
28
|
-
</configuration>
|
29
|
-
```
|
30
|
-
以下、Form1.Designer.cs
|
31
|
-
```C#
|
32
|
-
namespace typing_game
|
33
|
-
{
|
34
|
-
partial class Form1
|
35
|
-
{
|
36
|
-
/// <summary>
|
37
|
-
/// 必要なデザイナー変数です。
|
38
|
-
/// </summary>
|
39
|
-
private System.ComponentModel.IContainer components = null;
|
40
|
-
|
41
|
-
/// <summary>
|
42
|
-
/// 使用中のリソースをすべてクリーンアップします。
|
43
|
-
/// </summary>
|
44
|
-
/// <param name="disposing">マネージド リソースを破棄する場合は true を指定し、その他の場合は false を指定します。</param>
|
45
|
-
protected override void Dispose(bool disposing)
|
46
|
-
{
|
47
|
-
if (disposing && (components != null))
|
48
|
-
{
|
49
|
-
components.Dispose();
|
50
|
-
}
|
51
|
-
base.Dispose(disposing);
|
52
|
-
}
|
53
|
-
|
54
|
-
#region Windows フォーム デザイナーで生成されたコード
|
55
|
-
|
56
|
-
/// <summary>
|
57
|
-
/// デザイナー サポートに必要なメソッドです。このメソッドの内容を
|
58
|
-
/// コード エディターで変更しないでください。
|
59
|
-
/// </summary>
|
60
|
-
private void InitializeComponent()
|
61
|
-
{
|
62
|
-
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(Form1));
|
63
|
-
this.axWindowsMediaPlayer1 = new AxWMPLib.AxWindowsMediaPlayer();
|
64
|
-
this.makeButton = new System.Windows.Forms.Button();
|
65
|
-
this.gameTitle = new System.Windows.Forms.Label();
|
66
|
-
this.playButton = new System.Windows.Forms.Button();
|
67
|
-
this.titlePanel = new System.Windows.Forms.Panel();
|
68
|
-
this.button1 = new System.Windows.Forms.Button();
|
69
|
-
this.button2 = new System.Windows.Forms.Button();
|
70
|
-
this.button3 = new System.Windows.Forms.Button();
|
71
|
-
((System.ComponentModel.ISupportInitialize)(this.axWindowsMediaPlayer1)).BeginInit();
|
72
|
-
this.titlePanel.SuspendLayout();
|
73
|
-
this.SuspendLayout();
|
74
|
-
//
|
75
|
-
// axWindowsMediaPlayer1
|
76
|
-
//
|
77
|
-
this.axWindowsMediaPlayer1.Enabled = true;
|
78
|
-
this.axWindowsMediaPlayer1.Location = new System.Drawing.Point(94, 360);
|
79
|
-
this.axWindowsMediaPlayer1.Name = "axWindowsMediaPlayer1";
|
80
|
-
this.axWindowsMediaPlayer1.OcxState = ((System.Windows.Forms.AxHost.State)(resources.GetObject("axWindowsMediaPlayer1.OcxState")));
|
81
|
-
this.axWindowsMediaPlayer1.Size = new System.Drawing.Size(559, 44);
|
82
|
-
this.axWindowsMediaPlayer1.TabIndex = 0;
|
83
|
-
//
|
84
|
-
// makeButton
|
85
|
-
//
|
86
|
-
this.makeButton.Font = new System.Drawing.Font("MS UI Gothic", 20F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(128)));
|
87
|
-
this.makeButton.Location = new System.Drawing.Point(144, 274);
|
88
|
-
this.makeButton.Name = "makeButton";
|
89
|
-
this.makeButton.Size = new System.Drawing.Size(167, 57);
|
90
|
-
this.makeButton.TabIndex = 1;
|
91
|
-
this.makeButton.Text = "つくる";
|
92
|
-
this.makeButton.UseVisualStyleBackColor = true;
|
93
|
-
this.makeButton.Click += new System.EventHandler(this.makeButton_Click);
|
94
|
-
//
|
95
|
-
// gameTitle
|
96
|
-
//
|
97
|
-
this.gameTitle.Font = new System.Drawing.Font("MS 明朝", 70.2F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(128)));
|
98
|
-
this.gameTitle.ForeColor = System.Drawing.Color.LightSeaGreen;
|
99
|
-
this.gameTitle.Location = new System.Drawing.Point(12, 52);
|
100
|
-
this.gameTitle.Name = "gameTitle";
|
101
|
-
this.gameTitle.Size = new System.Drawing.Size(776, 138);
|
102
|
-
this.gameTitle.TabIndex = 2;
|
103
|
-
this.gameTitle.Text = "Typing Game";
|
104
|
-
this.gameTitle.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
|
105
|
-
//
|
106
|
-
// playButton
|
107
|
-
//
|
108
|
-
this.playButton.Font = new System.Drawing.Font("MS UI Gothic", 20F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(128)));
|
109
|
-
this.playButton.Location = new System.Drawing.Point(456, 274);
|
110
|
-
this.playButton.Name = "playButton";
|
111
|
-
this.playButton.Size = new System.Drawing.Size(167, 57);
|
112
|
-
this.playButton.TabIndex = 3;
|
113
|
-
this.playButton.Text = "あそぶ";
|
114
|
-
this.playButton.UseVisualStyleBackColor = true;
|
115
|
-
//
|
116
|
-
// titlePanel
|
117
|
-
//
|
118
|
-
this.titlePanel.Controls.Add(this.button3);
|
119
|
-
this.titlePanel.Controls.Add(this.playButton);
|
120
|
-
this.titlePanel.Controls.Add(this.gameTitle);
|
121
|
-
this.titlePanel.Controls.Add(this.makeButton);
|
122
|
-
this.titlePanel.Location = new System.Drawing.Point(607, 168);
|
123
|
-
this.titlePanel.Name = "titlePanel";
|
124
|
-
this.titlePanel.Size = new System.Drawing.Size(800, 450);
|
125
|
-
this.titlePanel.TabIndex = 4;
|
126
|
-
//
|
127
|
-
// button1
|
128
|
-
//
|
129
|
-
this.button1.Location = new System.Drawing.Point(0, 0);
|
130
|
-
this.button1.Name = "button1";
|
131
|
-
this.button1.Size = new System.Drawing.Size(75, 23);
|
132
|
-
this.button1.TabIndex = 5;
|
133
|
-
this.button1.Text = "button1";
|
134
|
-
this.button1.UseVisualStyleBackColor = true;
|
135
|
-
//
|
136
|
-
// button2
|
137
|
-
//
|
138
|
-
this.button2.Location = new System.Drawing.Point(100, 100);
|
139
|
-
this.button2.Name = "button2";
|
140
|
-
this.button2.Size = new System.Drawing.Size(75, 23);
|
141
|
-
this.button2.TabIndex = 6;
|
142
|
-
this.button2.Text = "button2";
|
143
|
-
this.button2.UseVisualStyleBackColor = true;
|
144
|
-
//
|
145
|
-
// button3
|
146
|
-
//
|
147
|
-
this.button3.Location = new System.Drawing.Point(0, 0);
|
148
|
-
this.button3.Name = "button3";
|
149
|
-
this.button3.Size = new System.Drawing.Size(75, 23);
|
150
|
-
this.button3.TabIndex = 7;
|
151
|
-
this.button3.Text = "button3";
|
152
|
-
this.button3.UseVisualStyleBackColor = true;
|
153
|
-
//
|
154
|
-
// Form1
|
155
|
-
//
|
156
|
-
this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 15F);
|
157
|
-
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
158
|
-
this.ClientSize = new System.Drawing.Size(800, 450);
|
159
|
-
this.Controls.Add(this.button2);
|
160
|
-
this.Controls.Add(this.button1);
|
161
|
-
this.Controls.Add(this.titlePanel);
|
162
|
-
this.Controls.Add(this.axWindowsMediaPlayer1);
|
163
|
-
this.Name = "Form1";
|
164
|
-
this.Text = "Typing Game";
|
165
|
-
this.Load += new System.EventHandler(this.Form1_Load);
|
166
|
-
((System.ComponentModel.ISupportInitialize)(this.axWindowsMediaPlayer1)).EndInit();
|
167
|
-
this.titlePanel.ResumeLayout(false);
|
168
|
-
this.ResumeLayout(false);
|
169
|
-
|
170
|
-
}
|
171
|
-
|
172
|
-
#endregion
|
173
|
-
|
174
|
-
private AxWMPLib.AxWindowsMediaPlayer axWindowsMediaPlayer1;
|
175
|
-
private System.Windows.Forms.Button makeButton;
|
176
|
-
private System.Windows.Forms.Label gameTitle;
|
177
|
-
private System.Windows.Forms.Button playButton;
|
178
|
-
private System.Windows.Forms.Panel titlePanel;
|
179
|
-
private System.Windows.Forms.Button button1;
|
180
|
-
private System.Windows.Forms.Button button2;
|
181
|
-
private System.Windows.Forms.Button button3;
|
182
|
-
}
|
183
|
-
}
|
184
|
-
|
185
|
-
```
|
5
コードの追記
title
CHANGED
File without changes
|
body
CHANGED
@@ -17,6 +17,16 @@
|
|
17
17
|
|
18
18
|
|
19
19
|
追記
|
20
|
+
以下、app.config
|
21
|
+
```C#
|
22
|
+
<?xml version="1.0" encoding="utf-8" ?>
|
23
|
+
<configuration>
|
24
|
+
<System.Windows.Forms.ApplicationConfigurationSection>
|
25
|
+
<add key="DpiAwareness" value="PerMonitorV2" />
|
26
|
+
<add key="EnableWindowsFormsHighDpiAutoResizing" value="false" />
|
27
|
+
</System.Windows.Forms.ApplicationConfigurationSection>
|
28
|
+
</configuration>
|
29
|
+
```
|
20
30
|
以下、Form1.Designer.cs
|
21
31
|
```C#
|
22
32
|
namespace typing_game
|
4
試したことの追記
title
CHANGED
File without changes
|
body
CHANGED
@@ -9,6 +9,13 @@
|
|
9
9
|
これでデバッグすると、なぜかボタンがドラッグして置いたときよりも右下にずれて表示されます。
|
10
10
|
解決方法を教えてくださると幸いです。
|
11
11
|
|
12
|
+
### 試したこと
|
13
|
+
・ボタン2(button2)を(100, 100)の位置に`Form1.cs[デザイン]`にて手動で配置して`Console.WriteLine(button2);`として実行すると出力には`{X=75,Y=80}`と出る
|
14
|
+
・ボタン1(button1)を`button1.Location = new Point(100, 100);`でボタン2((100, 100)に手動で配置)に重ねようとしても、右下にずれて表示される
|
15
|
+
・新規プロジェクトを作成してボタン2つだけ配置して試しても同様
|
16
|
+
|
17
|
+
|
18
|
+
|
12
19
|
追記
|
13
20
|
以下、Form1.Designer.cs
|
14
21
|
```C#
|
3
コードの追記
title
CHANGED
File without changes
|
body
CHANGED
@@ -10,4 +10,159 @@
|
|
10
10
|
解決方法を教えてくださると幸いです。
|
11
11
|
|
12
12
|
追記
|
13
|
+
以下、Form1.Designer.cs
|
14
|
+
```C#
|
13
|
-
|
15
|
+
namespace typing_game
|
16
|
+
{
|
17
|
+
partial class Form1
|
18
|
+
{
|
19
|
+
/// <summary>
|
20
|
+
/// 必要なデザイナー変数です。
|
21
|
+
/// </summary>
|
22
|
+
private System.ComponentModel.IContainer components = null;
|
23
|
+
|
24
|
+
/// <summary>
|
25
|
+
/// 使用中のリソースをすべてクリーンアップします。
|
26
|
+
/// </summary>
|
27
|
+
/// <param name="disposing">マネージド リソースを破棄する場合は true を指定し、その他の場合は false を指定します。</param>
|
28
|
+
protected override void Dispose(bool disposing)
|
29
|
+
{
|
30
|
+
if (disposing && (components != null))
|
31
|
+
{
|
32
|
+
components.Dispose();
|
33
|
+
}
|
34
|
+
base.Dispose(disposing);
|
35
|
+
}
|
36
|
+
|
37
|
+
#region Windows フォーム デザイナーで生成されたコード
|
38
|
+
|
39
|
+
/// <summary>
|
40
|
+
/// デザイナー サポートに必要なメソッドです。このメソッドの内容を
|
41
|
+
/// コード エディターで変更しないでください。
|
42
|
+
/// </summary>
|
43
|
+
private void InitializeComponent()
|
44
|
+
{
|
45
|
+
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(Form1));
|
46
|
+
this.axWindowsMediaPlayer1 = new AxWMPLib.AxWindowsMediaPlayer();
|
47
|
+
this.makeButton = new System.Windows.Forms.Button();
|
48
|
+
this.gameTitle = new System.Windows.Forms.Label();
|
49
|
+
this.playButton = new System.Windows.Forms.Button();
|
50
|
+
this.titlePanel = new System.Windows.Forms.Panel();
|
51
|
+
this.button1 = new System.Windows.Forms.Button();
|
52
|
+
this.button2 = new System.Windows.Forms.Button();
|
53
|
+
this.button3 = new System.Windows.Forms.Button();
|
54
|
+
((System.ComponentModel.ISupportInitialize)(this.axWindowsMediaPlayer1)).BeginInit();
|
55
|
+
this.titlePanel.SuspendLayout();
|
56
|
+
this.SuspendLayout();
|
57
|
+
//
|
58
|
+
// axWindowsMediaPlayer1
|
59
|
+
//
|
60
|
+
this.axWindowsMediaPlayer1.Enabled = true;
|
61
|
+
this.axWindowsMediaPlayer1.Location = new System.Drawing.Point(94, 360);
|
62
|
+
this.axWindowsMediaPlayer1.Name = "axWindowsMediaPlayer1";
|
63
|
+
this.axWindowsMediaPlayer1.OcxState = ((System.Windows.Forms.AxHost.State)(resources.GetObject("axWindowsMediaPlayer1.OcxState")));
|
64
|
+
this.axWindowsMediaPlayer1.Size = new System.Drawing.Size(559, 44);
|
65
|
+
this.axWindowsMediaPlayer1.TabIndex = 0;
|
66
|
+
//
|
67
|
+
// makeButton
|
68
|
+
//
|
69
|
+
this.makeButton.Font = new System.Drawing.Font("MS UI Gothic", 20F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(128)));
|
70
|
+
this.makeButton.Location = new System.Drawing.Point(144, 274);
|
71
|
+
this.makeButton.Name = "makeButton";
|
72
|
+
this.makeButton.Size = new System.Drawing.Size(167, 57);
|
73
|
+
this.makeButton.TabIndex = 1;
|
74
|
+
this.makeButton.Text = "つくる";
|
75
|
+
this.makeButton.UseVisualStyleBackColor = true;
|
76
|
+
this.makeButton.Click += new System.EventHandler(this.makeButton_Click);
|
77
|
+
//
|
78
|
+
// gameTitle
|
79
|
+
//
|
80
|
+
this.gameTitle.Font = new System.Drawing.Font("MS 明朝", 70.2F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(128)));
|
81
|
+
this.gameTitle.ForeColor = System.Drawing.Color.LightSeaGreen;
|
82
|
+
this.gameTitle.Location = new System.Drawing.Point(12, 52);
|
83
|
+
this.gameTitle.Name = "gameTitle";
|
84
|
+
this.gameTitle.Size = new System.Drawing.Size(776, 138);
|
85
|
+
this.gameTitle.TabIndex = 2;
|
86
|
+
this.gameTitle.Text = "Typing Game";
|
87
|
+
this.gameTitle.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
|
88
|
+
//
|
89
|
+
// playButton
|
90
|
+
//
|
91
|
+
this.playButton.Font = new System.Drawing.Font("MS UI Gothic", 20F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(128)));
|
92
|
+
this.playButton.Location = new System.Drawing.Point(456, 274);
|
93
|
+
this.playButton.Name = "playButton";
|
94
|
+
this.playButton.Size = new System.Drawing.Size(167, 57);
|
95
|
+
this.playButton.TabIndex = 3;
|
96
|
+
this.playButton.Text = "あそぶ";
|
97
|
+
this.playButton.UseVisualStyleBackColor = true;
|
98
|
+
//
|
99
|
+
// titlePanel
|
100
|
+
//
|
101
|
+
this.titlePanel.Controls.Add(this.button3);
|
102
|
+
this.titlePanel.Controls.Add(this.playButton);
|
103
|
+
this.titlePanel.Controls.Add(this.gameTitle);
|
104
|
+
this.titlePanel.Controls.Add(this.makeButton);
|
105
|
+
this.titlePanel.Location = new System.Drawing.Point(607, 168);
|
106
|
+
this.titlePanel.Name = "titlePanel";
|
107
|
+
this.titlePanel.Size = new System.Drawing.Size(800, 450);
|
108
|
+
this.titlePanel.TabIndex = 4;
|
109
|
+
//
|
110
|
+
// button1
|
111
|
+
//
|
112
|
+
this.button1.Location = new System.Drawing.Point(0, 0);
|
113
|
+
this.button1.Name = "button1";
|
114
|
+
this.button1.Size = new System.Drawing.Size(75, 23);
|
115
|
+
this.button1.TabIndex = 5;
|
116
|
+
this.button1.Text = "button1";
|
117
|
+
this.button1.UseVisualStyleBackColor = true;
|
118
|
+
//
|
119
|
+
// button2
|
120
|
+
//
|
121
|
+
this.button2.Location = new System.Drawing.Point(100, 100);
|
122
|
+
this.button2.Name = "button2";
|
123
|
+
this.button2.Size = new System.Drawing.Size(75, 23);
|
124
|
+
this.button2.TabIndex = 6;
|
125
|
+
this.button2.Text = "button2";
|
126
|
+
this.button2.UseVisualStyleBackColor = true;
|
127
|
+
//
|
128
|
+
// button3
|
129
|
+
//
|
130
|
+
this.button3.Location = new System.Drawing.Point(0, 0);
|
131
|
+
this.button3.Name = "button3";
|
132
|
+
this.button3.Size = new System.Drawing.Size(75, 23);
|
133
|
+
this.button3.TabIndex = 7;
|
134
|
+
this.button3.Text = "button3";
|
135
|
+
this.button3.UseVisualStyleBackColor = true;
|
136
|
+
//
|
137
|
+
// Form1
|
138
|
+
//
|
139
|
+
this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 15F);
|
140
|
+
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
141
|
+
this.ClientSize = new System.Drawing.Size(800, 450);
|
142
|
+
this.Controls.Add(this.button2);
|
143
|
+
this.Controls.Add(this.button1);
|
144
|
+
this.Controls.Add(this.titlePanel);
|
145
|
+
this.Controls.Add(this.axWindowsMediaPlayer1);
|
146
|
+
this.Name = "Form1";
|
147
|
+
this.Text = "Typing Game";
|
148
|
+
this.Load += new System.EventHandler(this.Form1_Load);
|
149
|
+
((System.ComponentModel.ISupportInitialize)(this.axWindowsMediaPlayer1)).EndInit();
|
150
|
+
this.titlePanel.ResumeLayout(false);
|
151
|
+
this.ResumeLayout(false);
|
152
|
+
|
153
|
+
}
|
154
|
+
|
155
|
+
#endregion
|
156
|
+
|
157
|
+
private AxWMPLib.AxWindowsMediaPlayer axWindowsMediaPlayer1;
|
158
|
+
private System.Windows.Forms.Button makeButton;
|
159
|
+
private System.Windows.Forms.Label gameTitle;
|
160
|
+
private System.Windows.Forms.Button playButton;
|
161
|
+
private System.Windows.Forms.Panel titlePanel;
|
162
|
+
private System.Windows.Forms.Button button1;
|
163
|
+
private System.Windows.Forms.Button button2;
|
164
|
+
private System.Windows.Forms.Button button3;
|
165
|
+
}
|
166
|
+
}
|
167
|
+
|
168
|
+
```
|
2
追記の削除
title
CHANGED
File without changes
|
body
CHANGED
@@ -10,4 +10,4 @@
|
|
10
10
|
解決方法を教えてくださると幸いです。
|
11
11
|
|
12
12
|
追記
|
13
|
-
Panel
|
13
|
+
Panelについての追記は間違っていました。
|
1
うまくいく場合の追記
title
CHANGED
File without changes
|
body
CHANGED
@@ -7,4 +7,7 @@
|
|
7
7
|
Button.Location = new Point(a, b);
|
8
8
|
```
|
9
9
|
これでデバッグすると、なぜかボタンがドラッグして置いたときよりも右下にずれて表示されます。
|
10
|
-
解決方法を教えてくださると幸いです。
|
10
|
+
解決方法を教えてくださると幸いです。
|
11
|
+
|
12
|
+
追記
|
13
|
+
Panelコンテナにコントロールを入れるとなぜかうまくいきます(Panelはプログラム内で動かしても実行時にずれないようです)
|