|
Hi All
i need to create Control(i.e Dropdownbox ) Array in place it on web page on exact position how it to do
anyone help
thanks and regard's
Anil Jagdale
|
|
|
|
|
Why do you need an array ? A web page has a controls array already, although it's nested.
To put a page in an exact position on a web form, you need to use CSS to position it. Otherwise, it will use a standard HTML 'flow' layout.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
Hi
I have created an application with transparent main window that displays some text. To initially display and change the text, I use the following code:
if (behavior.IsVisible)
{
Show();
mImage = new Bitmap(Width, Height);
Graphics dc = Graphics.FromHwnd(Handle);
dc.TextRenderingHint = System.Drawing.Text.TextRenderingHint.SingleBitPerPixelGridFit;
SizeF size = dc.MeasureString(behavior.DisplayText, behavior.Font);
dc.Dispose();
Height = (int)size.Height + 1;
Width = (int)size.Width + 1;
mImage = new Bitmap(Width, Height);
dc = Graphics.FromImage(mImage);
dc.TextRenderingHint = System.Drawing.Text.TextRenderingHint.SingleBitPerPixelGridFit;
Color background = (behavior.Color.ToArgb() == Color.White.ToArgb()) ? Color.Black : Color.White;
dc.Clear(background);
dc.DrawString(behavior.DisplayText, behavior.Font, new SolidBrush(behavior.Color), 0, 0);
mTextColor = behavior.Color.ToArgb();
dc.Dispose();
BackgroundImage = mImage;
TransparencyKey = background;
}
else
{
Hide();
BackgroundImage = null;
}
For some reason the window shows transparent on my PC and at least one other, while on most I still get a white background (i.e. no transparency). The only difference I can think of is that on the PCs where the transparency displays correctly, VS2005 is installed, while it's VS2003 or none on the others (I'm using latest video drivers etc).
Does anyone know of this issue and how to fix it?
Thanks,
Dmitry
|
|
|
|
|
I'm not 100% sure, but I think that transparent windows can only be rendered in Windows XP.
|
|
|
|
|
You are correct, but I am talking all XP SP2 PCs here, its 2007
I think it is probably different DLL versions, like different common controls DLL, but I don't know where to start and what to look for.
|
|
|
|
|
Hello,
Had the same problem and if you search in google or msdn you will find a lot of other people sharing it.
What I found out is, that it has something todo with the graphic card and the Color quality (16bit or 32 bit).
I use the MakeTransparent method of the Bitmap class instead.
This works fine for me!
Color transparentcolor = bkgrnd.GetPixel(0,0);
BackgroundImage.MakeTransparent(transparentcolor);
Hope it helps!
All the best,
Martin
|
|
|
|
|
I have seen the postings of other people, however those that do have a solution are for C or Java. One of them talks about disabling DirectDraw acceleration for the application. It would be fine with me, but I could not find a way to do it in C# (no search results whatsoever).
I have tried MakeTransparent, but it doesn't work at all - now I see a background painted grey ("transparent" color) on all computers. Can you explain more how you are using it so it works?
Thanks,
Dmitry
|
|
|
|
|
Hello,
I'm using it for Forms with a BackgroundImage.
This Image has rounded edges with a special color, which is not used in other regions of the Image.
I don't use the TransparencyKey property at all!
Bitmap bkgrnd = new Bitmap(myimagepath);
Color transparentcolor = bkgrnd.GetPixel(0,0);
bkgrnd.MakeTransparent(transparentcolor );
this.BackgroundImage = bkgrnd;
Hope it helps!
All the best,
Martin
|
|
|
|
|
This didn't help me....
|
|
|
|
|
Zilo(svk) wrote: This didn't help me....
Why?
Show me the code you are using!
All the best,
Martin
|
|
|
|
|
I don't know why, it just doesn't work. Myabe I'm doing something wrong...
Resources.StartUpPicture.MakeTransparent(Color.FromArgb(80, 80, 80));
//or
//Color transparentColor = Resources.StartUpPicture.GetPixel(0, 0);
//Resources.StartUpPicture.MakeTransparent(transparentColor);
//doesn't matter, I know the color values
this.BackgroundImage = Resources.StartUpPicture;
this.BackgroundImageLayout = ImageLayout.Stretch;
|
|
|
|
|
Zilo(svk) wrote: I don't know why, it just doesn't work. Myabe I'm doing something wrong...
Sorry, I meant what's the effect you see right now?
I don't know if working with the Resources is ok.
Martin
|
|
|
|
|
Allright, it works this way
Bitmap bmp = (Bitmap)Resources.StartUpPicture.Clone();
bmp.MakeTransparent(Color.FromArgb(80,80,80));
this.BackgroundImage = bmp;// Resources.StartUpPicture;
this.BackgroundImageLayout = ImageLayout.Stretch;
But behind the transparent image, there is still gray form background... And I need to make it transparent too, thats why I used the TransparencyKey.
Anyway thanx for help
|
|
|
|
|
Zilo(svk) wrote: But behind the transparent image, there is still gray form background... And I need to make it transparent too, thats why I used the TransparencyKey.
I have the same thing at my form!
Don't use the TransparencyKey!
Zilo(svk) wrote: this.BackgroundImageLayout = ImageLayout.Stretch;
I don't know what this does, maybe just for test reason, leave it out.
All the best,
Martin
|
|
|
|
|
That's for stretching the image to form's size. I can't leave it out (tried and didn't help)
Anyway, why do you think Bitmap.MakeTransparent() will changed form's background to transparent? Imagine that you have black image with red triangle within, and you want to use it as triangle startup Form(with no borders, buttons etc..) . Just setting the black color on image as transparent will cause to display square Form with default background and red triangle within (instead black form with red triangle). In my point of view you have two options. You can changed the Form.Region value to display only triangle (which is not so difficult in this case), or use TransparencyKey. Image I use is almost impossible to describe in Region (many diffrent shapes) , so I have only one option left -> TransparencyKey.
Or do you know any other ways to do that?
|
|
|
|
|
What I'm having is a image which fills completely the Form.
The Form also has a gray Bockground.
Then I "MakeTransparent" with a special color, and at the reagon (at the rounded edge) on the bitmap, where the special color was, my Form also shows the things which are under the Form (not my gray Background).
Maybe there is a propblem because you are doing the stretching after the MakeTransparent.
Try the stretching before.
All the best,
Martin
|
|
|
|
|
I tried to put it before or remove it. No change. I'll probobly stick with TransparencyKey, which by the way I use on one more place-> Trasparent Flash player. So I need to make it work
|
|
|
|
|
Strange, here it doesn't work at all... I think maybe what I am seeing is actually form's BackColor. What did you set it to be (Color.Transparent throws exception)?
UPDATE: Regarding the bit depth/resulution, on some PCs the transparency only works in 16 bit color (on the old Intel onboard graphics). Blasted graphics drivers
|
|
|
|
|
Hello,
I'm really confused!
Just made a test project.
)MainForm has a Backgroundimage during DesignTime.
)BackgroundImage is a bmp File designed in Paint (All Black only a Red Line in the middle)
)BackgoundColor is Default "Control".
)No TransparencyKey set
)Following code in the Forms constructor (After InitializeComponents)
Bitmap b = this.BackgroundImage as Bitmap;
b.MakeTransparent(Color.Black);
this.BackgroundImage = b;
)When I start now, I see just the Red line and the Desktop.
)If I move the Form then off corse the Desktop is not refreshing in the Forms region.
All the best,
Martin
|
|
|
|
|
Done the same, didn't help
|
|
|
|
|
Zilo(svk) wrote: Done the same, didn't help
So you see the BackgroundColor of your Form right now?
Then I'm sorry for wasting your time!
Hope somebody helps you out.
All the best,
Martin
|
|
|
|
|
yep
Don't be sorry, thanx for your time.
|
|
|
|
|
I'm facing exactly same problem. I just doesn't work on some PC's (with XP SP2) . If u find any sollution I would be very gratefull . I was thinking that it is caused by some settings of desktop... anyway, it causes me big headache
|
|
|
|
|
I have tried both 32 and 16 bit color, doesn't change anything on my PC. I will go see if it changes something on the ones that do not work.
Its strange that there is no posting from MS on this, maybe we should post it on their newsboard. If I find a solution I will post it here.
Good luck,
Dmitry
|
|
|
|
|
I've tried to go from 32 to 16 bit and it helped!!! But it looks that it's diffrent from one PC to another... And using MakeTransparent didn't help at all...
|
|
|
|