public SetImage ( ResourceHandle |
||
imageHandle | ResourceHandle |
|
return | void |
/// <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); }
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"); }