|
I have a MDI container, inside of it I have a child form that is maximized. If I have a second form created and displayed by the first form that is maximized (with its MdiParent property set properly) the second form will also be maximized. Is there anyway to override this behavior? I know I can use ShowDialog, but I don't want it to be a dialog I want it to be a normal, nonmaximized window. The property on the form is set to Normal and I event do a WindowState = FormWindowState.Normal in the constructor, but it still comes as maximized.
Any suggestions?
|
|
|
|
|
eggsovereasy wrote: Is there anyway to override this behavior?
No. All the MDI child forms are treated the same. If one is maximized, they all are. If one is "normal", they all are.
|
|
|
|
|
Disappointing
Thank you for the reply though, I guess I will try and make something work with ShowDialog().
|
|
|
|
|
My scenario is:
Based on Remoting concept, Server is listening to client on particular port using TCPChannel. Suddenly Server (Listner) went off, which client does not have information. When client sends a message, error is thrown saying "No connection could be made because the target machine actively refused it".
Is there any way to re-establish client - server connection?
Here Server is using randomly selected ports, so we can't hardcode port at client.
Client is getting information of port from configuration file created at user's local directory.
Thanks
|
|
|
|
|
From my experience, you only get the exception if you try to call a remote method while the server is down. As soon as the remoting server is running again, all remoting method calls work as if the server was there all the time.
If you say that the server is using randomly selected ports, how do your clients connect to the remoting server?
You have to give a URI for the remoting server object and part of it is the port, so how can this be "randomly selected"?
Regards,
mav
--
Black holes are the places where God divided by 0...
|
|
|
|
|
hello everybody,
I have set some text as labels used in windows app, then I have set the Cursor one bye one for their respective input. Now I want to set fixed width for their fixed input size, as user cannot enter more text as much allow for that. I want also to change the BackGroundColor for their fixed input area.
Please help me.
Thank You
Dipak
|
|
|
|
|
Just use Console.ReadKey in a while loop, and keep track of how many keys they have entered (or keep track of the cursor position). The code would be similar to the following:
ConsoleKeyInfo cki;
string str = string.Empty;
do {
cki = Console.ReadKey(true);
switch (cki.Key) {
case ConsoleKey.LeftArrow:
--Console.CursorLeft;
break;
case ConsoleKey.RightArrow:
++Console.CursorLeft;
break;
case ConsoleKey.UpArrow:
goto case ConsoleKey.Home;
case ConsoleKey.DownArrow:
goto case ConsoleKey.End;
case ConsoleKey.Home:
Console.CursorLeft = 0;
break;
case ConsoleKey.End:
Console.CursorLeft = 20;
break;
default:
if (IsPrintable(cki.Key)) {
str.PadRight(Console.CursorLeft - str.Length + 1, ' ');
str[Console.CursorLeft] = cki.KeyChar;
Console.Write(cki.KeyChar);
}
break;
}
if (Console.CursorLeft > 20)
--Console.CursorLeft;
} while (cki.Key != ConsoleKey.Enter); Hope this helps,
Sounds like somebody's got a case of the Mondays
-Jeff
|
|
|
|
|
fellas been developing a c# battleship game and have did go enuf so far
quick question, when i shot at the grid i write back the coordinates such as 1-1, but this is trying to compare it will the coordinates of the sub(for example) which is 1-1,2-1, but i tseems to trying to compare againest the entire coordinates how would i extract the 1-1 or the 2-1??
the cooridnates can go past 10 meaning it cant be a set number
any help please?
thanks
|
|
|
|
|
Take Chris's advice from your previous post... make a 2-dimensional array of type bool, then just check to see if that bool is true to see if there is a ship at that location. If you are dead set on doing it with strings, then you should use the string.Split(',') method, then see if the resulting collection contains the string 1-1. Conversely, you could use the string.Contains("1-1") method as well (I think the second is a method, but I am not certain). Hope this helps,
Sounds like somebody's got a case of the Mondays
-Jeff
|
|
|
|
|
Hello, This is the sample code i have prepired for you now.
public void fnCutText()
{ //Code By Dipak (dipak.dipak@gmail.com)
String strMyString = "abcd,efgh,ijkl,mnop,qrst";
String strTemp = "";
String[] strStrings = new String[100]; int i;
for (i = 0; strMyString.Length > 0; i++)
{
if (strMyString.Contains(","))
{
strTemp = strMyString.Substring(0, strMyString.IndexOf(","));
strStrings[i] = strTemp;
strMyString = strMyString.Substring(strMyString.IndexOf(",") + 1);
}
else
{
strStrings[i] = strMyString;
strMyString = "";
}
}
}
I think u can continue your work.
Best of Luck.
Good Night.
Dipak
|
|
|
|
|
Use string.split(",".tochararray())
|
|
|
|
|
I have this app that sometimes when a user logs in,it will tell the user that the method cannot be called on null values.But when I restart the IIS and still log in with the same name and password,the app will accept.And it will run again for sometime and again it will be giving the same error that method cannot be called on null values.But each time I restart the IIS on the server,the error will disappear.Please do anybody have any clue why this is like this?
|
|
|
|
|
Do you have this working yet?
"Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon
|
|
|
|
|
|
Hi,
I'm really stuck here. I'm using reflection to perform an action of all fields that implement a certain interface in a class.
For normal fields, this works fine, but some of the members are generic Dictionary classes in which the content to perform an action on is in the TValue part. Somehow I need to extract that data from the dictionary.
I've been staring at MSDN pages for a few hours now and trying all sorts of things, help would be very much appreciated.
Here's the piece of code.
private void BindToComdriver(ABaseData target)
{
FieldInfo[] fields = target.GetType().GetFields(System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Public | BindingFlags.Instance | BindingFlags.Static);
foreach (FieldInfo field in fields)
{
Type[] interfaces = field.FieldType.GetInterfaces();
if (t == typeof(ICollection) || t is ICollection)
{
ICollection col = field.GetValue(target) as ICollection;
object[] oma = new object[col.Count];
col.CopyTo(oma, 0);
Type generic_type = field.FieldType.GetGenericTypeDefinition();
foreach (object m in oma)
{
if (generic_type.GetGenericArguments().Length > 1)
{
}
}
}
if(t == typeof(IBindable) || t is IBindable)
{
Bind(field.GetValue(target));
}
}</tkey,>
Standards are great! Everybody should have one!
|
|
|
|
|
foreach(Type var in genericarguments)
{
if(var.GetInterface("name",true) != null)
//do actions...
}
I think, but not sure...
modified on Thursday, December 13, 2007 11:05:18 AM
|
|
|
|
|
Thanks for the reply. Unfortunately that's not working... Any ideas on how to extract the instance value of TValue ?
Standards are great! Everybody should have one!
|
|
|
|
|
I need ideas for scaling down an image. I tried Image.GetThumbnailImage() , I am able to scale it down, but it lost the clarity. So is there any efficient method to scale the image without loosing clarity ?
|
|
|
|
|
Microsoft recommends Image.GetThumbnailImage() only for Targetsizes <= 120x120. (found here[^])
did you try Image myImg = new Bitmap(sourceImage, someWidth, someHeight); ?
i had good results also with Graphics.DrawImage(someImage, someRect); if you only want to draw it somewhere..
greets
m@u
|
|
|
|
|
You may resize an image using DrawImage method of graphics object.
Following is a small code snippet showing this-
--------------------Code Start-------------------
Bitmap SourceImage= (System.Drawing.Bitmap ) Image.FromFile("C:\\img1.jpg");
Bitmap ScaledImage = new Bitmap(50, 50); //you may set size of scaled image here.
Graphics g = Graphics.FromImage(ScaledImage);
g.DrawImage(SourceImage, new Rectangle(0, 0, 50, 50), new Rectangle(0, 0, SourceImage.Width, SourceImage.Height), GraphicsUnit.Pixel);
ScaledImage.Save("C:\\scaledimg.jpg");
-------------------------Code End--------------------
I hope this helps .
-Dave.
Dave Traister,
ComponentOne LLC.
www.componentone.com
|
|
|
|
|
The GetThumbnailImage method uses the embedded thumbnail if there is one, so you can only successfully use it to actually create thumbnails.
For larger miniatures, you have to do the work yourself:
Create a Bitmap object with the size you want, create a Graphics object to draw on the bitmap using the Graphics.FromImage method. Draw the image onto the bitmap using the DrawImage method.
Experience is the sum of all the mistakes you have done.
|
|
|
|
|
|
Hello All
I am trying to catch a right button down event for a control before the form sends it to this control; I tried to do that through overriding the WndProc
But it fails!
Is there any way to do that?
|
|
|
|
|
There is an option in the designer to have the form catch key presses before it sends them to a control, perhaps there is another for mouse events. I'd check myself, but i have to go.
My current favourite word is: Bauble!
-SK Genius
|
|
|
|
|
fellas
i am making a game of battleships and i have server and client talking sending and recieve etc
i can place all my battle ships and get the row and col, problem i cannot think on how to get the coorindates into an array in order to store and get them checked when a player sends a shot
here are the corrindates any help would be greatly appriceated
6-13,7-13,
11-10,12-10,13-10,
11-7,12-7,13-7,14-7,
6-5,7-5,8-5,9-5,10-5,11-5,
thanks
|
|
|
|