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

📄 sbckcxdlg.cpp

📁 这是一套学校设备管理系统的源码 里面有树形结构使用的很棒的方法
💻 CPP
📖 第 1 页 / 共 3 页
字号:
	  s_jbr_flag = 1;
	  strcpy(s_jbr,buf);
  }

  GetDlgItemText(IDC_ckfs,buf,40);
  if (strlen(buf) == 0){
	  s_ckfs_flag = 0;
  }
  else{
	  s_ckfs_flag = 1;
	  strcpy(s_ckfs1,buf);
  }

  GetDlgItemText(IDC_qgdbh,buf,10);
  len = strlen(buf);
/*
  if ((len != 6)&&(len != 0)){
	MessageBox("您输入的起始入库编号错误.","",MB_OK);
	wd = GetDlgItem(IDC_qgdbh);
	wd->SetFocus();
	return;
  }
*/
  if (len != 0){
	  s_qgdbh_flag = 1;
	  strcpy(s_qgdbh,buf);
  }
  else{
	  s_qgdbh_flag = 0;
  }

  GetDlgItemText(IDC_jgdbh,buf,10);
  len = strlen(buf);
/*
  if ((len != 6)&&(len != 0)){
	MessageBox("您输入的结束入库编号错误.","",MB_OK);
	wd = GetDlgItem(IDC_jgdbh);
	wd->SetFocus();
	return;
  }
*/
  if (len != 0){
	  s_jgdbh_flag = 1;
	  strcpy(s_jgdbh,buf);
  }
  else{
	  s_jgdbh_flag = 0;
  }

  GetDlgItemText(IDC_qwpdj,buf,40);
  if (strlen(buf) == 0){
	  s_qwpdj_flag = 0;
  }
  else{
	  s_qwpdj_flag = 1;
	  strcpy(s_qwpdj,buf);
  }

  GetDlgItemText(IDC_jwpdj,buf,40);
  if (strlen(buf) == 0){
	  s_jwpdj_flag = 0;
  }
  else{
	  s_jwpdj_flag = 1;
	  strcpy(s_jwpdj,buf);
  }

}

void Csbckcxdlg::OnSetfocusckn() 
{
	CWnd *wnd;

	wnd = GetDlgItem(IDC_ckn);
	switch_to_english_mode(wnd);
	cur_focus = 1;
}

void Csbckcxdlg::OnSetfocusqcky() 
{
	CWnd *wnd;

	wnd = GetDlgItem(IDC_qcky);
	switch_to_english_mode(wnd);
	cur_focus = 2;
}

void Csbckcxdlg::OnSetfocusqckr() 
{
	CWnd *wnd;

	wnd = GetDlgItem(IDC_qckr);
	switch_to_english_mode(wnd);
	cur_focus = 3;
}

void Csbckcxdlg::OnSetfocusjcky() 
{
	CWnd *wnd;

	wnd = GetDlgItem(IDC_jcky);
	switch_to_english_mode(wnd);
	cur_focus = 4;
}

void Csbckcxdlg::OnSetfocusjckr() 
{
	CWnd *wnd;

	wnd = GetDlgItem(IDC_jckr);
	switch_to_english_mode(wnd);
	cur_focus = 5;
}

void Csbckcxdlg::OnSetfocussbmc() 
{
	CWnd *wnd;

	wnd = GetDlgItem(IDC_sbmc);
	switch_to_chinese_mode(wnd);
	cur_focus = 6;
}

void Csbckcxdlg::OnSetfocussbs() 
{
	CWnd *wnd;

	wnd = GetDlgItem(IDC_sbs);
	switch_to_english_mode(wnd);
	cur_focus = 7;
}

void Csbckcxdlg::OnSetfocusqgdbh() 
{
	CWnd *wnd;

	wnd = GetDlgItem(IDC_qgdbh);
	switch_to_english_mode(wnd);
	cur_focus = 8;
}

