zoukankan      html  css  js  c++  java
  • 如何处理frozon control (WPF FAQ http://www.syncfusion.com/faq/wpf/default.aspx#60)

    将一个control freeze后能够提高其性能。

    If you try to modify a frozen Freezable object, it throws an 'Invalid Operation' Exception. To avoid throwing this exception, use the "IsFrozen" property of the Freezable object to determine whether it is frozen.

    Button myButton = new Button();
     
    SolidColorBrush myBrush = new SolidColorBrush(Colors.Yellow); 
     

     
    if (myBrush.CanFreeze)
     
    {
     
    // Makes the brush unmodifiable.
     
    myBrush.Freeze();
     
    }
     
    myButton.Background = myBrush; 
     

     
    if (myBrush.IsFrozen) // Evaluates to true.
     
    {
     
    // If the brush is frozen, create a clone and
     
    // modify the clone.
     
    SolidColorBrush myBrushClone = myBrush.Clone();
     
    myBrushClone.Color = Colors.Red;
     
    myButton.Background = myBrushClone;
     
    }
     
    else
     
    {
     
    // If the brush is not frozen,
     
    // it can be modified directly.
     
    myBrush.Color = Colors.Red;
     

  • 相关阅读:
    MySQL导出数据库
    Struts2拦截器的应用
    Java JVM
    Http协议状态码
    6.过滤器(Filter)
    5.监听器(Listener)
    4.会话管理(Session)
    3.Servlet(二)
    2.Servlet(一)
    1.搭建JavaEE开发环境
  • 原文地址:https://www.cnblogs.com/liangouyang/p/1315137.html
Copyright © 2011-2022 走看看