Home All Groups Group Topic Archive Search About
Author
29 Sep 2006 11:39 AM
Paul Cheetham
Hi,

I have a custom control, which creates 2 child controls - an ImageButton
and an image as shown in the following code:


// Setup the controls on the page.
btnImage = new System.Web.UI.WebControls.ImageButton();
btnImage.ImageAlign = ImageAlign.Top & ImageAlign.Left;

btnDisableImage = new System.Web.UI.WebControls.Image();
btnDisableImage.ImageUrl = DisableImageURLFromViewState;
btnDisableImage.Visible = false;



When this is displayed at design time, if I change the position of the
control (by changing the left and top attributes of the Style property)
then I get a rectangle drawn at the specified coordinates, and the image
button is drawn at double to specified corodinates.

So if I set the position to 100, 100, I get a rectangle drawn at that
point, and then the image is displayed at 200, 200

It looks like the style I set for the container control then also gets
applied to its child controls!


Is there a way around this?


I'm new to Custom Controls, so maybe I've missed something.

I'm developing it in VS2005, c#


Thankyou.


Paul

Author
29 Sep 2006 2:15 PM
Gaurav Vaish (www.EduJiniOnline.com)
> // Setup the controls on the page.
> btnImage = new System.Web.UI.WebControls.ImageButton();
> btnImage.ImageAlign = ImageAlign.Top & ImageAlign.Left;

Still thinking on other parts... but probably:

ImageAling = ImageAling.Top | ImageAlign.Left;

(bitwise OR and not bitwise AND should be the case)


Author
29 Sep 2006 2:32 PM
Paul Cheetham
Thanks for the reply.

That's a line I wrote in a hurry trying to fix the problem.
Unfortunately correcting it as you suggest doesn't make any difference.

Thanks again


Paul




Gaurav Vaish (www.EduJiniOnline.com) wrote:
Show quoteHide quote
>> // Setup the controls on the page.
>> btnImage = new System.Web.UI.WebControls.ImageButton();
>> btnImage.ImageAlign = ImageAlign.Top & ImageAlign.Left;
>
> Still thinking on other parts... but probably:
>
> ImageAling = ImageAling.Top | ImageAlign.Left;
>
> (bitwise OR and not bitwise AND should be the case)
>
>