void Csbckcxdlg::OnSetfocusjgdbh() 
{
	CWnd *wnd;

	wnd = GetDlgItem(IDC_jgdbh);
	switch_to_english_mode(wnd);
	cur_focus = 9;
}

void Csbckcxdlg::OnSetfocusqckbh() 
{
	CWnd *wnd;

	wnd = GetDlgItem(IDC_qckbh);
	switch_to_english_mode(wnd);
	cur_focus = 10;
}

void Csbckcxdlg::OnSetfocusjckbh() 
{
	CWnd *wnd;

	wnd = GetDlgItem(IDC_jckbh);
	switch_to_english_mode(wnd);
	cur_focus = 11;
}

void Csbckcxdlg::OnSetfocusckfs() 
{
	CWnd *wnd;

	wnd = GetDlgItem(IDC_ckfs);
	switch_to_english_mode(wnd);
	cur_focus = 12;
}

void Csbckcxdlg::OnSetfocusjbr() 
{
	CWnd *wnd;

	wnd = GetDlgItem(IDC_jbr);
	switch_to_english_mode(wnd);
	cur_focus = 13;
}

void Csbckcxdlg::OnSetfocusckfx() 
{
	CWnd *wnd;

	wnd = GetDlgItem(IDC_ckfx);
	switch_to_chinese_mode(wnd);
	cur_focus = 14;
}

void Csbckcxdlg::OnOK() 
{
	// TODO: Add extra validation here
	CWnd *wn_ckn;
	CWnd *wn_qcky;
	CWnd *wn_qckr;
	CWnd *wn_jcky;
	CWnd *wn_jckr;
	CWnd *wn_sbmc;
	CWnd *wn_sbs;
	CWnd *wn_qgdbh;
	CWnd *wn_jgdbh;
	CWnd *wn_qckbh;
	CWnd *wn_jckbh;
	CWnd *wn_ckfs;
	CWnd *wn_jbr;
	CWnd *wn_ckfx;
	CWnd *wn_qwpdj;
	CWnd *wn_jwpdj;
	CWnd *wn_chaxun;

    wn_ckn = GetDlgItem(IDC_ckn);
    wn_qcky = GetDlgItem(IDC_qcky);
    wn_qckr = GetDlgItem(IDC_qckr);
    wn_jcky = GetDlgItem(IDC_jcky);
    wn_jckr = GetDlgItem(IDC_jckr);
    wn_sbmc= GetDlgItem(IDC_sbmc);
    wn_sbs = GetDlgItem(IDC_sbs);
    wn_qgdbh  = GetDlgItem(IDC_qgdbh);
    wn_jgdbh = GetDlgItem(IDC_jgdbh);   
    wn_qckbh = GetDlgItem(IDC_qckbh);
    wn_jckbh = GetDlgItem(IDC_jckbh);
    wn_ckfs = GetDlgItem(IDC_ckfs);
    wn_jbr  = GetDlgItem(IDC_jbr);
    wn_ckfx = GetDlgItem(IDC_ckfx);
    wn_qwpdj = GetDlgItem(IDC_qwpdj);
    wn_jwpdj = GetDlgItem(IDC_jwpdj);
    wn_chaxun = GetDlgItem(ID_chaxun);   

	if (cur_focus == 1){
		wn_qcky->SetFocus();
		cur_focus = 2;
		return ;
    }
	if (cur_focus == 2){
		wn_qckr->SetFocus();
		cur_focus = 3;
		return ;
    }
	if (cur_focus == 3){
		wn_jcky->SetFocus();
		cur_focus = 4;
		return ;
    }
	if (cur_focus == 4){
		wn_jckr->SetFocus();
		cur_focus = 5;
		return ;
    }
	if (cur_focus == 5){
		wn_sbmc->SetFocus();
		cur_focus = 6;
		return ;
    }
	if (cur_focus == 6){
		wn_sbs->SetFocus();
		cur_focus = 7;
		return ;
    }
	if (cur_focus == 7){
		wn_qgdbh->SetFocus();
		cur_focus = 8;
		return ;
    }
	if (cur_focus == 8){
		wn_jgdbh->SetFocus();
		cur_focus = 9;
		return ;
    }
	if (cur_focus == 9){
		wn_qckbh->SetFocus();
		cur_focus = 10;
		return ;
    }
	if (cur_focus == 10){
		wn_jckbh->SetFocus();
		cur_focus = 11;
		return ;
    }
	if (cur_focus == 11){
		wn_ckfs->SetFocus();
		cur_focus = 12;
		return ;
    }
	if (cur_focus == 12){
		wn_jbr->SetFocus();
		cur_focus = 13;
		return ;
    }
	if (cur_focus == 13){
		wn_ckfx->SetFocus();
		cur_focus = 14;
		return ;
    }
	if (cur_focus == 14){
		wn_qwpdj->SetFocus();
		cur_focus = 15;
		return ;
    }
	if (cur_focus == 15){
		wn_jwpdj->SetFocus();
		cur_focus = 16;
		return ;
    }
	if (cur_focus == 16){
		wn_chaxun->SetFocus();
		cur_focus = 17;
		return ;
    }
}

void Csbckcxdlg::OnEditchangeckn() 
{
	char buf[40];

	GetDlgItemText(IDC_ckn,buf,40);
	if (buf[0] != 0){
	  if (m_ckn.SelectString(0,buf) == CB_ERR){
		SetDlgItemText(IDC_ckn,"");
	  }
	}
}

void Csbckcxdlg::OnEditchangeqcky() 
{
	char buf[40];

	GetDlgItemText(IDC_qcky,buf,40);
	if (buf[0] != 0){
	  if (m_qcky.SelectString(0,buf) == CB_ERR){
		SetDlgItemText(IDC_qcky,"");
	  }
	}
}

void Csbckcxdlg::OnEditchangeqckr() 
{
	char buf[40];

	GetDlgItemText(IDC_qckr,buf,40);
	if (buf[0] != 0){
	  if (m_qckr.SelectString(0,buf) == CB_ERR){
		SetDlgItemText(IDC_qckr,"");
	  }
	}
}

void Csbckcxdlg::OnEditchangejcky() 
{
	char buf[40];

	GetDlgItemText(IDC_jcky,buf,40);
	if (buf[0] != 0){
	  if (m_jcky.SelectString(0,buf) == CB_ERR){
		SetDlgItemText(IDC_jcky,"");
	  }
	}
}

void Csbckcxdlg::OnEditchangejckr() 
{
	char buf[40];

	GetDlgItemText(IDC_jckr,buf,40);
	if (buf[0] != 0){
	  if (m_jckr.SelectString(0,buf) == CB_ERR){
		SetDlgItemText(IDC_jckr,"");
	  }
	}
}

void Csbckcxdlg::OnChangesbmc() 
{
	char buf[50];

	GetDlgItemText(IDC_sbmc,buf,50);
	if (strlen(buf) > 40){
		buf[40] = 0;
		SetDlgItemText(IDC_sbmc,buf);
        Set_to_item_end(this,IDC_sbmc);
    }	
}

void Csbckcxdlg::OnChangesbs() 
{
}

void Csbckcxdlg::OnChangeqgdbh() 
{
    char buf[20];
	int l,i,flag,j;
	
	GetDlgItemText(IDC_qgdbh,buf,12);
    l = strlen(buf);
	if (l > 6){
	  buf[6] = 0;
	  SetDlgItemText(IDC_qgdbh,buf);
	  Set_to_item_end(this,IDC_qgdbh);
	  return ;
    }
	if (l > 0){
		for (i=0;i<l;i++){
	      if ((buf[i] < '0')||(buf[i] > '9')){
		    buf[i] = 0;
	        SetDlgItemText(IDC_qgdbh,buf);
			Set_to_item_end(this,IDC_qgdbh);
		  }
		}
	}
}

