22 Aralık 2016 Perşembe

Winforms Control Sınıfı

BeginInvoke metodu
Açıklaması şöyle
The Method executes the specified delegate asynchronously on the thread that the control's underlying handle was created on.
Eğer nesne yaratılmadan çağrı yaparsak şu hatayı alırız.
Invoke or BeginInvoke cannot be called on a control until the window handle has been created
Şöyle yaparız.
listView1.BeginInvoke(new Action(() => 
  {
    ...
  })
);
Invoke metodu
Şöyle yaparız.
mainform.Invoke((MethodInvoker)(() => ...));
PointToScreen metodu
Şöyle yaparız. Bir bileşene göre olan noktayı, ekranın sol üst koşesine göre olacak hale getirir. Bir bileşenin sol üst koşesi ekranın 300x400 noktasında olabilir.
Point mypoint = pictureBox1.PointToScreen(Point.Empty);
SelectNextControl metodu
Şöyle yaparız.
private void btnStart_Click(object sender, EventArgs e)
{
  Control p = ((Button)sender).Parent;
  p.SelectNextControl(ActiveControl, true, true, true, true);
  ...
}

Hiç yorum yok:

Yorum Gönder