FromArgb
How do I use From Argb
Below are practical examples compiled from projects for learning and reference purposes
Featured Snippets
Line | Code | Ex.. |
---|---|---|
125 | this.label3.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(128)))), ((int)(((byte)(128)))), ((int)(((byte)(255))))); | 1 |
30 | this.BackColor = Color.FromArgb(0, 164, 147); | 2 |
File name: frmColor.cs
Copy
86 private void InitializeComponent()
87 {
88 System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(ColorInput));
89 this.Blue = new System.Windows.Forms.TextBox();
90 this.label4 = new System.Windows.Forms.Label();
91 this.Green = new System.Windows.Forms.TextBox();
92 this.label3 = new System.Windows.Forms.Label();
93 this.Red = new System.Windows.Forms.TextBox();
94 this.label2 = new System.Windows.Forms.Label();
95 this.label1 = new System.Windows.Forms.Label();
96 this.Cancel = new System.Windows.Forms.Button();
97 this.OK = new System.Windows.Forms.Button();
98 this.SuspendLayout();
99 //
100 // Blue
101 //
102 this.Blue.Location = new System.Drawing.Point(103, 112);
103 this.Blue.Name = "Blue";
104 this.Blue.Size = new System.Drawing.Size(100, 20);
105 this.Blue.TabIndex = 17;
106 ////
107 // label4
108 //
109 this.label4.ForeColor = System.Drawing.Color.Blue;
110 this.label4.Location = new System.Drawing.Point(32, 112);
111 this.label4.Name = "label4";
112 this.label4.Size = new System.Drawing.Size(32, 16);
113 this.label4.TabIndex = 16;
114 this.label4.Text = "Blue";
115 // //
116 // // Green
117 // //
118 this.Green.Location = new System.Drawing.Point(103, 80);
119 this.Green.Name = "Green";
120 this.Green.Size = new System.Drawing.Size(100, 20);
121 this.Green.TabIndex = 15;
122 //
123 // // label3
124 // //
125 this.label3.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(128)))), ((int)(((byte)(128)))), ((int)(((byte)(255)))));
126 this.label3.Location = new System.Drawing.Point(32, 80);
127 this.label3.Name = "label3";
128 this.label3.Size = new System.Drawing.Size(32, 16);
129 this.label3.TabIndex = 14;
130 this.label3.Text = "Green";
131 //
132 // // Red
133 // //
134 this.Red.Location = new System.Drawing.Point(103, 48);
135 this.Red.Name = "Red";
136 this.Red.Size = new System.Drawing.Size(100, 20);
137 this.Red.TabIndex = 13;
138 // //
139 // // label2
140 // //
141 this.label2.ForeColor = System.Drawing.Color.Red;
142 this.label2.Location = new System.Drawing.Point(32, 48);
143 this.label2.Name = "label2";
144 this.label2.Size = new System.Drawing.Size(32, 16);
145 this.label2.TabIndex = 12;
146 this.label2.Text = "Red";
147 //
148 // // label1
149 // //
150 this.label1.Font = new System.Drawing.Font("Microsoft Sans Serif", 11.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
151 this.label1.ForeColor = System.Drawing.Color.Blue;
152 this.label1.Location = new System.Drawing.Point(16, 16);
153 this.label1.Name = "label1";
154 this.label1.Size = new System.Drawing.Size(281, 24);
155 this.label1.TabIndex = 11;
156 this.label1.Text = "Nhập các giá trị màu từ -255 đến 255";
157 // this.label1.Click += new System.EventHandler(this.label1_Click);
158 // //
159 // // Cancel
160 // //
161 this.Cancel.Location = new System.Drawing.Point(176, 178);
162 this.Cancel.Name = "Cancel";
163 this.Cancel.Size = new System.Drawing.Size(75, 23);
164 this.Cancel.TabIndex = 9;
165 this.Cancel.Text = "Bỏ qua";
166 //
167 // // OK
168 // //
169 this.OK.Location = new System.Drawing.Point(19, 178);
170 this.OK.Name = "OK";
171 this.OK.Size = new System.Drawing.Size(75, 23);
172 this.OK.TabIndex = 10;
173 this.OK.Text = "Đồng ý";
174 // this.OK.Click += new System.EventHandler(this.OK_Click);
175 //
176 // ColorInput
177 //
178 this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
179 this.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(255)))), ((int)(((byte)(192)))));
180 this.ClientSize = new System.Drawing.Size(309, 226);
181 this.Controls.Add(this.Blue);
182 this.Controls.Add(this.label4);
183 this.Controls.Add(this.Green);
184 this.Controls.Add(this.label3);
185 this.Controls.Add(this.Red);
186 this.Controls.Add(this.label2);
187 this.Controls.Add(this.label1);
188 this.Controls.Add(this.OK);
189 this.Controls.Add(this.Cancel);
190 this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
191 this.Name = "ColorInput";
192 this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
193 this.Text = "CHON MAU";
194 //this.Load += new System.EventHandler(this.ColorInput_Load);
195 this.ResumeLayout(false);
196 this.PerformLayout();
197
198 }
File name: bubble.cs
Copy
14 public bubble(string message, msgtype messagetype)
15 {
16 InitializeComponent();
17
18 // Set the text in the bubble from the message in the parameter.
19 lblmessage.Text = message;
20
21 // Change Color based on Message type.
22 if (messagetype.ToString() == "In")
23 {
24 // incoming User message
25 this.BackColor = Color.Gray;
26 }
27 else
28 {
29 // Outgoing Bot Message
30 this.BackColor = Color.FromArgb(0, 164, 147);
31 }
32 Setheight();
33 }
FromArgb 101 lượt xem
Gõ tìm kiếm nhanh...