Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8578563
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T20:25:10+00:00 2026-06-11T20:25:10+00:00

I am trying to set the width of an image dynamically using MonoTouch. I

  • 0

I am trying to set the width of an image dynamically using MonoTouch. I have added the image to the view using Xcode Interface Builder.

What I want to do is keep the X and Y values of the image exactly the same. I just want the width of the image to change depending on a float value.

Example: If I placed the the image on the view at X = 50 and Y = 50 and the image size is W = 100 and H = 100 then I want to change the width dynamically based on conditions. I have tried to set the images’ width dynamically like this:

img.Bounds.Width = 150;

and like this

img.Bounds.Size.Width = 150;

I have also tried to create a new RectangleF and setting the bounds equal to that Rectangle like this

RectangleF fillrect = new RectangleF(50, 50,
150, img.Bounds.Height);

and then setting the image bounds to that rectangle like this:

img.Bounds = fillrect;

The above method sizes the image but then moves the image to the incorrect place (X and Y values).

I have also tried various methods using SizeF but to no avail.

How can I just set the width of the image and keep it in the same place I placed it on interface builder?

And also how to change the X and Y values so that I can move another image based on the growth of the aforementioned image.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T20:25:11+00:00Added an answer on June 11, 2026 at 8:25 pm

    Seems like changing of Bounds applies around the Center of the view.

    Try to set new Frame instead:

    img.Frame = fillrect;
    

    Location will be the same, but Size will be changed.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to set the size of my image using getLayoutParams().height/width, but the
I'm trying to set the width & height property of an image element i've
I am adding an image into a JLabel and trying to set the width
I have an image inside a span tag, the span has a set width
I am trying to dynamically set the height of an image in the BIRT
I have been trying to set an image on an HTML.ActionLink by adding a
I've been trying to get image-loading dynamically- size dynamically to set wrapper div height
Trying to set cache response headers on a dynamically-generated image, I'm getting a weird
I'm trying to make a dynamically sizable title banner, using fairly simple image tricks.
I am trying to populate a list of images dynamically using javascript. I have

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.