반응형
Notice
Recent Posts
Recent Comments
Link
«   2025/06   »
1 2 3 4 5 6 7
8 9 10 11 12 13 14
15 16 17 18 19 20 21
22 23 24 25 26 27 28
29 30
Archives
Today
Total
관리 메뉴

잉여의 즐거운 잉여 생활

Object(sender)(?) 백그라운드 투명화 본문

공부/c#

Object(sender)(?) 백그라운드 투명화

령선 2021. 2. 18. 21:47
반응형

PictureBox 위에 라벨을 올려서 사용하는 경우가 있었고

 

라벨의 백그라운드를 투명하게 해야했었다

 

인터넷 검색결과 Color값에 Transparent를 설정하면 투명화 된다고 해서 넣어보았더니

 

투명하게 되는것이 아니고 흰색 배경으로 변경이 됐다.

 

이상이 있어 검색을 더 해본 결과 

 

c#디자이너 쪽에서 변경을 해야 투명해 진다고 하드라

// 
// Form1
// 
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 12F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(800, 450);
this.Controls.Add(this.label1); <---- 삭제
this.Controls.Add(this.pictureBox1);
this.Name = "Form1";
this.Text = "Form1";
((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).EndInit();
this.ResumeLayout(false);
this.PerformLayout();


// 
// pictureBox1
// 
this.pictureBox1.Controls.Add(thid.label1); <--- 추가
this.pictureBox1.Location = new System.Drawing.Point(124, 97);
this.pictureBox1.Name = "pictureBox1";
this.pictureBox1.Size = new System.Drawing.Size(247, 147);
this.pictureBox1.TabIndex = 0;
this.pictureBox1.TabStop = false;

 

위 코드에 처럼 삭제와 추가를 해주면 pictureBox위에서는 라벨의 백그라운드는 투명 처리를 할 수 있다.

 

ㅊㅊ : idgaf.tistory.com/62

반응형

'공부 > c#' 카테고리의 다른 글

DB 확인 후 없으면 DB생성  (0) 2023.04.04
c# 컨트롤 오브젝트 마우스 드래그 이동  (0) 2021.02.24
Comments