Saturday, 8 April 2017

Canvas - accept mousewheel events (WPF)

WPF da Canvas ning MouseWheel eventini handle qilish
 
  Odatda Canvas yaratib, unga ixtiyoriyta Children add qilganimizda
  va undagi MouseWheel eventini qayta ishlashimiz uchun:
     canvas1.Background = Brushes.Transparent; deb olishimiz yoki umumiy olganda
     yaratgan canvas1 objectimizning Background qiymatini o'rnatishimiz kerak;
aks holda MouseWheel event ni hadle qila olmaymiz. Chunki default holatda
Canvas Background siz yaratiladi.
Masalan:
 
  ...

  Canvas canvas1 = new Canvas();
  canvas1.Background = Brushes.Transparent;
  Label label = new Label();
  label.Content = "This is Text";
  label.Foreground = Brushes.Blue;
       label.FontSize = 12;
       label.FontWeight = FontWeights.Bold;
  canvas1.Children.add(label);
  canvas1.MouseWheel+=Canvas1_Mouseheel;
  ...
  void Canvas1_Mouseheel()
  {
  ...
  }

No comments:

Post a Comment

Note: only a member of this blog may post a comment.

Tasks and Threads

  Differences Between Task And Thread: 1. The Thread class is used for creating and manipulating a thread in Windows.  2. A Task represents ...