/// <summary> /// Initialize a new instance of the KryptonGalleryActionList class. /// </summary> /// <param name="owner">Designer that owns this action list instance.</param> public KryptonGalleryActionList(KryptonGalleryDesigner owner) : base(owner.Component) { // Remember the gallery instance _gallery = (KryptonGallery)owner.Component; // Cache service used to notify when a property has changed _service = (IComponentChangeService)GetService(typeof(IComponentChangeService)); }
/// <summary> /// Initialize a new instance of the ViewDrawButton class. /// </summary> /// <param name="gallery">Owning gallery instance.</param> /// <param name="palette">Palette used to recover values.</param> /// <param name="layout">Reference to item layout.</param> /// <param name="needPaint">Delegate for requesting paints.</param> public ViewDrawRibbonGalleryItem(KryptonGallery gallery, IPaletteTriple palette, ViewLayoutRibbonGalleryItems layout, NeedPaintHandler needPaint) : base(palette, palette, palette, palette, null, null, VisualOrientation.Top, false) { _gallery = gallery; // We provide the content for the button ButtonValues = this; // Need controller to handle tracking/pressing etc _controller = new GalleryItemController(this, layout, needPaint); _controller.Click += new MouseEventHandler(OnItemClick); MouseController = _controller; SourceController = _controller; KeyController = _controller; }
/// <summary> /// Initialize a new instance of the ViewLayoutRibbonGalleryItems class. /// </summary> /// <param name="palette">Reference to palette for display values.</param> /// <param name="gallery">Reference to owning gallery.</param> /// <param name="needPaint">Delegate for requesting paints.</param> /// <param name="buttonUp">Reference to the up button.</param> /// <param name="buttonDown">Reference to the down button.</param> /// <param name="buttonContext">Reference to the context button.</param> public ViewLayoutRibbonGalleryItems(IPalette palette, KryptonGallery gallery, NeedPaintHandler needPaint, ViewDrawRibbonGalleryButton buttonUp, ViewDrawRibbonGalleryButton buttonDown, ViewDrawRibbonGalleryButton buttonContext) { Debug.Assert(palette != null); Debug.Assert(gallery != null); Debug.Assert(needPaint != null); Debug.Assert(buttonUp != null); Debug.Assert(buttonDown != null); Debug.Assert(buttonContext != null); _gallery = gallery; _needPaint = needPaint; _buttonUp = buttonUp; _buttonDown = buttonDown; _buttonContext = buttonContext; _bringIntoView = -1; ScrollIntoView = true; // Need to know when any button is clicked _buttonUp.Click += OnButtonUp; _buttonDown.Click += OnButtonDown; _buttonContext.Click += OnButtonContext; // Create triple that can be used by the draw button _style = ButtonStyle.LowProfile; _triple = new PaletteTripleToPalette(palette, PaletteBackStyle.ButtonLowProfile, PaletteBorderStyle.ButtonLowProfile, PaletteContentStyle.ButtonLowProfile); // Setup timer to use for scrolling lines _scrollTimer = new Timer { Interval = 40 }; _scrollTimer.Tick += OnScrollTick; }
/// <summary> /// Initialise a new instance of the KryptonRibbonGroupGallery class. /// </summary> public KryptonRibbonGroupGallery() { // Default fields _visible = true; _enabled = true; _keyTip = "X"; _itemSizeMax = GroupItemSize.Large; _itemSizeMin = GroupItemSize.Small; _itemSizeCurrent = GroupItemSize.Large; _largeItemCount = 9; _mediumItemCount = 3; _dropButtonItemWidth = 9; _imageLarge = _defaultButtonImageLarge; _textLine1 = "Gallery"; _textLine2 = string.Empty; ToolTipImageTransparentColor = Color.Empty; ToolTipTitle = string.Empty; ToolTipBody = string.Empty; ToolTipStyle = LabelStyle.SuperTip; // Create the actual text box control and set initial settings Gallery = new KryptonGallery { AlwaysActive = false, TabStop = false, InternalPreferredItemSize = new Size(_largeItemCount, 1) }; // Hook into events to expose via this container Gallery.SelectedIndexChanged += OnGallerySelectedIndexChanged; Gallery.ImageListChanged += OnGalleryImageListChanged; Gallery.TrackingImage += OnGalleryTrackingImage; Gallery.GalleryDropMenu += OnGalleryGalleryDropMenu; Gallery.GotFocus += OnGalleryGotFocus; Gallery.LostFocus += OnGalleryLostFocus; // Ensure we can track mouse events on the gallery MonitorControl(Gallery); }
/// <summary> /// Initialize a new instance of the ViewLayoutRibbonGalleryItems class. /// </summary> /// <param name="palette">Reference to palette for display values.</param> /// <param name="gallery">Reference to owning gallery.</param> /// <param name="needPaint">Delegate for requesting paints.</param> /// <param name="buttonUp">Reference to the up button.</param> /// <param name="buttonDown">Reference to the down button.</param> /// <param name="buttonContext">Reference to the context button.</param> public ViewLayoutRibbonGalleryItems(IPalette palette, KryptonGallery gallery, NeedPaintHandler needPaint, ViewDrawRibbonGalleryButton buttonUp, ViewDrawRibbonGalleryButton buttonDown, ViewDrawRibbonGalleryButton buttonContext) { Debug.Assert(palette != null); Debug.Assert(gallery != null); Debug.Assert(needPaint != null); Debug.Assert(buttonUp != null); Debug.Assert(buttonDown != null); Debug.Assert(buttonContext != null); _gallery = gallery; _needPaint = needPaint; _buttonUp = buttonUp; _buttonDown = buttonDown; _buttonContext = buttonContext; _bringIntoView = -1; _scrollIntoView = true; // Need to know when any button is clicked _buttonUp.Click += new MouseEventHandler(OnButtonUp); _buttonDown.Click += new MouseEventHandler(OnButtonDown); _buttonContext.Click += new MouseEventHandler(OnButtonContext); // Create triple that can be used by the draw button _style = ButtonStyle.LowProfile; _triple = new PaletteTripleToPalette(palette, PaletteBackStyle.ButtonLowProfile, PaletteBorderStyle.ButtonLowProfile, PaletteContentStyle.ButtonLowProfile); // Setup timer to use for scrolling lines _scrollTimer = new Timer(); _scrollTimer.Interval = 40; _scrollTimer.Tick += new EventHandler(OnScrollTick); }
private void UnmonitorControl(KryptonGallery c) { c.MouseEnter -= new EventHandler(OnControlEnter); c.MouseLeave -= new EventHandler(OnControlLeave); }
private void UnmonitorControl(KryptonGallery c) { c.MouseEnter -= new EventHandler(OnControlEnter); c.MouseLeave -= new EventHandler(OnControlLeave); }
/// <summary> /// Initialise a new instance of the KryptonRibbonGroupGallery class. /// </summary> public KryptonRibbonGroupGallery() { // Default fields _visible = true; _enabled = true; _keyTip = "X"; _itemSizeMax = GroupItemSize.Large; _itemSizeMin = GroupItemSize.Small; _itemSizeCurrent = GroupItemSize.Large; _largeItemCount = 9; _mediumItemCount = 3; _dropButtonItemWidth = 9; _imageLarge = _defaultButtonImageLarge; _textLine1 = "Gallery"; _textLine2 = string.Empty; _toolTipImageTransparentColor = Color.Empty; _toolTipTitle = string.Empty; _toolTipBody = string.Empty; _toolTipStyle = LabelStyle.SuperTip; // Create the actual text box control and set initial settings _gallery = new KryptonGallery(); _gallery.AlwaysActive = false; _gallery.TabStop = false; _gallery.InternalPreferredItemSize = new Size(_largeItemCount, 1); // Hook into events to expose via this container _gallery.SelectedIndexChanged += new EventHandler(OnGallerySelectedIndexChanged); _gallery.ImageListChanged += new EventHandler(OnGalleryImageListChanged); _gallery.TrackingImage += new EventHandler<ImageSelectEventArgs>(OnGalleryTrackingImage); _gallery.GalleryDropMenu += new EventHandler<GalleryDropMenuEventArgs>(OnGalleryGalleryDropMenu); _gallery.GotFocus += new EventHandler(OnGalleryGotFocus); _gallery.LostFocus += new EventHandler(OnGalleryLostFocus); // Ensure we can track mouse events on the gallery MonitorControl(_gallery); }
/// <summary> /// Initializes the designer with the specified component. /// </summary> /// <param name="component">The IComponent to associate the designer with.</param> public override void Initialize(IComponent component) { Debug.Assert(component != null); // Validate the parameter reference if (component == null) throw new ArgumentNullException("component"); // Let base class do standard stuff base.Initialize(component); // Cast to correct type _gallery = (KryptonGallery)component; // We need to know when we are being removed _changeService = (IComponentChangeService)GetService(typeof(IComponentChangeService)); _changeService.ComponentRemoving += new ComponentEventHandler(OnComponentRemoving); }
/// <summary> /// Perform licence checking actions. /// </summary> /// <param name="gallery">Gallery control reference.</param> internal static void PerformLicenceChecking(KryptonGallery gallery) { }
/// <summary> /// Perform licence checking actions. /// </summary> /// <param name="gallery">Gallery control reference.</param> internal static void PerformLicenceChecking(KryptonGallery gallery) { // Define the encryted licence information EncryptedLicenseProvider.SetParameters(_licenseParameters); // If an error has already been shown, then no need to test license again bool validated = _usageShown; if (!validated) { // Is there a valid license registered? License license = null; validated = LicenseManager.IsValid(typeof(KryptonGallery), gallery, out license); // Valid license is not enough! if (validated) { validated = false; EncryptedLicense encryptedLicense = license as EncryptedLicense; string[] productInfo = encryptedLicense.ProductInfo.Split(','); // Must contain two fields separated by a comma if (productInfo.Length == 2) { // Both fields must not be empty if (!string.IsNullOrEmpty(productInfo[0]) && !string.IsNullOrEmpty(productInfo[1])) { // Product code must be ... // 'S' = Krypton Suite // And version number... // '440' validated = (productInfo[1].Equals("440")) && (productInfo[0][0] == 'S'); } } } // Remember to release resources no longer needed if (license != null) license.Dispose(); } // If we need to indicate the invalid licensing state... if (!validated) { // Get hold of the assembly version number Version thisVersion = Assembly.GetExecutingAssembly().GetName().Version; // We want a unique 30 day evaluation period for each major/minor version EvaluationMonitor monitor = new EvaluationMonitor(_monitorId + thisVersion.Major.ToString() + thisVersion.Minor.ToString()); // If the first time we have failed to get the licence or // the 30 days evaluation period has expired or the component // has been created over a 3000 times then... if ((monitor.UsageCount == 0) || (monitor.UsageCount > 3000) || (monitor.DaysInUse > 30)) { // At runtime show a NAG screen to prevent unauthorized use of the control if (LicenseManager.CurrentContext.UsageMode == LicenseUsageMode.Runtime) { MessageBox.Show("This application was created using an unlicensed version of\n" + "the Krypton Suite control from Component Factory Pty Ltd.\n\n" + "You must contact your software supplier in order to resolve\n" + "the licencing issue.", "Unlicensed Application", MessageBoxButtons.OK, MessageBoxIcon.Error); } else { LicenseInstallForm form = new LicenseInstallForm(); form.ShowDialog(typeof(KryptonGallery)); } } } // No need to perform check check more than once _usageShown = true; }
/// <summary> /// Perform licence checking actions. /// </summary> /// <param name="gallery">Gallery control reference.</param> internal static void PerformLicenceChecking(KryptonGallery gallery) { // Define the encryted licence information EncryptedLicenseProvider.SetParameters(_licenseParameters); // If an error has already been shown, then no need to test license again bool validated = _usageShown; if (!validated) { // Is there a valid license registered? License license = null; validated = LicenseManager.IsValid(typeof(KryptonGallery), gallery, out license); // Valid license is not enough! if (validated) { validated = false; EncryptedLicense encryptedLicense = license as EncryptedLicense; string[] productInfo = encryptedLicense.ProductInfo.Split(','); // Must contain two fields separated by a comma if (productInfo.Length == 2) { // Both fields must not be empty if (!string.IsNullOrEmpty(productInfo[0]) && !string.IsNullOrEmpty(productInfo[1])) { // Product code must be ... // 'S' = Krypton Suite // And version number... // '440' validated = (productInfo[1].Equals("440")) && (productInfo[0][0] == 'S'); } } } // Remember to release resources no longer needed if (license != null) { license.Dispose(); } } // If we need to indicate the invalid licensing state... if (!validated) { // Get hold of the assembly version number Version thisVersion = Assembly.GetExecutingAssembly().GetName().Version; // We want a unique 30 day evaluation period for each major/minor version EvaluationMonitor monitor = new EvaluationMonitor(_monitorId + thisVersion.Major.ToString() + thisVersion.Minor.ToString()); // If the first time we have failed to get the licence or // the 30 days evaluation period has expired or the component // has been created over a 3000 times then... if ((monitor.UsageCount == 0) || (monitor.UsageCount > 3000) || (monitor.DaysInUse > 30)) { // At runtime show a NAG screen to prevent unauthorized use of the control if (LicenseManager.CurrentContext.UsageMode == LicenseUsageMode.Runtime) { MessageBox.Show("This application was created using an unlicensed version of\n" + "the Krypton Suite control from Component Factory Pty Ltd.\n\n" + "You must contact your software supplier in order to resolve\n" + "the licencing issue.", "Unlicensed Application", MessageBoxButtons.OK, MessageBoxIcon.Error); } else { LicenseInstallForm form = new LicenseInstallForm(); form.ShowDialog(typeof(KryptonGallery)); } } } // No need to perform check check more than once _usageShown = true; }