⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 bcedlg.cpp

📁 又VC++实现的基于TWAIN的扫描仪图像输入处理软件
💻 CPP
📖 第 1 页 / 共 3 页
字号:
      if(channel==44)
      ((CAIEDlg*)m_pParent)->AdjustPreLimit(m_nLimit2,REDCHANNEL);
      if(channel==42)
      ((CAIEDlg*)m_pParent)->AdjustPreLimit(m_nLimit2,GREENCHANNEL);
      if(channel==41)
      ((CAIEDlg*)m_pParent)->AdjustPreLimit(m_nLimit2,BLUECHANNEL);
	  ((CAIEDlg*)m_pParent)->be=TRUE;
   }
}

///////////////////////////////////////////////////////////////////////
//通道选择
///////////////////////////////////////////////////////////////////////
void CBCEDlg::OnSelchangeChannel() 
{
   CRect rect;
   int posM,posR,posG,posB;
   int pos;

   GetDlgItemText(IDC_CHANNEL,m_sChannel);

   if(m_sChannel=="主通道")
   {
  	 posM=GetPrivateProfileInt("pbrightness2","brightM",128,InitDir2);
     m_ctrlBrightness.SetScrollPos(posM);
	 if(posM>128)
	 {
	   pos=(posM-128)*100/128;
       SetDlgItemInt(IDC_STATIC_B,pos,TRUE);
	 }
	 else
	 {
       pos=(128-posM)*100/128;
       SetDlgItemInt(IDC_STATIC_B,-pos,TRUE); 
	 }
    
     posM=GetPrivateProfileInt("pcontrast2","contrastM",128,InitDir2);
     m_ctrlContrast.SetScrollPos(posM);
     if(posM>128)
	 {
	   pos=(posM-128)*100/128;
       SetDlgItemInt(IDC_STATIC_C,pos,TRUE);
	 }
	 else
	 {
       pos=(128-posM)*100/128;
       SetDlgItemInt(IDC_STATIC_C,-pos,TRUE); 
	 }
     
	 //其实此时这个阈值无效
     posM=128;
     m_ctrlLimit.SetScrollPos(posM);
     SetDlgItemInt(IDC_STATIC_LIMIT,posM,TRUE);
   }

   if(m_sChannel=="红通道")
   {
  	 posR=GetPrivateProfileInt("pbrightness2","brightR",128,InitDir2);
     m_ctrlBrightness.SetScrollPos(posR);
	 if(posR>128)
	 {
	   pos=(posR-128)*100/128;
       SetDlgItemInt(IDC_STATIC_B,pos,TRUE);
	 }
	 else
	 {
       pos=(128-posR)*100/128;
       SetDlgItemInt(IDC_STATIC_B,-pos,TRUE); 
	 }
    
     posR=GetPrivateProfileInt("pcontrast2","contrastR",128,InitDir2);
     m_ctrlContrast.SetScrollPos(posR);
     if(posR>128)
	 {
	   pos=(posR-128)*100/128;
       SetDlgItemInt(IDC_STATIC_C,pos,TRUE);
	 }
	 else
	 {
       pos=(128-posR)*100/128;
       SetDlgItemInt(IDC_STATIC_C,-pos,TRUE); 
	 }
     
     posR=GetPrivateProfileInt("plimit2","limitR",128,InitDir2);
     m_ctrlLimit.SetScrollPos(posR);
     SetDlgItemInt(IDC_STATIC_LIMIT,posR,TRUE);
   }

   if(m_sChannel=="绿通道")
   {
     posG=GetPrivateProfileInt("pbrightness2","brightG",128,InitDir2);
     m_ctrlBrightness.SetScrollPos(posG);
	 if(posG>128)
	 {
	   pos=(posG-128)*100/128;
       SetDlgItemInt(IDC_STATIC_B,pos,TRUE);
	 }
	 else
	 {
       pos=(128-posG)*100/128;
       SetDlgItemInt(IDC_STATIC_B,-pos,TRUE); 
	 }
    
     posG=GetPrivateProfileInt("pcontrast2","contrastG",128,InitDir2);
     m_ctrlContrast.SetScrollPos(posG);
     if(posG>128)
	 {
	   pos=(posG-128)*100/128;
       SetDlgItemInt(IDC_STATIC_C,pos,TRUE);
	 }
	 else
	 {
       pos=(128-posG)*100/128;
       SetDlgItemInt(IDC_STATIC_C,-pos,TRUE); 
	 }
     
     posR=GetPrivateProfileInt("plimit2","limitG",128,InitDir2);
     m_ctrlLimit.SetScrollPos(posG);
     SetDlgItemInt(IDC_STATIC_LIMIT,posG,TRUE);
   }

   if(m_sChannel=="蓝通道")
   {
     posB=GetPrivateProfileInt("pbrightness2","brightB",128,InitDir2);
     m_ctrlBrightness.SetScrollPos(posB);
	 if(posB>128)
	 {
	   pos=(posB-128)*100/128;
       SetDlgItemInt(IDC_STATIC_B,pos,TRUE);
	 }
	 else
	 {
       pos=(128-posB)*100/128;
       SetDlgItemInt(IDC_STATIC_B,-pos,TRUE); 
	 }
    
     posB=GetPrivateProfileInt("pcontrast2","contrastB",128,InitDir2);
     m_ctrlContrast.SetScrollPos(posB);
     if(posB>128)
	 {
	   pos=(posB-128)*100/128;
       SetDlgItemInt(IDC_STATIC_C,pos,TRUE);
	 }
	 else
	 {
       pos=(128-posB)*100/128;
       SetDlgItemInt(IDC_STATIC_C,-pos,TRUE); 
	 }
     
     posB=GetPrivateProfileInt("plimit2","limitB",128,InitDir2);
     m_ctrlLimit.SetScrollPos(posB);
     SetDlgItemInt(IDC_STATIC_LIMIT,posB,TRUE);
   }

   GetDlgItem(IDC_BRIGHTNESS)->GetClientRect(rect);
   ScreenToClient(rect);
   InvalidateRect( &rect, TRUE );
   GetDlgItem(IDC_CONTRAST)->GetClientRect(rect);
   ScreenToClient(rect);
   InvalidateRect( &rect, TRUE );

   if(pScanner->m_nColor==16777216)
   {
	  //阈值滚动条无效
      ::EnableWindow(::GetDlgItem(this->m_hWnd,IDC_LIMIT),FALSE); 
      ::EnableWindow(::GetDlgItem(this->m_hWnd,IDC_STATIC_LIMIT),FALSE); 
	} 
   pScanner->m_nColor=GetPrivateProfileInt("color num","color",16777216,InitDir2); 
   if(pScanner->m_nColor==2)
   {
     GetDlgItem(IDC_LIMIT)->GetClientRect(rect);
     ScreenToClient(rect);
     InvalidateRect( &rect, TRUE );
   }
 
}
/////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////
void CBCEDlg::quexiao()
{
   CRect rect;
   int posM,posR,posG,posB;
   int pos;
   int channel;

   pScanner->m_nColor=GetPrivateProfileInt("color num","color",16777216,InitDir2); 
   channel=GetPrivateProfileInt("xianzhen","channel",42,InitDir2);
   if(pScanner->m_nColor==16777216)
   {
     GetDlgItemText(IDC_CHANNEL,m_sChannel);
   }
   else
   {
      channel=GetPrivateProfileInt("xianzhen","channel",42,InitDir2);
      if(channel==44)//红色通道
	   {
         m_sChannel="红通道";
	   }
	   if(channel==42)//绿色通道
	   {
         m_sChannel="绿通道";
	   }
	   if(channel==41)//蓝色通道
	   {
        m_sChannel="蓝通道";
	   }
   }

   if(m_sChannel=="主通道")
   {
  	   posM=GetPrivateProfileInt("pbrightnessX","brightM",128,InitDir2);
       m_ctrlBrightness.SetScrollPos(posM);
	   if(posM>128)
	   {
	    pos=(posM-128)*100/128;
        SetDlgItemInt(IDC_STATIC_B,pos,TRUE);
	   }
	   else
	   {
        pos=(128-posM)*100/128;
        SetDlgItemInt(IDC_STATIC_B,-pos,TRUE); 
	   }
    
      posM=GetPrivateProfileInt("pcontrastX","contrastM",128,InitDir2);
      m_ctrlContrast.SetScrollPos(posM);
      
      if(posM>128)
	  {
	    pos=(posM-128)*100/128;
        SetDlgItemInt(IDC_STATIC_C,pos,TRUE);
	  }
	  else
	  {
        pos=(128-posM)*100/128;
        SetDlgItemInt(IDC_STATIC_C,-pos,TRUE); 
	  }
     //其实次数值无效
     if(pScanner->m_nColor==2)
	 {
       posM=GetPrivateProfileInt("plimitX","limitM",128,InitDir2);
       m_ctrlLimit.SetScrollPos(posM);
       SetDlgItemInt(IDC_STATIC_LIMIT,posM,TRUE);
	 }
   }

   if(m_sChannel=="红通道")
   {
  	   posR=GetPrivateProfileInt("pbrightnessX","brightR",128,InitDir2);
       m_ctrlBrightness.SetScrollPos(posR);
	   if(posR>128)
	   {
	    pos=(posR-128)*100/128;
        SetDlgItemInt(IDC_STATIC_B,pos,TRUE);
	   }
	   else
	   {
        pos=(128-posR)*100/128;
        SetDlgItemInt(IDC_STATIC_B,-pos,TRUE); 
	   }
    
      posR=GetPrivateProfileInt("pcontrastX","contrastR",128,InitDir2);
      m_ctrlContrast.SetScrollPos(posR);
      if(posR>128)
	  {
	    pos=(posR-128)*100/128;
        SetDlgItemInt(IDC_STATIC_C,pos,TRUE);
	  }
	  else
	  {
       pos=(128-posR)*100/128;
       SetDlgItemInt(IDC_STATIC_C,-pos,TRUE); 
	 }
     if(pScanner->m_nColor==2)
	 {
       posR=GetPrivateProfileInt("plimitX","limitR",128,InitDir2);
       m_ctrlLimit.SetScrollPos(posR);
       SetDlgItemInt(IDC_STATIC_LIMIT,posR,TRUE);
	 }
   }

    if(m_sChannel=="绿通道")
    {
     posG=GetPrivateProfileInt("pbrightnessX","brightG",128,InitDir2);
     m_ctrlBrightness.SetScrollPos(posG);
	 if(posG>128)
	 {
	   pos=(posG-128)*100/128;
       SetDlgItemInt(IDC_STATIC_B,pos,TRUE);
	 }
	 else
	 {
       pos=(128-posG)*100/128;
       SetDlgItemInt(IDC_STATIC_B,-pos,TRUE); 
	 }
    
     posG=GetPrivateProfileInt("pcontrastX","contrastG",128,InitDir2);
     m_ctrlContrast.SetScrollPos(posG);
     if(posG>128)
	 {
	   pos=(posG-128)*100/128;
       SetDlgItemInt(IDC_STATIC_C,pos,TRUE);
	 }
	 else
	 {
       pos=(128-posG)*100/128;
       SetDlgItemInt(IDC_STATIC_C,-pos,TRUE); 
	 }
     
     if(pScanner->m_nColor==2)
	 {
       posR=GetPrivateProfileInt("plimitX","limitG",128,InitDir2);
       m_ctrlLimit.SetScrollPos(posG);
       SetDlgItemInt(IDC_STATIC_LIMIT,posG,TRUE);
	 }
   }

   if(m_sChannel=="蓝通道")
   {
     posB=GetPrivateProfileInt("pbrightnessX","brightB",128,InitDir2);
     m_ctrlBrightness.SetScrollPos(posB);
	 if(posB>128)
	 {
	   pos=(posB-128)*100/128;
       SetDlgItemInt(IDC_STATIC_B,pos,TRUE);
	 }
	 else
	 {
       pos=(128-posB)*100/128;
       SetDlgItemInt(IDC_STATIC_B,-pos,TRUE); 
	 }
    
     posB=GetPrivateProfileInt("pcontrastX","contrastB",128,InitDir2);
     m_ctrlContrast.SetScrollPos(posB);
     if(posB>128)
	 {
	   pos=(posB-128)*100/128;
       SetDlgItemInt(IDC_STATIC_C,pos,TRUE);
	 }
	 else
	 {
       pos=(128-posB)*100/128;
       SetDlgItemInt(IDC_STATIC_C,-pos,TRUE); 
	 }

     if(pScanner->m_nColor==2)
	 {
       posB=GetPrivateProfileInt("plimitX","limitB",128,InitDir2);
       m_ctrlLimit.SetScrollPos(posB);
       SetDlgItemInt(IDC_STATIC_LIMIT,posB,TRUE);
	 }
   }

   GetDlgItem(IDC_BRIGHTNESS)->GetClientRect(rect);
   ScreenToClient(rect);
   InvalidateRect( &rect, TRUE );
   GetDlgItem(IDC_CONTRAST)->GetClientRect(rect);
   ScreenToClient(rect);
   InvalidateRect( &rect, TRUE );
   GetDlgItem(IDC_LIMIT)->GetClientRect(rect);
   ScreenToClient(rect);
   InvalidateRect( &rect, TRUE );
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -