www.pudn.com > Genecircus20070919.rar > ResultDialog.cpp


#include "ResultDialog.h" 
 
#define maxX 1280.0 
#define maxY 800.0 
IMPLEMENT_DYNAMIC_CLASS(ResultDialog, wxDialog) 
BEGIN_EVENT_TABLE(ResultDialog,wxDialog) 
	 EVT_BUTTON(wxID_SIM_RESULT_BUTTON, ResultDialog::OnButtonClick) 
	 EVT_PAINT(ResultDialog::OnPaint) 
END_EVENT_TABLE() 
ResultDialog::ResultDialog(void) 
{ 
} 
 
ResultDialog::ResultDialog(wxWindow* parent,wxWindowID id)  
: wxDialog(parent, wxID_ANY, wxString(_T("Result")),wxPoint(100,50),wxSize(680,640),wxDEFAULT_FRAME_STYLE) 
{ 
	bl = ((MainFrame*)parent)->blackboard; 
	wxScreenDC dc; 
	wxCoord w,h; 
	dc.GetSize(&w,&h); 
	double scaleX=(double)(w/maxX); 
	double scaleY=(double)(h/maxY); 
	combox1 = new wxComboBox(this,wxID_SIM_RESULT_1, wxT(""), 
            wxPoint(10*scaleX, 10), wxSize(150*scaleX,16)); 
	combox2 = new wxComboBox(this,wxID_SIM_RESULT_2, wxT(""), 
            wxPoint(170*scaleX, 10), wxSize(150*scaleX,16)); 
	stbox1 = new  CStaticdraw(this,wxID_SIM_RESULT_DATA_1, wxT(""), 
            wxPoint(10*scaleX, 40), wxSize(380*scaleX,250*scaleY)); 
	wxPoint point; 
	point.x = 10*scaleX; 
	point.y = 40 + 250*scaleY; 
	base_points[0] = point; 
	wxRect rect; 
	rect.x = 10*scaleX; 
	rect.y = 40; 
	rect.width = 380*scaleX; 
	rect.height = 250*scaleY; 
	base_rect[0] = rect; 
	int y = 40+250*scaleY; 
	combox3 = new wxComboBox(this,wxID_SIM_RESULT_3, wxT(""), 
            wxPoint(10*scaleX, 10 + y), wxSize(150*scaleX,16)); 
	combox4 = new wxComboBox(this,wxID_SIM_RESULT_4, wxT(""), 
            wxPoint(170*scaleX, 10 + y), wxSize(150*scaleX,16)); 
	stbox2 = new  CStaticdraw(this,wxID_SIM_RESULT_DATA_2, wxT(""), 
            wxPoint(10*scaleX, 40 + y), wxSize(380*scaleX,250*scaleY)); 
	point.x = 10*scaleX; 
	point.y = 40 + y + 250*scaleY; 
	base_points[1] = point; 
	rect.x = 10*scaleX; 
	rect.y = 40 + y; 
	rect.width = 380*scaleX; 
	rect.height = 250*scaleY; 
	base_rect[1] = rect; 
	//(void) new wxSlider(this,wxID_SIM_RESULT_SLIDER_1,0,0,1000, 
    //        wxPoint(10*scaleX, 70 + y +250*scaleY), wxSize(380*scaleX,250*scaleY)); 
 
    int x = 10 + 380*scaleX + 120; 
	combox5 = new wxComboBox(this,wxID_SIM_RESULT_5, wxT(""), 
            wxPoint(x*scaleX, 10), wxSize(150*scaleX,16)); 
	combox6 = new wxComboBox(this,wxID_SIM_RESULT_6, wxT(""), 
            wxPoint((160+x)*scaleX, 10), wxSize(150*scaleX,16)); 
	stbox3 = new  CStaticdraw(this,wxID_SIM_RESULT_DATA_3, wxT(""), 
            wxPoint(x*scaleX, 40), wxSize(380*scaleX,250*scaleY)); 
	point.x = x*scaleX; 
	point.y = 40 + 250*scaleY; 
	base_points[2] = point; 
	rect.x = x*scaleX; 
	rect.y = 40; 
	rect.width = 380*scaleX; 
	rect.height = 250*scaleY; 
	base_rect[2] = rect; 
	combox7 = new wxComboBox(this,wxID_SIM_RESULT_7, wxT(""), 
            wxPoint(x*scaleX, 10 + y), wxSize(150*scaleX,16)); 
	combox8 = new wxComboBox(this,wxID_SIM_RESULT_8, wxT(""), 
            wxPoint((160+x)*scaleX, 10 + y), wxSize(150*scaleX,16)); 
	stbox4 = new  CStaticdraw(this,wxID_SIM_RESULT_DATA_4, wxT(""), 
            wxPoint(x*scaleX, 40 + y), wxSize(380*scaleX,250*scaleY)); 
	point.x = x*scaleX; 
	point.y = 40 + y + 250*scaleY; 
	base_points[3] = point; 
	rect.x = x*scaleX; 
	rect.y = 40 + y; 
	rect.width = 380*scaleX; 
	rect.height = 250*scaleY; 
	base_rect[3] = rect; 
	//(void) new wxSlider(this,wxID_SIM_RESULT_SLIDER_2,0,0,1000, 
    //        wxPoint(x*scaleX, 70 + y + 250*scaleY), wxSize(380*scaleX,250*scaleY)); 
 
	(void) new wxButton(this,wxID_SIM_RESULT_BUTTON, wxT("Show"),wxPoint(370*scaleX, 300 + y), wxSize(80*scaleX,16)); 
	if(bl->thread_number == 1){ 
		wxString temp  = "";int i; 
		for(i = 0 ;i < bl->genes.size();i++){ 
			temp = temp + bl->genes[i].name.c_str() + ":mRNA"; 
			combox1->Append(temp); 
			temp = ""; 
			temp = temp + bl->genes[i].name.c_str() + ":Protein";//'\r' + '\n'; 
			combox1->Append(temp); 
			temp = ""; 
		} 
		temp  = ""; 
		for(i = 0 ;i < bl->genes.size();i++){ 
			temp = temp + bl->genes[i].name.c_str() + ":mRNA"; 
			combox2->Append(temp); 
			temp = ""; 
			temp = temp + bl->genes[i].name.c_str() + ":Protein";//'\r' + '\n'; 
			combox2->Append(temp); 
			temp = ""; 
		} 
		temp  = ""; 
		for(i = 0 ;i < bl->genes.size();i++){ 
			temp = temp + bl->genes[i].name.c_str() + ":mRNA"; 
			combox3->Append(temp); 
			temp = ""; 
			temp = temp + bl->genes[i].name.c_str() + ":Protein";//'\r' + '\n'; 
			combox3->Append(temp); 
			temp = ""; 
		} 
		temp  = ""; 
		for(i = 0 ;i < bl->genes.size();i++){ 
			temp = temp + bl->genes[i].name.c_str() + ":mRNA"; 
			combox4->Append(temp); 
			temp = ""; 
			temp = temp + bl->genes[i].name.c_str() + ":Protein";//'\r' + '\n'; 
			combox4->Append(temp); 
			temp = ""; 
		} 
		temp  = ""; 
		for(i = 0 ;i < bl->genes.size();i++){ 
			temp = temp + bl->genes[i].name.c_str() + ":mRNA"; 
			combox5->Append(temp); 
			temp = ""; 
			temp = temp + bl->genes[i].name.c_str() + ":Protein";//'\r' + '\n'; 
			combox5->Append(temp); 
			temp = ""; 
		} 
		temp  = ""; 
		for(i = 0 ;i < bl->genes.size();i++){ 
			temp = temp + bl->genes[i].name.c_str() + ":mRNA"; 
			combox6->Append(temp); 
			temp = ""; 
			temp = temp + bl->genes[i].name.c_str() + ":Protein";//'\r' + '\n'; 
			combox6->Append(temp); 
			temp = ""; 
		} 
		temp  = ""; 
		for(i = 0 ;i < bl->genes.size();i++){ 
			temp = temp + bl->genes[i].name.c_str() + ":mRNA"; 
			combox7->Append(temp); 
			temp = ""; 
			temp = temp + bl->genes[i].name.c_str() + ":Protein";//'\r' + '\n'; 
			combox7->Append(temp); 
			temp = ""; 
		} 
		temp  = ""; 
		for(i = 0 ;i < bl->genes.size();i++){ 
			temp = temp + bl->genes[i].name.c_str() + ":mRNA"; 
			combox8->Append(temp); 
			temp = ""; 
			temp = temp + bl->genes[i].name.c_str() + ":Protein";//'\r' + '\n'; 
			combox8->Append(temp); 
			temp = ""; 
		} 
	} 
	else{ 
		wxString temp  = "";int i; 
		for(i = 0 ;i < bl->genes.size();i++){ 
			temp = temp + bl->genes[i].name.c_str(); 
			combox1->Append(temp); 
			temp = ""; 
			temp = temp + bl->genes[i].name.c_str();//'\r' + '\n'; 
			combox1->Append(temp); 
			temp = ""; 
		} 
		temp  = ""; 
		for(i = 0 ;i < bl->genes.size();i++){ 
			temp = temp + bl->genes[i].name.c_str(); 
			combox2->Append(temp); 
			temp = ""; 
			temp = temp + bl->genes[i].name.c_str();//'\r' + '\n'; 
			combox2->Append(temp); 
			temp = ""; 
		} 
		temp  = ""; 
		for(i = 0 ;i < bl->genes.size();i++){ 
			temp = temp + bl->genes[i].name.c_str(); 
			combox3->Append(temp); 
			temp = ""; 
			temp = temp + bl->genes[i].name.c_str();//'\r' + '\n'; 
			combox3->Append(temp); 
			temp = ""; 
		} 
		temp  = ""; 
		for(i = 0 ;i < bl->genes.size();i++){ 
			temp = temp + bl->genes[i].name.c_str(); 
			combox4->Append(temp); 
			temp = ""; 
			temp = temp + bl->genes[i].name.c_str();//'\r' + '\n'; 
			combox4->Append(temp); 
			temp = ""; 
		} 
		temp  = ""; 
		for(i = 0 ;i < bl->genes.size();i++){ 
			temp = temp + bl->genes[i].name.c_str(); 
			combox5->Append(temp); 
			temp = ""; 
			temp = temp + bl->genes[i].name.c_str();//'\r' + '\n'; 
			combox5->Append(temp); 
			temp = ""; 
		} 
		temp  = ""; 
		for(i = 0 ;i < bl->genes.size();i++){ 
			temp = temp + bl->genes[i].name.c_str(); 
			combox6->Append(temp); 
			temp = ""; 
			temp = temp + bl->genes[i].name.c_str();//'\r' + '\n'; 
			combox6->Append(temp); 
			temp = ""; 
		} 
		temp  = ""; 
		for(i = 0 ;i < bl->genes.size();i++){ 
			temp = temp + bl->genes[i].name.c_str(); 
			combox7->Append(temp); 
			temp = ""; 
			temp = temp + bl->genes[i].name.c_str();//'\r' + '\n'; 
			combox7->Append(temp); 
			temp = ""; 
		} 
		temp  = ""; 
		for(i = 0 ;i < bl->genes.size();i++){ 
			temp = temp + bl->genes[i].name.c_str(); 
			combox8->Append(temp); 
			temp = ""; 
			temp = temp + bl->genes[i].name.c_str();//'\r' + '\n'; 
			combox8->Append(temp); 
			temp = ""; 
		} 
	} 
} 
 
