CheckBox.Backround and CheckBox.SetBackgroundImage

William Hunter

Active Member
Licensed User
Longtime User
What is the difference between CheckBox.Background = BitmapImage, and CheckBox.SetBackgroundImage = BitmapImage? When is it appropriate to use either of these over the other? I’m looking for a way to use two graphics, one for checked and one for unchecked. Will these two Members let me do this?

Any help greatly appreciated :sign0085:
 

Theera

Well-Known Member
Licensed User
Longtime User
What is the difference between CheckBox.Background = BitmapImage, and CheckBox.SetBackgroundImage = BitmapImage? When is it appropriate to use either of these over the other? I’m looking for a way to use two graphics, one for checked and one for unchecked. Will these two Members let me do this?

Any help greatly appreciated :sign0085:

Try use Nine patch image feather.

Best Regards
Theera
 
Upvote 0

William Hunter

Active Member
Licensed User
Longtime User
Try use Nine patch image feather.

Best Regards
Theera

Thank you Theera. I would still like to have an answer to my original question. Can anyone shed light on this for me? :sign0163:

Regards
 
Upvote 0

agraham

Expert
Licensed User
Longtime User
The (set)Backgroundproperty takes a Drawable whereas the SetBackgroundImage method takes a Bitmap and converts it to a Drawable.
B4X:
  public void setBackground(Drawable drawable) {
    ((View)getObject()).setBackgroundDrawable(drawable);
  }

  public void SetBackgroundImage(Bitmap Bitmap) {
    BitmapDrawable bd = new BitmapDrawable();
    bd.Initialize(Bitmap);
    ((View)getObject()).setBackgroundDrawable((Drawable)bd.getObject());
  }
 
Upvote 0

William Hunter

Active Member
Licensed User
Longtime User
The (set)Backgroundproperty takes a Drawable whereas the SetBackgroundImage method takes a Bitmap and converts it to a Drawable.

Thank you agraham. I needed to understand the difference, now I do.

Best Regards :)
 
Upvote 0
Top