void Csbckcxdlg::OnChangejgdbh() 
{
    char buf[20];
	int l,i,flag,j;
	
	GetDlgItemText(IDC_jgdbh,buf,12);
    l = strlen(buf);
	if (l > 6){
	  buf[6] = 0;
	  SetDlgItemText(IDC_jgdbh,buf);
	  Set_to_item_end(this,IDC_jgdbh);
	  return ;
    }
	if (l > 0){
		for (i=0;i<l;i++){
	      if ((buf[i] < '0')||(buf[i] > '9')){
		    buf[i] = 0;
	        SetDlgItemText(IDC_jgdbh,buf);
			Set_to_item_end(this,IDC_jgdbh);
		  }
		}
	}	
}

void Csbckcxdlg::OnChangeqckbh() 
{
    char buf[20];
	int l,i,flag,j;
	
	GetDlgItemText(IDC_qckbh,buf,12);
    l = strlen(buf);
	if (l > 8){
	  buf[8] = 0;
	  SetDlgItemText(IDC_qckbh,buf);
	  Set_to_item_end(this,IDC_qckbh);
	  return ;
    }
	if (l > 0){
		for (i=0;i<l;i++){
	      if ((buf[i] < '0')||(buf[i] > '9')){
		    buf[i] = 0;
	        SetDlgItemText(IDC_qckbh,buf);
			Set_to_item_end(this,IDC_qckbh);
		  }
		}
	}
}

void Csbckcxdlg::OnChangejckbh() 
{
    char buf[20];
	int l,i,flag,j;
	
	GetDlgItemText(IDC_jckbh,buf,12);
    l = strlen(buf);
	if (l > 8){
	  buf[8] = 0;
	  SetDlgItemText(IDC_jckbh,buf);
	  Set_to_item_end(this,IDC_jckbh);
	  return ;
    }
	if (l > 0){
		for (i=0;i<l;i++){
	      if ((buf[i] < '0')||(buf[i] > '9')){
		    buf[i] = 0;
	        SetDlgItemText(IDC_jckbh,buf);
			Set_to_item_end(this,IDC_jckbh);
		  }
		}
	}	
}

void Csbckcxdlg::OnEditchangeckfs() 
{
	char buf[40];

	GetDlgItemText(IDC_ckfs,buf,40);
	if (buf[0] != 0){
	  if (m_ckfs.SelectString(0,buf) == CB_ERR){
		SetDlgItemText(IDC_ckfs,"");
	  }
	}
}

void Csbckcxdlg::OnEditchangejbr() 
{
	char buf[40];

	GetDlgItemText(IDC_jbr,buf,40);
	if (buf[0] != 0){
	  if (m_jbr.SelectString(0,buf) == CB_ERR){
		SetDlgItemText(IDC_jbr,"");
	  }
	}
}

void Csbckcxdlg::OnChangeckfx() 
{
	char buf[50];

	GetDlgItemText(IDC_ckfx,buf,50);
	if (strlen(buf) > 40){
		buf[40] = 0;
		SetDlgItemText(IDC_ckfx,buf);
        Set_to_item_end(this,IDC_ckfx);
    }	
}

void Csbckcxdlg::OnCancel() 
{
	// TODO: Add extra cleanup here
	free_sbtree(m_tree);
	out_flag = 1;
	CDialog::OnCancel();
}

void Csbckcxdlg::OnSelchangedTree1(NMHDR* pNMHDR, LRESULT* pResult) 
{
	NM_TREEVIEW* pNMTreeView = (NM_TREEVIEW*)pNMHDR;

	HTREEITEM htreeitem;
	int i,j;
	CString str;
	int ret;
	double kcsl,psl,sxsl;
	char buf[100];

	htreeitem = m_tree.GetSelectedItem();
	if (htreeitem != NULL){
	  for (j=0;j<g_end_sbs;j++){
		if (g_htreeitem[j] == htreeitem){
			i = j;
			break;
        }
	  }

      g_yszm_sel_sb = i; 
	  m_tree.SelectDropTarget(g_htreeitem[i]);
	  m_tree.SelectItem(g_htreeitem[i]);
	  strcpy(buf,g_a_id[i]);
	  strcat(buf,"  ");
	  strcat(buf,g_e_name[i]);
	  SetDlgItemText(IDC_sbs,buf);
	  strcpy(s_sbs,buf);
    }	
	
	*pResult = 0;
}