ResultDialog::~ResultDialog(void) 
{ 
	delete stbox1; 
    delete stbox2; 
	delete stbox3; 
	delete stbox4; 
} 
 
void ResultDialog::OnPaint(wxPaintEvent &event) 
{ 
	 wxPaintDC dc(this); 
     PrepareDC(dc); 
	 dc.Clear(); 
	 wxRect rect; 
     wxSize sz = stbox1->GetClientSize(); 
     wxPoint point = stbox1->GetPosition(); 
	 wxRect rectToDraw(point.x, point.y, point.x+sz.GetWidth(), point.y+sz.GetHeight()); 
	 if(bl->ave.size() == 0){ 
		 wxPaintEvent event1; 
		 event1.SetEventObject(stbox1); 
		 stbox1->first = (((wxComboBox*)this->FindWindow(wxID_SIM_RESULT_1))->GetValue()).c_str(); 
		 if(stbox1->first != (((wxComboBox*)this->FindWindow(wxID_SIM_RESULT_2))->GetValue()).c_str() 
			&& 
			(((wxComboBox*)this->FindWindow(wxID_SIM_RESULT_2))->GetValue()).c_str() != ""){ 
			stbox1->second = (((wxComboBox*)this->FindWindow(wxID_SIM_RESULT_2))->GetValue()).c_str(); 
 
		 } 
		 stbox1->OnPaint(event1); 
		 stbox2->first = (((wxComboBox*)this->FindWindow(wxID_SIM_RESULT_3))->GetValue()).c_str(); 
		 if(stbox1->first != (((wxComboBox*)this->FindWindow(wxID_SIM_RESULT_2))->GetValue()).c_str() 
			&& 
			(((wxComboBox*)this->FindWindow(wxID_SIM_RESULT_2))->GetValue()).c_str() != ""){ 
			stbox2->second = (((wxComboBox*)this->FindWindow(wxID_SIM_RESULT_4))->GetValue()).c_str(); 
 
		 } 
		 wxPaintEvent event2; 
		 event2.SetEventObject(stbox2); 
		 stbox2->OnPaint(event2); 
		 stbox3->first = (((wxComboBox*)this->FindWindow(wxID_SIM_RESULT_5))->GetValue()).c_str(); 
		 if(stbox1->first != (((wxComboBox*)this->FindWindow(wxID_SIM_RESULT_2))->GetValue()).c_str() 
			&& 
			(((wxComboBox*)this->FindWindow(wxID_SIM_RESULT_2))->GetValue()).c_str() != ""){ 
			stbox3->second = (((wxComboBox*)this->FindWindow(wxID_SIM_RESULT_6))->GetValue()).c_str(); 
 
		 } 
		 wxPaintEvent event3; 
		 event3.SetEventObject(stbox3); 
		 stbox3->OnPaint(event3); 
		 stbox4->first = (((wxComboBox*)this->FindWindow(wxID_SIM_RESULT_7))->GetValue()).c_str(); 
		 if(stbox1->first != (((wxComboBox*)this->FindWindow(wxID_SIM_RESULT_2))->GetValue()).c_str() 
			&& 
			(((wxComboBox*)this->FindWindow(wxID_SIM_RESULT_2))->GetValue()).c_str() != ""){ 
			stbox4->second = (((wxComboBox*)this->FindWindow(wxID_SIM_RESULT_8))->GetValue()).c_str(); 
 
		 } 
		 wxPaintEvent event4; 
		 event4.SetEventObject(stbox4); 
		 stbox4->OnPaint(event4); 
	 } 
	 else{ 
		  maxl.clear(); 
		  minl.clear(); 
		  double max = 0.0;double min = 0.0; 
		  max = bl->ave[0][0];min = max; 
		  for(int i = 0 ;i < bl->ave[0].size();i++){ 
             for(int j = 0 ;j < bl->ave.size();j++){ 
                  if(max < bl->ave[j][i]) 
				     max = bl->ave[j][i]; 
                  if(min > bl->ave[j][i]) 
				     min = bl->ave[j][i]; 
			 } 
			 maxl.push_back(max); 
			 minl.push_back(min); 
		  } 
          wxPaintEvent event1; 
		  event1.SetEventObject(stbox1); 
		  stbox1->first = (((wxComboBox*)this->FindWindow(wxID_SIM_RESULT_1))->GetValue()).c_str(); 
		  int index1 = stbox1->first.find(':'); 
          string temp = stbox1->first.substr(0,index1); 
		  int index = 0;int i = 0; 
		  for(i = 0;i < bl->genes.size();i++){ 
			  if(temp == bl->genes[i].name) 
			     break; 
		  } 
		  if(stbox1->first != "" && i != bl->genes.size()){ 
			  stbox1->focus_index = i; 
			  for(int a = 0;a <= 39; a++){ 
				  stbox1->numb[a] = 0; 
			  } 
			  for(int a = 0 ; a <= 39;a++){//统计细胞计数 
				  for(int b = 0; b < bl->ave.size();b++){ 
					  if(bl->ave[b][i] >= min + ((max-min)/40)*a 
						 && 
						 bl->ave[b][i] < min + ((max-min)/40)*(a+1)){ 
						 stbox1->numb[a]++; 
					  } 
				  } 
			  } 
			  stbox1->maxl = maxl; 
			  stbox1->minl = minl; 
			  stbox1->OnPaint(event1); 
		  } 
	 } 
	 wxDialog::OnPaint(event); 
     dodraw(); 
} 
 
