Image container.
Inheritance: Control
示例#1
0
        /// <summary>
        /// Sets the button's image.
        /// </summary>
        /// <param name="textureName">Texture name. Null to remove.</param>
        /// <param name="center">Determines whether the image should be centered.</param>
        public virtual void SetImage(String textureName, bool center = false)
        {
            if (String.IsNullOrEmpty(textureName))
            {
                if (m_Image != null)
                {
                    m_Image.Dispose();
                }
                m_Image = null;
                return;
            }

            if (m_Image == null)
            {
                m_Image = new ImagePanel(this);
            }

            //m_Image.Texture.Image = new Image();
            throw new NotImplementedException();

            m_Image.SizeToContents( );
            m_Image.SetPosition(Math.Max(Padding.Left, 2), 2);
            m_CenterImage = center;

            TextPadding = new Padding(m_Image.Right + 2, TextPadding.Top, TextPadding.Right, TextPadding.Bottom);
        }
示例#2
0
        /// <summary>
        /// Sets the button's image.
        /// </summary>
        /// <param name="image">Image bitmap.</param>
        /// <param name="center">Determines whether the image should be centered.</param>
        public virtual void SetImage(ResourceHandle <Image> imageHandle, bool center = false)
        {
            if (m_Image == null)
            {
                m_Image = new ImagePanel(this);
            }

            m_Image.SetImage(imageHandle);

            m_Image.SizeToContents( );
            m_Image.SetPosition(Math.Max(Padding.Left, 2), 2);
            m_CenterImage = center;

            TextPadding = new Padding(m_Image.Right + 2, TextPadding.Top, TextPadding.Right, TextPadding.Bottom);
        }
示例#3
0
文件: Button.cs 项目: tritao/flood
        /// <summary>
        /// Sets the button's image.
        /// </summary>
        /// <param name="image">Image bitmap.</param>
        /// <param name="center">Determines whether the image should be centered.</param>
        public virtual void SetImage(Bitmap image, bool center = false)
        {
            if (m_Image == null)
            {
                m_Image = new ImagePanel(this);
            }

            m_Image.Texture.LoadBitmap(image);

            m_Image.SizeToContents( );
            m_Image.SetPosition(Math.Max(Padding.Left, 2), 2);
            m_CenterImage = center;

            TextPadding = new Padding(m_Image.Right + 2, TextPadding.Top, TextPadding.Right, TextPadding.Bottom);
        }
示例#4
0
文件: Button.cs 项目: tritao/flood
        /// <summary>
        /// Sets the button's image.
        /// </summary>
        /// <param name="textureName">Texture name. Null to remove.</param>
        /// <param name="center">Determines whether the image should be centered.</param>
        public virtual void SetImage(String textureName, bool center = false)
        {
            if (String.IsNullOrEmpty(textureName))
            {
                if (m_Image != null)
                    m_Image.Dispose();
                m_Image = null;
                return;
            }

            if (m_Image == null)
            {
                m_Image = new ImagePanel(this);
            }

            m_Image.ImageName = textureName;
            m_Image.SizeToContents( );
            m_Image.SetPosition(Math.Max(Padding.Left, 2), 2);
            m_CenterImage = center;

            TextPadding = new Padding(m_Image.Right + 2, TextPadding.Top, TextPadding.Right, TextPadding.Bottom);
        }
示例#5
0
        public void TestImagePanel()
        {
            var control = new ImagePanel(canvas);
            var img = Image.Create(Allocator.GetStack(), 100, 300, PixelFormat.B8G8R8A8);
            control.SetImage(img);

            GUI.Test(control, "ImagePanel1");
        }
示例#6
0
        /// <summary>
        /// Sets the button's image.
        /// </summary>
        /// <param name="image">Image bitmap.</param>
        /// <param name="center">Determines whether the image should be centered.</param>
        public virtual void SetImage(ResourceHandle<Image> imageHandle, bool center = false)
        {
            if (m_Image == null)
            {
                m_Image = new ImagePanel(this);
            }

            m_Image.SetImage(imageHandle);

            m_Image.SizeToContents( );
            m_Image.SetPosition(Math.Max(Padding.Left, 2), 2);
            m_CenterImage = center;

            TextPadding = new Padding(m_Image.Right + 2, TextPadding.Top, TextPadding.Right, TextPadding.Bottom);
        }