Example #1
0
		///	<summary>
		/// Initializes the source images from the specified <see cref="ImageList"/>
		///	</summary>
		///	<param name="imageList">The source image list</param>
		/// <remarks>
		/// <para>This method (indirectly) fires a <see cref="PropertyChange"/> event with the
		/// <see cref="ImagePanelProperties.ImagesProperty"/></para>
		/// </remarks>
		public void SetImages(ImageList imageList) {
			ImageSet imageSet = new ImageSet(imageList.ImageSize,imageList.TransparentColor) ;

			foreach(Image image in imageList.Images) {
				imageSet.Images.Add(image) ;
			}

			SetImages(imageSet) ;
		}
Example #2
0
		/// <summary>
		/// Initializes the source images from the specified <see cref="ImageSet"/>
		/// </summary>
		/// <param name="imageSet">The source image collection</param>
		/// <remarks>
		/// <para>This method (indirectly) fires a <see cref="PropertyChange"/> event with the
		/// <see cref="ImagePanelProperties.ImagesProperty"/></para>
		/// </remarks>
		public void SetImages(ImageSet imageSet) {
			SetImages((Bitmap) imageSet.Preview,imageSet.Count) ;
		}
Example #3
0
        public static ImageSet BuildImageSet(string directory, String[] files)
        {
            ImageSet imageSet = new ImageSet();

            foreach (string file in files)
            {
                string[] temp = file.Split('.');
                string extension = temp[temp.Length - 1];

                Stream stream = GetStream(directory, file);
                if (extension == "ico")
                {
                    Icon icon = new Icon(stream);
                    imageSet.Images.Add(icon);
                }
                else
                {
                    Image image = Image.FromStream(stream);
                    imageSet.Images.Add(image);
                }
            }

            return imageSet;
        }
Example #4
0
		/// <summary>
		/// Create an ImagePanel using the specified <see cref="ImageSet"/> for the
		/// source images
		/// </summary>
		/// <param name="imageSet">Source images</param>
		/// <remarks>
		/// The best dimensions (rows/cols) are calculated using <see cref="PanelSizeHints.MinimizeBoth"/>
		/// which produces the best square. The client rectangle for the <c>ImagePanel</c> is calculated based
		/// upon the dimensions
		/// </remarks>
		public ImagePanel(ImageSet imageSet) {
			if (imageSet == null) {
				throw new ArgumentNullException("imageSet") ;
			}

			//
			// Required for Windows.Forms Class Composition Designer support
			//
			InitializeComponent();

			this.AutoScroll = true ;
			// by default, panel types are not tabstops. We change this, but the
			// user can override using TabStop property
			this.TabStop = true ;
			this.isPopup = false ;
			this.sourceImages = (Bitmap) imageSet.Preview ;
			this.imageCount = imageSet.Count ;
			
			Dimensions = ImagePanel.CalculateBestDimensions(imageSet.Count,PanelSizeHints.MinimizeBoth) ;
			Size bestSize = this.CalculateBestClientSize() ;
			this.Width = bestSize.Width ;
			this.Height = bestSize.Height ;
		}
Example #5
0
        private XPPanel CreateXpPanel(XPPanelGroup XPPanelGroup, ImageSet xpImageSet, string caption, int image)
        {
            XPPanel xpPanel = new XPPanel();

            xpPanel.Name = "xpPanel";
            xpPanel.Anchor = (AnchorStyles)((AnchorStyles.Top | AnchorStyles.Left) | AnchorStyles.Right);
            xpPanel.ForeColor = SystemColors.WindowText;
            xpPanel.BackColor = Color.Transparent;
            //xpPanel.Location = new Point(8, 8);
            xpPanel.Size = new Size(141, 100);
            xpPanel.TabIndex = 0;

            // Заголовок
            xpPanel.Caption = caption;
            xpPanel.Font = new Font("Courier New", 10F, FontStyle.Bold);
            //xpPanel.Font                            = new Font("Microsoft Sans Serif", 8F, FontStyle.Bold);
            xpPanel.TextColors.Foreground = Color.FromArgb(38, 115, 192);
            xpPanel.TextHighlightColors.Foreground = Color.FromArgb(38, 115, 192);
            xpPanel.VertAlignment = StringAlignment.Center;
            xpPanel.HorzAlignment = StringAlignment.Near;
            xpPanel.CaptionCornerType = XPPanelControl.CornerType.TopLeft | XPPanelControl.CornerType.TopRight;
            xpPanel.CurveRadius = 10;
            xpPanel.CaptionGradientMode = System.Drawing.Drawing2D.LinearGradientMode.Horizontal;
            xpPanel.CaptionGradient.Start = Color.FromArgb(254, 254, 254);
            xpPanel.CaptionGradient.End = Color.FromArgb(231, 236, 242);
            xpPanel.CollapsedGlyphs.ImageSet = xpImageSet;
            xpPanel.CollapsedGlyphs.Normal = 3;
            xpPanel.CollapsedGlyphs.Pressed = 2;
            xpPanel.CollapsedGlyphs.Highlight = 2;
            xpPanel.ExpandedGlyphs.ImageSet = xpImageSet;
            xpPanel.ExpandedGlyphs.Normal = 1;
            xpPanel.ExpandedGlyphs.Pressed = 0;
            xpPanel.ExpandedGlyphs.Highlight = 0;

            // Бордюр и фон
            xpPanel.CaptionUnderline = Color.FromArgb(254, 254, 254);
            xpPanel.OutlineColor = Color.FromArgb(254, 254, 254);
            xpPanel.PanelGradientMode = System.Drawing.Drawing2D.LinearGradientMode.Horizontal;
            xpPanel.PanelGradient.Start = Color.FromArgb(243, 245, 248);
            xpPanel.PanelGradient.End = Color.FromArgb(243, 245, 248);

            ButtonBar btnBar = new ButtonBar();

            // Фон
            btnBar.Dock = DockStyle.Fill;
            btnBar.ThemeProperty.ColorScheme = ColorScheme.Default;
            btnBar.ThemeProperty.UseTheme = false;
            btnBar.Appearance.Bar.BackStyle.BackColor1 = Color.FromArgb(243, 245, 248);
            btnBar.Appearance.Bar.BackStyle.BackColor2 = Color.FromArgb(243, 245, 248);
            btnBar.Appearance.Bar.AppearanceBorder.BorderVisibility = ToolStripStatusLabelBorderSides.None;
            btnBar.Appearance.Bar.CornerRadius = 0;

            // Отступы
            btnBar.Spacing = -1;
            btnBar.Padding = new Padding(10, 8, 10, 8);

            XPPanelGroup.Controls.Add(xpPanel);

            return xpPanel;
        }