close

選擇專案

image

加入Windows Form, 名稱可以取有意義的名字:ColorOfInterestForm.cs

image

加入4個HScrollBar分別為調整BGR數值以及容忍絕對誤差(Tolerence)

image

加入4個成員變數

image

加入四個方法Blue, Green, Red, Tolerence

方便外部取得4個內部變數_blue, _green, _red, _tolerence

image

加入四個HScrollBar Callback 函式

image

private void hScrollBar1_Scroll(object sender, ScrollEventArgs e)
{
     label1.Text = hScrollBar1.Value.ToString();
     this.Blue = hScrollBar1.Value;
}

private void hScrollBar2_Scroll(object sender, ScrollEventArgs e)
{
     label2.Text = hScrollBar2.Value.ToString();
     this.Green = hScrollBar2.Value;
}

private void hScrollBar3_Scroll(object sender, ScrollEventArgs e)
{
     label3.Text = hScrollBar3.Value.ToString();
     this.Red = hScrollBar3.Value;
}

private void hScrollBar4_Scroll(object sender, ScrollEventArgs e)
{
     label4.Text = hScrollBar4.Value.ToString();
     this.Tolerence = hScrollBar4.Value;
}

image

private void button1_Click(object sender, EventArgs e)
  {
      this.Blue  = hScrollBar1.Value;
      this.Green = hScrollBar2.Value;
      this.Red = hScrollBar3.Value;
      this.Tolerence = hScrollBar4.Value;
      Close();
  }

==================================================================

在主視窗部份

image

this._coiForm.Blue   即可取出_blue

this._coiForm.Green 即可取出_green

this._coiForm.Red  即可取出_red

this._coiForm.TolColorDist 即可取出_tolerence

image

arrow
arrow
    全站熱搜
    創作者介紹
    創作者 me1237guy 的頭像
    me1237guy

    天天向上

    me1237guy 發表在 痞客邦 留言(0) 人氣()