void Csbckcxdlg::Onqctj() 
{
	SetDlgItemText(IDC_ckn,"");
	SetDlgItemText(IDC_qcky,"");
	SetDlgItemText(IDC_qckr,"");
	SetDlgItemText(IDC_jcky,"");
	SetDlgItemText(IDC_jckr,"");
	SetDlgItemText(IDC_sbs,"");
	SetDlgItemText(IDC_sbmc,"");
	SetDlgItemText(IDC_qckbh,"");
	SetDlgItemText(IDC_jckbh,"");
	SetDlgItemText(IDC_ckfx,"");
	SetDlgItemText(IDC_jbr,"");
	SetDlgItemText(IDC_ckfs,"");
	SetDlgItemText(IDC_qgdbh,"");
	SetDlgItemText(IDC_jgdbh,"");
	SetDlgItemText(IDC_qwpdj,"");
	SetDlgItemText(IDC_jwpdj,"");
}


void Csbckcxdlg::OnChangeqwpdj() 
{
    char buf[20];
	int l,i,flag,j;
	
	GetDlgItemText(IDC_qwpdj,buf,12);
    l = strlen(buf);
	if (l > 8){
	  buf[8] = 0;
	  SetDlgItemText(IDC_qwpdj,buf);
	  Set_to_item_end(this,IDC_qwpdj);
	  return ;
    }
	if (l > 0){
		for (i=0;i<l;i++){
	      if (((buf[i] < '0')||(buf[i] > '9'))&&(buf[i] != '.')){
		    buf[i] = 0;
	        SetDlgItemText(IDC_qwpdj,buf);
			Set_to_item_end(this,IDC_qwpdj);
		  }
		}
        l = strlen(buf);
		flag = 0;
		for (i=0;i<l;i++){
			if (buf[i] == '.'){
				j = i;
				flag = 1;
				break;
            }
        }
		if (flag == 1){
			if (j < l-3){
				buf[j+3] = 0;
	            SetDlgItemText(IDC_qwpdj,buf);
 			    Set_to_item_end(this,IDC_qwpdj);
            } 
        }
	}

}

void Csbckcxdlg::OnSetfocusqwpdj() 
{
	CWnd *wnd;

	wnd = GetDlgItem(IDC_qwpdj);
	switch_to_english_mode(wnd);
	cur_focus = 15;
	
}

void Csbckcxdlg::OnChangejwpdj() 
{
    char buf[20];
	int l,i,flag,j;
	
	GetDlgItemText(IDC_jwpdj,buf,12);
    l = strlen(buf);
	if (l > 8){
	  buf[8] = 0;
	  SetDlgItemText(IDC_jwpdj,buf);
	  Set_to_item_end(this,IDC_jwpdj);
	  return ;
    }
	if (l > 0){
		for (i=0;i<l;i++){
	      if (((buf[i] < '0')||(buf[i] > '9'))&&(buf[i] != '.')){
		    buf[i] = 0;
	        SetDlgItemText(IDC_jwpdj,buf);
			Set_to_item_end(this,IDC_jwpdj);
		  }
		}
        l = strlen(buf);
		flag = 0;
		for (i=0;i<l;i++){
			if (buf[i] == '.'){
				j = i;
				flag = 1;
				break;
            }
        }
		if (flag == 1){
			if (j < l-3){
				buf[j+3] = 0;
	            SetDlgItemText(IDC_jwpdj,buf);
 			    Set_to_item_end(this,IDC_jwpdj);
            } 
        }
	}
	
}

void Csbckcxdlg::OnSetfocusjwpdj() 
{
	CWnd *wnd;

	wnd = GetDlgItem(IDC_jwpdj);
	switch_to_english_mode(wnd);
	cur_focus = 16;
	
}

⌨️ 快捷键说明

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