|
Good Day,
I have a FORM that has a background image (PNG), it covers the whole form.
Now, when I added a groupbox and set it backcolor to "Transparent", the expected thing did not happen.
The groupbox got the color of my Form (Form.BackgroundColor).
Is there anyway to force the groupbox to display the background image? Not the backgroundcolor?
Thanks,
Ian
|
|
|
|
|
I think you need to set a style to support transparency. Even then, I'm not sure if it will work, or if you need to set the appropriate bitmap to the background of your groupbox.
Christian Graus - Microsoft MVP - C++
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
Thanks for the reply.
I made it work already. What I did was, instead of making use of a background image, i just used a PictureBox and resize it to cover the whole form.
Then, i set the controls to transparent then added this code at form load.
foreach(Control Found in this.Controls)<br />
{<br />
Found.Parent=PictureBox1;<br />
Found.BackColor = Color.Transparent;<br />
}
|
|
|
|
|
HI Guy
i have to rember i was read a article like this work done in that.
i will try get that, if get i will post here.
but can u try with SetTransparent Color.
if u r licky, i will get that link.
Cheers
RRave
MCTS,MCPD
|
|
|
|
|
i was trying to write the files on the network , during writing , i got the error that i don;t have the permissions to write the files in that folder.
Now the question is can i programatically ascertain whether i have the right to write the files in that folder.
Yesterday is a canceled check. Tomorrow is a promissory note. Today is the ready cash. USE IT.
|
|
|
|
|
How are you opening the file? Aren't you asking for ReadWrite access while opening? What does it return?
Nobody can give you wiser advice than yourself. - Cicero
.·´¯`·->Rajesh<-·´¯`·.
Codeproject.com: Visual C++ MVP
|
|
|
|
|
i get the exception if i don't have the write permissions in that network folder .That's why i want to check it in advance whether i have the write permissions in that folder.
Yesterday is a canceled check. Tomorrow is a promissory note. Today is the ready cash. USE IT.
|
|
|
|
|
I am asking you how you are opening the file? You would be specifying the access you want on the file while opening and the file open command should return you a value. If it's that hard to understand, show me the code that you're using to open the file.
Nobody can give you wiser advice than yourself. - Cicero
.·´¯`·->Rajesh<-·´¯`·.
Codeproject.com: Visual C++ MVP
|
|
|
|
|
I don't think you can check that without trying to create a file. Why not just use a try/catch to work out when this is the issue ?
Christian Graus - Microsoft MVP - C++
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
It is working very fine in try catch .But i get there as exception, that i don;t have the permissions.
that's y i wanted to know this in advance.
Yesterday is a canceled check. Tomorrow is a promissory note. Today is the ready cash. USE IT.
|
|
|
|
|
|
Hi
I am converting some code from Java to C#.
RandomAccessFile class is used in Java application. What would be replacement of this class in C#.
Thank You
James
|
|
|
|
|
Just a FileStream, I'd have thought. They have a Seek method, which makes it random access, right ?
Christian Graus - Microsoft MVP - C++
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
|
Hi,
I have issue converting sbyte[] to byte[] array. My function(actually third party dll) returns sbyte with negative values. My question is how to put this sybte[] info( contains info of image) in to httpResponse object which takes only byte[] array.
Response.Expires = -1;
Response.Buffer = true;
Response.ContentType = "image/gif";
byte[] mapContent=null;
sbyte[] shortContent=mapFormat.DrawMap(map);
Response.BinaryWrite(?????)----- takes only byte[] info..
Thanks...
|
|
|
|
|
Like this:
mapContent = Array.ConvertAll<sbyte, byte>(shortContent, delegate(sbyte s) { return (byte)s; } );
Experience is the sum of all the mistakes you have done.
|
|
|
|
|
Thanks.. It solved the issue now... I am doing conversion with 2s compliment. when i do it normally, negative values overflows and returns error message. I am using 1.1 version. Now I am getting maps..
for(int i=0;i< shortContent.GetLength(0);i++)
{
if(i==0)
mapContent=new byte[shortContent.GetLength(0)];
sval=shortContent[i];
if ( sval < 0 )
val = (byte)(256 + sval);
else
val = (byte)sval;
mapContent[i]=val;
}
|
|
|
|
|
Hi,
I'm trying to code a tetris game in a windows form.
I have a class named fallingobject and since in the tetris game there are 4 shapes of fallingobjects, I've created 4 instances of fallingobject class and added them to a array (named as objcts) of type : fallingobject
If for example next shape is square I'm going to need an instance of objcts[0] element and change the coordinates property of it in my functions. But I don't want to change the properties of the object in the array, I only want to change the properties of the instance, but it changes as well, when I write the following code:
<br />
fallingobject fllnobjct;<br />
Random r = new Random();
fllnobjct = objcts[r.Next(4)]; <br />
It's probably because I'm referencing the object in the array and it's my mistake, but when I do the following:
fallingobject fllnobjct;<br />
Random r = new Random();<br />
int rndm = r.Next(4);<br />
fllnobjct= new fallingobject (objcts[rndm].coordinates,objcts[rndm].colour);
it happens to me when I write the code above, I'm creating a new instance with properties of the array element as parameters so the array element shouldn get affected by the changes in the instance but same thing happens again..
how should I define the instance so that it doesn't change its mother class?
|
|
|
|
|
This is an issue with the copy constructor in the fallingobject class. Try making fallingobject a struct, if you can. Otherwise, impliment and use the clone method to make a copy of the object.
fllnobject . objcts[r.Next(4)].Clone();
Christian Graus - Microsoft MVP - C++
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
It shouldn't happen when you are creating a new instance and using the existing instance's properties in the constructor call.
Create a constructor in fallingobject that accepts a parameter of type Fallingobject
public fallingobject(fallingobject existingInstance){ }
and in there copy the properties from the old instance to the other.
You should maybe look into the ICloneable interface?
Edit: You did it again Christian!
Dave
|
|
|
|
|
Hi,
the way you go about this seems wrong to me. You have four different kinds of objects,
so there should be four classes, probably all deriving from one common class, say:
class Shape { ... }
class Rect : Shape { ... }
class ZShape : Shape { ... }
class LShape : Shape { ... }
class LongShape : Shape { ... }
Now put common methods in Shape, and specific ones in the specific classes; then
create a new shape whenever you need one by instantiating the right class.
In this way, you never need to copy or clone an existing object.
Luc Pattyn [Forum Guidelines] [My Articles]
This month's tips:
- before you ask a question here, search CodeProject, then Google;
- the quality and detail of your question reflects on the effectiveness of the help you are likely to get;
- use PRE tags to preserve formatting when showing multi-line code snippets.
|
|
|
|
|
Im trying to access a listbox control located on my main form inside an AsyncCallback method and getting cross thread errors as AsyncCallback is on a seperate thread. I decided then to create a new delagate and fire an event from within the AsyncCallback method thinking this would solve the problem but that too was executed on a seperate thread.
How can i fire an event from inside the method that runs on the main thread?
thankyou.
|
|
|
|
|
Hi,
as always, GUI components need to be handled by the GUI thread; COntrol.InvokeRequired,
and Control.Invoke() take care of that. There are plenty of examples everywhere.
Luc Pattyn [Forum Guidelines] [My Articles]
This month's tips:
- before you ask a question here, search CodeProject, then Google;
- the quality and detail of your question reflects on the effectiveness of the help you are likely to get;
- use PRE tags to preserve formatting when showing multi-line code snippets.
|
|
|
|
|
Yes
exactlly.
use the any control.invoke() for that.
Cheers
RRave
MCTS,MCPD
|
|
|
|
|
I have about 200+ songs in my library but they're only sorted by artist. I want to have it sorted by Artist then by Album. I googled and I can't find anything on how to get special attributes of a file like mp3's. Does anyone know how I would do this is C#?
Thanks.
|
|
|
|