2010-12-01 3 views
-1

필자가 작성한 간단한 배경색 변경 프로그램에서 시각적 컨트롤과 색상을 가지고 놀고 있습니다. 또한 순환 응용 프로그램 창을 통합하려고했습니다. 검은 색으로 둘러싸인 단색 원의 비트 맵을 만들어 검정색을 투명하게 만들었습니다. 이제 내 배경 색상이 반복되지 않습니다. 누구든지이 문제를 해결할 수있는 방법을 말해 줄 수 있습니다. 아쉽게도 도움이 될 경우를 대비해 제 코드를 포함 시키십시오. 그러나 이것이 폼 프로퍼티 문제라고 생각합니다. 어떤 도움을 주셔서 감사합니다!순환 응용 프로그램에서 배경색이 변경되지 않습니다.

public partial class Form1 : Form 
{ 
    public Form1() 
    { 
     InitializeComponent();  
    } 

    public Point mouse_offset; 
    public int c; 

    private void button1_Click(object sender, EventArgs e) 
    { 
     using (SpeechSynthesizer synth = new System.Speech.Synthesis.SpeechSynthesizer()) 
     { 
      synth.Speak("This is a test of the emergency see sharp broadcasting network!"); 
      synth.Speak("The man to the left is actually trying to dance without graphics capabilities"); 

     } 
     while (Visible) 
     { 
      using (SpeechSynthesizer synth = new System.Speech.Synthesis.SpeechSynthesizer()) 
      { 
       synth.Speak("Flash dance commencing in three. two. one."); 
      } 
      while (Visible) 
      { 
       for (int c = 0; c < 255 && Visible; c++) 
       { 
        this.BackColor = Color.FromArgb(c, 255 - c, c); 
        Application.DoEvents(); 
        //slow(); 

       } 


       for (int c = 255; c > 0 && Visible; c--) 
       { 
        this.BackColor = Color.FromArgb(c, 255 - c, c); 
        Application.DoEvents(); 
        //slow(); 

       } 

      } 
     } 
    } 

    public static void slow() 
    { 
     System.Threading.Thread.Sleep(3); 
    } 

    private void button2_Click(object sender, EventArgs e) 
    { 
     this.Close(); 
    } 

    private void Form1_MouseDown(object sender, MouseEventArgs e) 
    { 
     mouse_offset = new Point(-e.X, -e.Y); 

    } 

    private void Form1_MouseMove(object sender, System.Windows.Forms.MouseEventArgs e) 
    { 
     if (e.Button == MouseButtons.Left) 
     { 
      Point mousePos = Control.MousePosition; 
      mousePos.Offset(mouse_offset.X, mouse_offset.Y); 
      Location = mousePos; 
     } 
    } 


} 

}

+0

언어 태그 – Gerrat

답변

0

당신이 구성 요소의 모양을 변경하고이 변경 내용을 표시 할 한 때마다,

myComponent.Invalidate(); 

이 자신을 다시 그리도록 conponent 강제를 호출합니다. 이제 그곳에 계시고, 다시 그리기를 최적화 할 수있는 여러 가지 방법이 있지만, 위와 같은 방법으로 시작하는 것이 좋습니다.

+0

을 추가해야합니다. 나는 도움을 감사한다. 아프다. –

관련 문제