problems so far...
However, when it loads the image using IMAGEURL=, it doesn't keep the
original aspect ratio.
Is there a way to keep this without resizing the control?
Many thanks,
David Whitchurch-BennettThe aspect ratio is not affected at all by the ImageURL property. Most
likely you have the height or width of the control set to a value. If you
remove those values from the control, the image will come in at its normal
size, if you want it smaller (but wish to preserve the aspect ratio), then
just set a width or a height for the control but not both.
"David Whitchurch-Bennett"
<DavidWhitchurchBennett@.discussions.microsoft.com> wrote in message
news:11381908-84A6-467F-99A3-B274561AA68D@.microsoft.com...
>I have some image buttons which I am dynamically adding from a database. No
> problems so far...
> However, when it loads the image using IMAGEURL=, it doesn't keep the
> original aspect ratio.
> Is there a way to keep this without resizing the control?
> Many thanks,
> David Whitchurch-Bennett
Thanks for that information. What I have in my app is an image button set to
250 x 250, with a thick border which is all part of the visual theme. That is
why I have set the size first. What I want to do is load an image dynamically
in the center of the image button, but keep the image button border the same
size, so the visual theme is preserved.
Is this possible, or will the only way be to place the image button into
another container with a border.
"Scott M." wrote:
> The aspect ratio is not affected at all by the ImageURL property. Most
> likely you have the height or width of the control set to a value. If you
> remove those values from the control, the image will come in at its normal
> size, if you want it smaller (but wish to preserve the aspect ratio), then
> just set a width or a height for the control but not both.
> "David Whitchurch-Bennett"
> <DavidWhitchurchBennett@.discussions.microsoft.com> wrote in message
> news:11381908-84A6-467F-99A3-B274561AA68D@.microsoft.com...
> >I have some image buttons which I am dynamically adding from a database. No
> > problems so far...
> > However, when it loads the image using IMAGEURL=, it doesn't keep the
> > original aspect ratio.
> > Is there a way to keep this without resizing the control?
> > Many thanks,
> > David Whitchurch-Bennett
>
I think this is more of an issue of having graphics that will fit into a
250x250 space that VS.NET sizing the images for you. Your best bet is to
use a good graphics tool to create images that will fit into that space,
rather than attempt to have VS.NET fit them for you.
"David Whitchurch-Bennett"
<DavidWhitchurchBennett@.discussions.microsoft.com> wrote in message
news:B4825793-D8BD-476C-96B8-9E63062C1B6F@.microsoft.com...
> Thanks for that information. What I have in my app is an image button set
> to
> 250 x 250, with a thick border which is all part of the visual theme. That
> is
> why I have set the size first. What I want to do is load an image
> dynamically
> in the center of the image button, but keep the image button border the
> same
> size, so the visual theme is preserved.
> Is this possible, or will the only way be to place the image button into
> another container with a border.
> "Scott M." wrote:
>> The aspect ratio is not affected at all by the ImageURL property. Most
>> likely you have the height or width of the control set to a value. If
>> you
>> remove those values from the control, the image will come in at its
>> normal
>> size, if you want it smaller (but wish to preserve the aspect ratio),
>> then
>> just set a width or a height for the control but not both.
>>
>> "David Whitchurch-Bennett"
>> <DavidWhitchurchBennett@.discussions.microsoft.com> wrote in message
>> news:11381908-84A6-467F-99A3-B274561AA68D@.microsoft.com...
>> >I have some image buttons which I am dynamically adding from a database.
>> >No
>> > problems so far...
>>> > However, when it loads the image using IMAGEURL=, it doesn't keep the
>> > original aspect ratio.
>>> > Is there a way to keep this without resizing the control?
>>> > Many thanks,
>>> > David Whitchurch-Bennett
>>>
>>
>
I already have this. I am using a class that I have written to scale down the
image first for two reasons.
1. To help the page load faster.
2. To prevent people downloading the full size images (photographic website).
Rather than resizing all of my photos, my class takes care of this by
scaling down the image. I pass the maximum width and height, and the image is
scaled down to fit and it maintains the aspect ratio.
When I put the scaled down image into the button, it stetches it out to fit
in both dimensions.
I guess I just asumed there would be a way to display the image without
stretching it out. I can pad the extra pixels in the function to return a
square image if that is a better way.
Thanks for your help. ASP.NET is quite different to what I am used to, but I
am getting there!
"Scott M." wrote:
> I think this is more of an issue of having graphics that will fit into a
> 250x250 space that VS.NET sizing the images for you. Your best bet is to
> use a good graphics tool to create images that will fit into that space,
> rather than attempt to have VS.NET fit them for you.
> "David Whitchurch-Bennett"
> <DavidWhitchurchBennett@.discussions.microsoft.com> wrote in message
> news:B4825793-D8BD-476C-96B8-9E63062C1B6F@.microsoft.com...
> > Thanks for that information. What I have in my app is an image button set
> > to
> > 250 x 250, with a thick border which is all part of the visual theme. That
> > is
> > why I have set the size first. What I want to do is load an image
> > dynamically
> > in the center of the image button, but keep the image button border the
> > same
> > size, so the visual theme is preserved.
> > Is this possible, or will the only way be to place the image button into
> > another container with a border.
> > "Scott M." wrote:
> >> The aspect ratio is not affected at all by the ImageURL property. Most
> >> likely you have the height or width of the control set to a value. If
> >> you
> >> remove those values from the control, the image will come in at its
> >> normal
> >> size, if you want it smaller (but wish to preserve the aspect ratio),
> >> then
> >> just set a width or a height for the control but not both.
> >>
> >> "David Whitchurch-Bennett"
> >> <DavidWhitchurchBennett@.discussions.microsoft.com> wrote in message
> >> news:11381908-84A6-467F-99A3-B274561AA68D@.microsoft.com...
> >> >I have some image buttons which I am dynamically adding from a database.
> >> >No
> >> > problems so far...
> >> >> > However, when it loads the image using IMAGEURL=, it doesn't keep the
> >> > original aspect ratio.
> >> >> > Is there a way to keep this without resizing the control?
> >> >> > Many thanks,
> >> >> > David Whitchurch-Bennett
> >> >>
> >>
> >>
>
How about putting the image into an image control (not a button image
control) and overlaying the image control on top of your button control?
"David Whitchurch-Bennett"
<DavidWhitchurchBennett@.discussions.microsoft.com> wrote in message
news:C9567572-5BBC-4DE9-83C9-44BE4F3465F4@.microsoft.com...
>I already have this. I am using a class that I have written to scale down
>the
> image first for two reasons.
> 1. To help the page load faster.
> 2. To prevent people downloading the full size images (photographic
> website).
> Rather than resizing all of my photos, my class takes care of this by
> scaling down the image. I pass the maximum width and height, and the image
> is
> scaled down to fit and it maintains the aspect ratio.
> When I put the scaled down image into the button, it stetches it out to
> fit
> in both dimensions.
> I guess I just asumed there would be a way to display the image without
> stretching it out. I can pad the extra pixels in the function to return a
> square image if that is a better way.
> Thanks for your help. ASP.NET is quite different to what I am used to, but
> I
> am getting there!
> "Scott M." wrote:
>> I think this is more of an issue of having graphics that will fit into a
>> 250x250 space that VS.NET sizing the images for you. Your best bet is to
>> use a good graphics tool to create images that will fit into that space,
>> rather than attempt to have VS.NET fit them for you.
>>
>> "David Whitchurch-Bennett"
>> <DavidWhitchurchBennett@.discussions.microsoft.com> wrote in message
>> news:B4825793-D8BD-476C-96B8-9E63062C1B6F@.microsoft.com...
>> > Thanks for that information. What I have in my app is an image button
>> > set
>> > to
>> > 250 x 250, with a thick border which is all part of the visual theme.
>> > That
>> > is
>> > why I have set the size first. What I want to do is load an image
>> > dynamically
>> > in the center of the image button, but keep the image button border the
>> > same
>> > size, so the visual theme is preserved.
>>> > Is this possible, or will the only way be to place the image button
>> > into
>> > another container with a border.
>>> > "Scott M." wrote:
>>> >> The aspect ratio is not affected at all by the ImageURL property.
>> >> Most
>> >> likely you have the height or width of the control set to a value. If
>> >> you
>> >> remove those values from the control, the image will come in at its
>> >> normal
>> >> size, if you want it smaller (but wish to preserve the aspect ratio),
>> >> then
>> >> just set a width or a height for the control but not both.
>> >>
>> >> "David Whitchurch-Bennett"
>> >> <DavidWhitchurchBennett@.discussions.microsoft.com> wrote in message
>> >> news:11381908-84A6-467F-99A3-B274561AA68D@.microsoft.com...
>> >> >I have some image buttons which I am dynamically adding from a
>> >> >database.
>> >> >No
>> >> > problems so far...
>> >>> >> > However, when it loads the image using IMAGEURL=, it doesn't keep
>> >> > the
>> >> > original aspect ratio.
>> >>> >> > Is there a way to keep this without resizing the control?
>> >>> >> > Many thanks,
>> >>> >> > David Whitchurch-Bennett
>> >>> >>
>> >>
>> >>
>>
>>
>
0 comments:
Post a Comment