void ResultDialog::findhistory(wxString name,CStaticdraw * st,int index1) 
{ 
	 if(name != ""){ 
		int index = name.find(':'); 
		wxString temp = name.c_str(); 
		wxString f1 = temp.SubString(0,index-1); 
		for(int i = 0;igenes.size();i++){ 
			if(f1 == bl->genes[i].name.c_str()) 
			{ 
			   wxString temp1 = temp.SubString(index+1,temp.Length()); 
			   if(temp1 == "mRNA"){ 
				   if(index1 == 1){ 
				     st->hi1 = bl->genes[i].mrna.his_m_RNA; 
				   } 
				   else{				      
                     st->hi2 = bl->genes[i].mrna.his_m_RNA; 
				   } 
			   } 
			   else if (temp1 == "Protein"){ 
			      if(index1 == 1) 
			         st->hi1 = bl->genes[i].pro.his_Pro; 
				  else{ 
				     int a = bl->genes[i].pro.his_Pro.size(); 
				     st->hi2 = bl->genes[i].pro.his_Pro; 
					 } 
			   } 
			} 
		} 
	 } 
} 
 
void ResultDialog::OnButtonClick(wxCommandEvent& event) 
{     
	if(bl->ave.size() == 0){ 
		 wxPaintEvent event1; 
		 event1.SetEventObject(stbox1); 
		 stbox1->first = (((wxComboBox*)this->FindWindow(wxID_SIM_RESULT_1))->GetValue()).c_str(); 
		 stbox1->hi1.clear(); 
		 findhistory(stbox1->first.c_str(),stbox1,1); 
		 if(stbox1->first != (((wxComboBox*)this->FindWindow(wxID_SIM_RESULT_2))->GetValue()).c_str() 
			&& 
			(((wxComboBox*)this->FindWindow(wxID_SIM_RESULT_2))->GetValue()).c_str() != ""){ 
			stbox1->second = (((wxComboBox*)this->FindWindow(wxID_SIM_RESULT_2))->GetValue()).c_str(); 
			stbox1->hi2.clear(); 
			findhistory(stbox1->second.c_str(),stbox1,2); 
		 } 
		 stbox1->OnPaint(event1); 
  
		 event1.SetEventObject(stbox2); 
		 stbox2->first = (((wxComboBox*)this->FindWindow(wxID_SIM_RESULT_3))->GetValue()).c_str(); 
		 stbox2->hi1.clear(); 
		 findhistory(stbox2->first.c_str(),stbox2,1); 
		 if(stbox1->first != (((wxComboBox*)this->FindWindow(wxID_SIM_RESULT_4))->GetValue()).c_str() 
			&& 
			(((wxComboBox*)this->FindWindow(wxID_SIM_RESULT_4))->GetValue()).c_str() != ""){ 
			stbox2->second = (((wxComboBox*)this->FindWindow(wxID_SIM_RESULT_4))->GetValue()).c_str(); 
			stbox2->hi2.clear(); 
			findhistory(stbox2->second.c_str(),stbox2,2); 
 
		 } 
		 stbox2->OnPaint(event1); 
 
		 event1.SetEventObject(stbox3); 
		 stbox3->first = (((wxComboBox*)this->FindWindow(wxID_SIM_RESULT_5))->GetValue()).c_str(); 
		 stbox3->hi1.clear(); 
		 findhistory(stbox3->first.c_str(),stbox3,1); 
		 if(stbox1->first != (((wxComboBox*)this->FindWindow(wxID_SIM_RESULT_6))->GetValue()).c_str() 
			&& 
			(((wxComboBox*)this->FindWindow(wxID_SIM_RESULT_6))->GetValue()).c_str() != ""){ 
			stbox3->second = (((wxComboBox*)this->FindWindow(wxID_SIM_RESULT_6))->GetValue()).c_str(); 
			stbox3->hi2.clear(); 
			findhistory(stbox3->second.c_str(),stbox3,2); 
 
		 } 
		 stbox3->OnPaint(event1); 
 
		 event1.SetEventObject(stbox4); 
		 stbox4->first = (((wxComboBox*)this->FindWindow(wxID_SIM_RESULT_7))->GetValue()).c_str(); 
		 stbox4->hi1.clear(); 
		 findhistory(stbox4->first.c_str(),stbox4,1); 
		 if(stbox1->first != (((wxComboBox*)this->FindWindow(wxID_SIM_RESULT_8))->GetValue()).c_str() 
			&& 
			(((wxComboBox*)this->FindWindow(wxID_SIM_RESULT_8))->GetValue()).c_str() != ""){ 
			stbox4->second = (((wxComboBox*)this->FindWindow(wxID_SIM_RESULT_8))->GetValue()).c_str(); 
			stbox4->hi2.clear(); 
			findhistory(stbox4->second.c_str(),stbox4,2); 
		 } 
		 stbox4->OnPaint(event1); 
	} 
	else{ 
		  maxl.clear(); 
		  minl.clear(); 
		  double max = 0.0;double min = 0.0; 
		  max = bl->ave[0][0];min = max; 
		  for(int i = 0 ;i < bl->ave[0].size();i++){ 
             for(int j = 0 ;j < bl->ave.size();j++){ 
                  if(max < bl->ave[j][i]) 
				     max = bl->ave[j][i]; 
                  if(min > bl->ave[j][i]) 
				     min = bl->ave[j][i]; 
			 } 
			 maxl.push_back(max); 
			 minl.push_back(min); 
		  } 
          wxPaintEvent event1; 
		  event1.SetEventObject(stbox1); 
		  stbox1->first = (((wxComboBox*)this->FindWindow(wxID_SIM_RESULT_1))->GetValue()).c_str(); 
		  int index1 = stbox1->first.find(':'); 
          string temp = stbox1->first.substr(0,index1); 
		  int index = 0;int i = 0; 
		  for(i = 0;i < bl->genes.size();i++){ 
			  if(temp == bl->genes[i].name) 
			     break; 
		  } 
		  //wxMessageBox(temp.c_str()); 
		  if(stbox1->first != "" && i != bl->genes.size()){ 
			  stbox1->focus_index = i; 
			  for(int a = 0;a <= 39; a++){ 
				  stbox1->numb[a] = 0; 
			  } 
			  for(int a = 0 ; a <= 39;a++){//统计细胞计数 
				  for(int b = 0; b < bl->ave.size();b++){ 
					  if(bl->ave[b][i] >= min + ((max-min)/40)*a 
						 && 
						 bl->ave[b][i] < min + ((max-min)/40)*(a+1)){ 
						 stbox1->numb[a]++; 
					  } 
				  } 
			  } 
			  stbox1->maxl = maxl; 
			  stbox1->minl = minl; 
			  stbox1->OnPaint(event1); 
		  } 
 
		  event1.SetEventObject(stbox2); 
		  stbox2->first = (((wxComboBox*)this->FindWindow(wxID_SIM_RESULT_3))->GetValue()).c_str(); 
		  index1 = stbox2->first.find(':'); 
          temp = stbox2->first.substr(0,index1); 
		  index = 0;i = 0; 
		  for(i = 0;i < bl->genes.size();i++){ 
			  if(temp == bl->genes[i].name) 
			     break; 
		  } 
		  //wxMessageBox(temp.c_str()); 
		  if(stbox2->first != "" && i != bl->genes.size()){ 
			  stbox2->focus_index = i; 
			  for(int a = 0;a <= 39; a++){ 
				  stbox2->numb[a] = 0; 
			  } 
			  for(int a = 0 ; a <= 39;a++){//统计细胞计数 
				  for(int b = 0; b < bl->ave.size();b++){ 
					  if(bl->ave[b][i] >= min + ((max-min)/40)*a 
						 && 
						 bl->ave[b][i] < min + ((max-min)/40)*(a+1)){ 
						 stbox2->numb[a]++; 
					  } 
				  } 
			  } 
			  stbox2->maxl = maxl; 
			  stbox2->minl = minl; 
			  stbox2->OnPaint(event1); 
		  } 
 
		  event1.SetEventObject(stbox3); 
		  stbox3->first = (((wxComboBox*)this->FindWindow(wxID_SIM_RESULT_5))->GetValue()).c_str(); 
		  index1 = stbox3->first.find(':'); 
          temp = stbox3->first.substr(0,index1); 
		  index = 0;i = 0; 
		  for(i = 0;i < bl->genes.size();i++){ 
			  if(temp == bl->genes[i].name) 
			     break; 
		  } 
		  //wxMessageBox(temp.c_str()); 
		  if(stbox3->first != "" && i != bl->genes.size()){ 
			  stbox3->focus_index = i; 
			  for(int a = 0;a <= 39; a++){ 
				  stbox3->numb[a] = 0; 
			  } 
			  for(int a = 0 ; a <= 39;a++){//统计细胞计数 
				  for(int b = 0; b < bl->ave.size();b++){ 
					  if(bl->ave[b][i] >= min + ((max-min)/40)*a 
						 && 
						 bl->ave[b][i] < min + ((max-min)/40)*(a+1)){ 
						 stbox3->numb[a]++; 
					  } 
				  } 
			  } 
			  stbox3->maxl = maxl; 
			  stbox3->minl = minl; 
			  stbox3->OnPaint(event1); 
		  } 
 
		  event1.SetEventObject(stbox4); 
		  stbox4->first = (((wxComboBox*)this->FindWindow(wxID_SIM_RESULT_7))->GetValue()).c_str(); 
		  index1 = stbox4->first.find(':'); 
          temp = stbox4->first.substr(0,index1); 
		  index = 0;i = 0; 
		  for(i = 0;i < bl->genes.size();i++){ 
			  if(temp == bl->genes[i].name) 
			     break; 
		  } 
		  //wxMessageBox(temp.c_str()); 
		  if(stbox4->first != "" && i != bl->genes.size()){ 
			  stbox4->focus_index = i; 
			  for(int a = 0;a <= 39; a++){ 
				  stbox4->numb[a] = 0; 
			  } 
			  for(int a = 0 ; a <= 39;a++){//统计细胞计数 
				  for(int b = 0; b < bl->ave.size();b++){ 
					  if(bl->ave[b][i] >= min + ((max-min)/40)*a 
						 && 
						 bl->ave[b][i] < min + ((max-min)/40)*(a+1)){ 
						 stbox4->numb[a]++; 
					  } 
				  } 
			  } 
			  stbox4->maxl = maxl; 
			  stbox4->minl = minl; 
			  stbox4->OnPaint(event1); 
		  } 
	} 
	 //stbox4->OnPaint(event1); 
	 //wxPaintEvent event2; 
	 //e/vent2.SetEventObject(this); 
	 //this->m_eventHandler->ProcessEvent(event2); 
	 //this->OnPaint(event2); 
} 
 
 
void ResultDialog::dodraw() 
{ 
	if(bl->ave.size() == 0){ 
		 wxPaintEvent event1; 
		 event1.SetEventObject(stbox1); 
		 stbox1->first = (((wxComboBox*)this->FindWindow(wxID_SIM_RESULT_1))->GetValue()).c_str(); 
		 stbox1->hi1.clear(); 
		 findhistory(stbox1->first.c_str(),stbox1,1); 
		 if(stbox1->first != (((wxComboBox*)this->FindWindow(wxID_SIM_RESULT_2))->GetValue()).c_str() 
			&& 
			(((wxComboBox*)this->FindWindow(wxID_SIM_RESULT_2))->GetValue()).c_str() != ""){ 
			stbox1->second = (((wxComboBox*)this->FindWindow(wxID_SIM_RESULT_2))->GetValue()).c_str(); 
			stbox1->hi2.clear(); 
			findhistory(stbox1->second.c_str(),stbox1,2); 
		 } 
		 stbox1->OnPaint(event1); 
  
		 event1.SetEventObject(stbox2); 
		 stbox2->first = (((wxComboBox*)this->FindWindow(wxID_SIM_RESULT_3))->GetValue()).c_str(); 
		 stbox2->hi1.clear(); 
		 findhistory(stbox2->first.c_str(),stbox2,1); 
		 if(stbox1->first != (((wxComboBox*)this->FindWindow(wxID_SIM_RESULT_4))->GetValue()).c_str() 
			&& 
			(((wxComboBox*)this->FindWindow(wxID_SIM_RESULT_4))->GetValue()).c_str() != ""){ 
			stbox2->second = (((wxComboBox*)this->FindWindow(wxID_SIM_RESULT_4))->GetValue()).c_str(); 
			stbox2->hi2.clear(); 
			findhistory(stbox2->second.c_str(),stbox2,2); 
 
		 } 
		 stbox2->OnPaint(event1); 
 
		 event1.SetEventObject(stbox3); 
		 stbox3->first = (((wxComboBox*)this->FindWindow(wxID_SIM_RESULT_5))->GetValue()).c_str(); 
		 stbox3->hi1.clear(); 
		 findhistory(stbox3->first.c_str(),stbox3,1); 
		 if(stbox1->first != (((wxComboBox*)this->FindWindow(wxID_SIM_RESULT_6))->GetValue()).c_str() 
			&& 
			(((wxComboBox*)this->FindWindow(wxID_SIM_RESULT_6))->GetValue()).c_str() != ""){ 
			stbox3->second = (((wxComboBox*)this->FindWindow(wxID_SIM_RESULT_6))->GetValue()).c_str(); 
			stbox3->hi2.clear(); 
			findhistory(stbox3->second.c_str(),stbox3,2); 
 
		 } 
		 stbox3->OnPaint(event1); 
 
		 event1.SetEventObject(stbox4); 
		 stbox4->first = (((wxComboBox*)this->FindWindow(wxID_SIM_RESULT_7))->GetValue()).c_str(); 
		 stbox4->hi1.clear(); 
		 findhistory(stbox4->first.c_str(),stbox4,1); 
		 if(stbox1->first != (((wxComboBox*)this->FindWindow(wxID_SIM_RESULT_8))->GetValue()).c_str() 
			&& 
			(((wxComboBox*)this->FindWindow(wxID_SIM_RESULT_8))->GetValue()).c_str() != ""){ 
			stbox4->second = (((wxComboBox*)this->FindWindow(wxID_SIM_RESULT_8))->GetValue()).c_str(); 
			stbox4->hi2.clear(); 
			findhistory(stbox4->second.c_str(),stbox4,2); 
		 } 
		 stbox4->OnPaint(event1); 
	} 
	else{ 
		  maxl.clear(); 
		  minl.clear(); 
		  double max = 0.0;double min = 0.0; 
		  max = bl->ave[0][0];min = max; 
		  for(int i = 0 ;i < bl->ave[0].size();i++){ 
             for(int j = 0 ;j < bl->ave.size();j++){ 
                  if(max < bl->ave[j][i]) 
				     max = bl->ave[j][i]; 
                  if(min > bl->ave[j][i]) 
				     min = bl->ave[j][i]; 
			 } 
			 maxl.push_back(max); 
			 minl.push_back(min); 
		  } 
          wxPaintEvent event1; 
		  event1.SetEventObject(stbox1); 
		  stbox1->first = (((wxComboBox*)this->FindWindow(wxID_SIM_RESULT_1))->GetValue()).c_str(); 
		  int index1 = stbox1->first.find(':'); 
          string temp = stbox1->first.substr(0,index1); 
		  int index = 0;int i = 0; 
		  for(i = 0;i < bl->genes.size();i++){ 
			  if(temp == bl->genes[i].name) 
			     break; 
		  } 
		  //wxMessageBox(temp.c_str()); 
		  if(stbox1->first != "" && i != bl->genes.size()){ 
			  stbox1->focus_index = i; 
			  for(int a = 0;a <= 39; a++){ 
				  stbox1->numb[a] = 0; 
			  } 
			  for(int a = 0 ; a <= 39;a++){//统计细胞计数 
				  for(int b = 0; b < bl->ave.size();b++){ 
					  if(bl->ave[b][i] >= min + ((max-min)/40)*a 
						 && 
						 bl->ave[b][i] < min + ((max-min)/40)*(a+1)){ 
						 stbox1->numb[a]++; 
					  } 
				  } 
			  } 
			  stbox1->maxl = maxl; 
			  stbox1->minl = minl; 
			  stbox1->OnPaint(event1); 
		  } 
 
		  event1.SetEventObject(stbox2); 
		  stbox2->first = (((wxComboBox*)this->FindWindow(wxID_SIM_RESULT_3))->GetValue()).c_str(); 
		  index1 = stbox2->first.find(':'); 
          temp = stbox2->first.substr(0,index1); 
		  index = 0;i = 0; 
		  for(i = 0;i < bl->genes.size();i++){ 
			  if(temp == bl->genes[i].name) 
			     break; 
		  } 
		  //wxMessageBox(temp.c_str()); 
		  if(stbox2->first != "" && i != bl->genes.size()){ 
			  stbox2->focus_index = i; 
			  for(int a = 0;a <= 39; a++){ 
				  stbox2->numb[a] = 0; 
			  } 
			  for(int a = 0 ; a <= 39;a++){//统计细胞计数 
				  for(int b = 0; b < bl->ave.size();b++){ 
					  if(bl->ave[b][i] >= min + ((max-min)/40)*a 
						 && 
						 bl->ave[b][i] < min + ((max-min)/40)*(a+1)){ 
						 stbox2->numb[a]++; 
					  } 
				  } 
			  } 
			  stbox2->maxl = maxl; 
			  stbox2->minl = minl; 
			  stbox2->OnPaint(event1); 
		  } 
 
		  event1.SetEventObject(stbox3); 
		  stbox3->first = (((wxComboBox*)this->FindWindow(wxID_SIM_RESULT_5))->GetValue()).c_str(); 
		  index1 = stbox3->first.find(':'); 
          temp = stbox3->first.substr(0,index1); 
		  index = 0;i = 0; 
		  for(i = 0;i < bl->genes.size();i++){ 
			  if(temp == bl->genes[i].name) 
			     break; 
		  } 
		  //wxMessageBox(temp.c_str()); 
		  if(stbox3->first != "" && i != bl->genes.size()){ 
			  stbox3->focus_index = i; 
			  for(int a = 0;a <= 39; a++){ 
				  stbox3->numb[a] = 0; 
			  } 
			  for(int a = 0 ; a <= 39;a++){//统计细胞计数 
				  for(int b = 0; b < bl->ave.size();b++){ 
					  if(bl->ave[b][i] >= min + ((max-min)/40)*a 
						 && 
						 bl->ave[b][i] < min + ((max-min)/40)*(a+1)){ 
						 stbox3->numb[a]++; 
					  } 
				  } 
			  } 
			  stbox3->maxl = maxl; 
			  stbox3->minl = minl; 
			  stbox3->OnPaint(event1); 
		  } 
 
		  event1.SetEventObject(stbox4); 
		  stbox4->first = (((wxComboBox*)this->FindWindow(wxID_SIM_RESULT_7))->GetValue()).c_str(); 
		  index1 = stbox4->first.find(':'); 
          temp = stbox4->first.substr(0,index1); 
		  index = 0;i = 0; 
		  for(i = 0;i < bl->genes.size();i++){ 
			  if(temp == bl->genes[i].name) 
			     break; 
		  } 
		  //wxMessageBox(temp.c_str()); 
		  if(stbox4->first != "" && i != bl->genes.size()){ 
			  stbox4->focus_index = i; 
			  for(int a = 0;a <= 39; a++){ 
				  stbox4->numb[a] = 0; 
			  } 
			  for(int a = 0 ; a <= 39;a++){//统计细胞计数 
				  for(int b = 0; b < bl->ave.size();b++){ 
					  if(bl->ave[b][i] >= min + ((max-min)/40)*a 
						 && 
						 bl->ave[b][i] < min + ((max-min)/40)*(a+1)){ 
						 stbox4->numb[a]++; 
					  } 
				  } 
			  } 
			  stbox4->maxl = maxl; 
			  stbox4->minl = minl; 
			  stbox4->OnPaint(event1); 
		  } 
	} 
}