วันพฤหัสบดีที่ 18 กรกฎาคม พ.ศ. 2556

Lab17
 
 
 
 
 

Graphics g = e.Graphics;

Pen bluepen = new Pen(Color.Blue, 2);
g.DrawRectangle(bluepen, 10, 10, 100, 100);
bluepen.Dispose();




 
 

Graphics g = e.Graphics;

Pen bluepen = new Pen(Color.Blue, 2);
g.DrawRectangle(bluepen, 10, 10, 100, 100);
bluepen.Dispose();

Pen somepen = new Pen(Color.FromArgb(255, 120, 200));
g.DrawEllipse(somepen, 20, 20, 200, 200);
somepen.Dispose();
 
 
 
 
 
 

Graphics g = e.Graphics;

Pen bluepen = new Pen(Color.Blue, 2);
g.DrawRectangle(bluepen, 10, 10, 100, 100);
bluepen.Dispose();

Pen somepen = new Pen(Color.FromArgb(255, 120, 200));
g.DrawEllipse(somepen, 20, 20, 200, 200);
somepen.Dispose();

Color col = Color.FromName("LightGreen");

this.BackColor = col;

Graphics

g = e.Graphics;

Pen mypen = new Pen(Color.Black, 1);
g.DrawRectangle(mypen, 10, 10, 200, 200);
mypen.Width = 4;
mypen.Color =

Color.Pink;
g.DrawEllipse(mypen, 10, 10, 200, 200);
 

Graphics g = e.Graphics;

Pen mypen = new Pen(Color.Black, 1);
mypen.DashStyle = System.Drawing.Drawing2D.
DashStyle.Dash;
g.DrawRectangle(mypen, 10, 10, 200, 200);
mypen.Width = 4;
mypen.Color =

Color.Pink;
g.DrawEllipse(mypen, 10, 10, 200, 200);
 

Graphics g = e.Graphics;

Brush myBrush = new SolidBrush(Color.DarkBlue);

Pen mypen = new Pen(myBrush, 5);
g.DrawEllipse(mypen, 10, 10, 200, 200);
mypen.Dispose();
myBrush.Dispose();


Graphics g = e.Graphics;

HatchBrush myBrush = new HatchBrush(HatchStyle.DarkVertical, Color.White, Color.Violet);

Pen mypen = new Pen(myBrush, 5);
 
g.DrawEllipse(mypen, 10, 10, 200, 200);
mypen.Dispose();
myBrush.Dispose();


















Lab13
 
 
 
 
void CCOMBO1Dlg::OnBnClickedButtonAdd(){           CString srcText;           m_editSource.GetWindowText(srcText);           m_comboBox1.AddString(srcText); } 
 

void CCOMBO1Dlg::OnCbnSelchangeCombo1() 
{ 
              CString str; 
                     int idx = m_comboBox1.GetCurSel(); 
              if ( idx < 0 ) 
                     return; 
                             m_comboBox1.GetLBText( idx, str ); 
                             m_staticDestination.SetWindowTextW(str); 
}
 
 
 
 

Lab16
 
 


 
 
ฟังก์ชัน BOOL CsliderDlg::OnInitDialog() เพิ่ม 

m_slider.SetRange(0,100); 
m_progress.SetRange(0,100); 
m_progress.SetPos(1); 
m_progress.SetStep(1); 

ฟังก์ชัน OnHScroll() เพิ่ม 

void CprogressDlg::OnHScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar) 
CSliderCtrl *slider; 
slider = (CSliderCtrl*) pScrollBar; 
int pos = 0; 
if (slider == &m_slider) 
UpdateData(TRUE); 
pos = m_slider.GetPos(); 
m_progress.SetPos(pos); 
UpdateData(FALSE); 
CDialog :: OnHScroll(nSBCode,nPos,pScrollBar); 
}




 


Lab15

Lab15


 

 
void CadfDlg::OnHScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar)
{
CSliderCtrl *slider;
slider = (CSliderCtrl*) pScrollBar;
if (slider == &m_slider)
{
UpdateData(TRUE);
m_value = m_sliderValue;
UpdateData(FALSE);
}
CDialog :: OnHScroll (nSBCode,nPos,pScrollBar);
}
Lab14
 
 


โดย การ เพิ่ม โค๊ด




m_spin.SetRange(1,100);
m_spin.SetBuddy(&m_edit);
m_spin.SetPos(1);
m_spin.SetBase(16);