示例#1
0
 /// <summary>
 /// Initializes a new instance of the <see cref="ButtonBar"/> class. 
 /// </summary>
 public ButtonBar()
 {
     TabStop = true;
     Padding = new Padding(3, 3, 3, 3);
     SetStyle(ControlStyles.AllPaintingInWmPaint, true);
     SetStyle(ControlStyles.UserPaint, true);
     SetStyle(ControlStyles.DoubleBuffer, true);
     SetStyle(ControlStyles.ResizeRedraw, true);
     SetStyle(ControlStyles.Selectable, true);
     SetStyle(ControlStyles.SupportsTransparentBackColor, true);
     BackColor = Color.Transparent;
     items = new GenericCollection<BarItem>();
     items.Inserted += OnItemsInserted;
     items.Removed += OnItemsRemoved;
     items.Changed += OnItemsChanged;
     items.Inserting += OnItemsInserting;
     items.Changing += OnItemsChanging;
     items.Removing += OnItemsRemoving;
     items.Clearing += OnItemsClearing;
     toolTip = new ToolTip();
     appearance = new Appearance();
     appearance.AppearanceChanged += OnAppearanceChanged;
     currentAppearance = new Appearance();
     themeProperty = new ThemeProperty();
     themeProperty.ThemeChanged += OnAppearanceChanged;
     showScroll = false;
     useMnemonic = true;
     showBorders = true;
     Height = 200;
     InitializeDefaultScheme();
     SetThemeDefaults();
 }
示例#2
0
 /// <summary>
 /// Initializes a new instance of the <see cref="ButtonBar"/> class.
 /// </summary>
 public ButtonBar()
 {
     TabStop = true;
     Padding = new Padding(3, 3, 3, 3);
     SetStyle(ControlStyles.AllPaintingInWmPaint, true);
     SetStyle(ControlStyles.UserPaint, true);
     SetStyle(ControlStyles.DoubleBuffer, true);
     SetStyle(ControlStyles.ResizeRedraw, true);
     SetStyle(ControlStyles.Selectable, true);
     SetStyle(ControlStyles.SupportsTransparentBackColor, true);
     BackColor        = Color.Transparent;
     items            = new GenericCollection <BarItem>();
     items.Inserted  += OnItemsInserted;
     items.Removed   += OnItemsRemoved;
     items.Changed   += OnItemsChanged;
     items.Inserting += OnItemsInserting;
     items.Changing  += OnItemsChanging;
     items.Removing  += OnItemsRemoving;
     items.Clearing  += OnItemsClearing;
     toolTip          = new ToolTip();
     appearance       = new Appearance();
     appearance.AppearanceChanged += OnAppearanceChanged;
     currentAppearance             = new Appearance();
     themeProperty = new ThemeProperty();
     themeProperty.ThemeChanged += OnAppearanceChanged;
     showScroll  = false;
     useMnemonic = true;
     showBorders = true;
     Height      = 200;
     InitializeDefaultScheme();
     SetThemeDefaults();
 }
示例#3
0
 /// <summary>
 /// Imports Appearance from exported XML file.
 /// </summary>
 /// <param name="fileName">*.xml file containing Appearance export.</param>
 /// <returns>Wether Import operation was successful or not.</returns>
 public bool ImportAppearance(string fileName)
 {
     try
     {
         using (var fs = new FileStream(fileName, FileMode.Open))
         {
             var serializer = new XmlSerializer(typeof(Appearance));
             var app        = (Appearance)serializer.Deserialize(fs);
             Appearance.Assign(app);
             SetThemeDefaults();
             Refresh();
         }
     }
     catch (Exception)
     {
     }
     return(false);
 }