回答編集履歴

3

見直しキャンペーン中

2023/07/30 06:58

投稿

TN8001
TN8001

スコア9326

test CHANGED
@@ -20,9 +20,7 @@
20
20
  ---
21
21
 
22
22
  Form1に設定したアイコンを取得するならこうでしょうか。
23
-
24
- Form1.cs
23
+ ```cs:Form1.cs
25
- ```C#
26
24
  using System.ComponentModel;
27
25
 
28
26
  namespace Q7s6n1s05k8go7b
@@ -48,8 +46,7 @@
48
46
  }
49
47
  ```
50
48
 
51
- Form1.Designer.cs
49
+ ```cs:Form1.Designer.cs
52
- ```C#
53
50
  namespace Q7s6n1s05k8go7b
54
51
  {
55
52
  partial class Form1
@@ -100,8 +97,7 @@
100
97
  }
101
98
  ```
102
99
 
103
- Form1.resx
100
+ ```xml:Form1.resx
104
- ```xml
105
101
  <root>
106
102
  <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
107
103
  <xsd:import namespace="http://www.w3.org/XML/1998/namespace" />

2

他ファイルも追記

2022/04/22 09:29

投稿

TN8001
TN8001

スコア9326

test CHANGED
@@ -16,7 +16,12 @@
16
16
 
17
17
  `Form1.resx`や`Form1.Designer.cs`を、メモ帳ででも見てみるとヒントが書かれています(編集しないように十分注意してください)
18
18
 
19
+
20
+ ---
21
+
19
22
  Form1に設定したアイコンを取得するならこうでしょうか。
23
+
24
+ Form1.cs
20
25
  ```C#
21
26
  using System.ComponentModel;
22
27
 
@@ -42,3 +47,131 @@
42
47
  }
43
48
  }
44
49
  ```
50
+
51
+ Form1.Designer.cs
52
+ ```C#
53
+ namespace Q7s6n1s05k8go7b
54
+ {
55
+ partial class Form1
56
+ {
57
+ /// <summary>
58
+ /// Required designer variable.
59
+ /// </summary>
60
+ private System.ComponentModel.IContainer components = null;
61
+
62
+ /// <summary>
63
+ /// Clean up any resources being used.
64
+ /// </summary>
65
+ /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
66
+ protected override void Dispose(bool disposing)
67
+ {
68
+ if (disposing && (components != null))
69
+ {
70
+ components.Dispose();
71
+ }
72
+ base.Dispose(disposing);
73
+ }
74
+
75
+ #region Windows Form Designer generated code
76
+
77
+ /// <summary>
78
+ /// Required method for Designer support - do not modify
79
+ /// the contents of this method with the code editor.
80
+ /// </summary>
81
+ private void InitializeComponent()
82
+ {
83
+ System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(Form1));
84
+ this.SuspendLayout();
85
+ //
86
+ // Form1
87
+ //
88
+ this.AutoScaleDimensions = new System.Drawing.SizeF(10F, 24F);
89
+ this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
90
+ this.ClientSize = new System.Drawing.Size(800, 450);
91
+ this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
92
+ this.Name = "Form1";
93
+ this.Text = "Form1";
94
+ this.ResumeLayout(false);
95
+
96
+ }
97
+
98
+ #endregion
99
+ }
100
+ }
101
+ ```
102
+
103
+ Form1.resx
104
+ ```xml
105
+ <root>
106
+ <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
107
+ <xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
108
+ <xsd:element name="root" msdata:IsDataSet="true">
109
+ <xsd:complexType>
110
+ <xsd:choice maxOccurs="unbounded">
111
+ <xsd:element name="metadata">
112
+ <xsd:complexType>
113
+ <xsd:sequence>
114
+ <xsd:element name="value" type="xsd:string" minOccurs="0" />
115
+ </xsd:sequence>
116
+ <xsd:attribute name="name" use="required" type="xsd:string" />
117
+ <xsd:attribute name="type" type="xsd:string" />
118
+ <xsd:attribute name="mimetype" type="xsd:string" />
119
+ <xsd:attribute ref="xml:space" />
120
+ </xsd:complexType>
121
+ </xsd:element>
122
+ <xsd:element name="assembly">
123
+ <xsd:complexType>
124
+ <xsd:attribute name="alias" type="xsd:string" />
125
+ <xsd:attribute name="name" type="xsd:string" />
126
+ </xsd:complexType>
127
+ </xsd:element>
128
+ <xsd:element name="data">
129
+ <xsd:complexType>
130
+ <xsd:sequence>
131
+ <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
132
+ <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
133
+ </xsd:sequence>
134
+ <xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
135
+ <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
136
+ <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
137
+ <xsd:attribute ref="xml:space" />
138
+ </xsd:complexType>
139
+ </xsd:element>
140
+ <xsd:element name="resheader">
141
+ <xsd:complexType>
142
+ <xsd:sequence>
143
+ <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
144
+ </xsd:sequence>
145
+ <xsd:attribute name="name" type="xsd:string" use="required" />
146
+ </xsd:complexType>
147
+ </xsd:element>
148
+ </xsd:choice>
149
+ </xsd:complexType>
150
+ </xsd:element>
151
+ </xsd:schema>
152
+ <resheader name="resmimetype">
153
+ <value>text/microsoft-resx</value>
154
+ </resheader>
155
+ <resheader name="version">
156
+ <value>2.0</value>
157
+ </resheader>
158
+ <resheader name="reader">
159
+ <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
160
+ </resheader>
161
+ <resheader name="writer">
162
+ <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
163
+ </resheader>
164
+ <assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
165
+ <data name="$this.Icon" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
166
+ <value>
167
+ AAABAAEAEBAQAAEABAAoAQAAFgAAACgAAAAQAAAAIAAAAAEABAAAAAAAwAAAAAAAAAAAAAAAAAAAAAAA
168
+ AAAAAAAAAACAAACAAAAAgIAAgAAAAIAAgACAgAAAgICAAMDAwAAAAP8AAP8AAAD//wD/AAAA/wD/AP//
169
+ AAD///8A///////////4iIiP+IiIj/h4h4/4eIeP+IiIj/h4iI/4iIiP+IiIj/h4h4/4eIeP+IiIj/iI
170
+ iI////////////////////////+Ij/iI/////3eP+Hf/////d4/4d///////h3j///////+HeP//////
171
+ //iI//////////////8AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
172
+ AAAAAAAAAAAAAAAAAAAAAAAA
173
+ </value>
174
+ </data>
175
+ </root>
176
+ ```
177
+ ![NotifyIcon](https://ddjkaamml8q8x.cloudfront.net/questions/2022-04-22/5499f8b6-d58b-4796-bd6a-33b07128c0e7.png)

1

Form1に設定したアイコン

2022/04/21 09:08

投稿

TN8001
TN8001

スコア9326

test CHANGED
@@ -16,7 +16,7 @@
16
16
 
17
17
  `Form1.resx`や`Form1.Designer.cs`を、メモ帳ででも見てみるとヒントが書かれています(編集しないように十分注意してください)
18
18
 
19
- プリのアイコンを取得するならこうでしょうか。
19
+ Form1に設定したアイコンを取得するならこうでしょうか。
20
20
  ```C#
21
21
  using System.ComponentModel;
22
22