|
Hi,
I have an mdi program.for this program I must use splitContainer so when I want to show child form it doesn’t appear however child form was created. So for solving this problem I added child form to the splitContainer panel. My code is like this:
<br />
Form1 frm=new Form1();<br />
frm.MdiParent=this;<br />
splitContainer.Panel1.Controls.add(frm);<br />
frm.show();<br />
Now my child form was shown but when it gets focuses its titlebar was inactive yet. I mean it gets focuses but the child form titlebar doesn’t change to be active.So user who will work with this program doesnt know if it gets fouses or not.
What is my wrong for this happening?!
Does it another way to show child form when we have splitContainer in mdi Programs?
|
|
|
|
|
You're using two things that cannot work together. You're treating the child form as both and MDI child and as a Control. You only do one, not both.
If you're going to put this form into a Panel control, you have to treat it as a Control and not a form that has no parent (or the parent is the Desktop window.) You cannot have it as an MDI Child. But, in order to treat it as a Control, you have to tell the form that it is no longer a top-level form.
Form1 frm = new Form1();
frm.TopLevel = false;
splitContainer.Panel1.Controls.Add(frm);
|
|
|
|
|
Hi
Tell me what should be the best format for recording as well as transmission of video over LAN.As in my application case vidoe format is .avi but for transmission it is 2much heavy.
Try to Reply ASAP
Regards,
Shanzay
|
|
|
|
|
DeepOceans wrote: .avi but for transmission it is 2much heavy.
It's not really that bad, unless someone has dial-up. Maybe do something with breaking the .avi into smaller chunks and stream it.
"Try asking what you want to know, rather than asking a question whose answer you know." - Christian Graus
|
|
|
|
|
Hi all,
Can anyone give a tip on how to construct this array, or something with the same effect?
Each row in the array will have two columns containing string values, and a third column which is an array of strings. Each row might have different numbers of values in the third column's array.
Thanks,
Jason
-- modified at 5:04 Tuesday 25th September, 2007
|
|
|
|
|
Well, you could create your array with [n][3] dimensions. However, a better bet would be to create a class which encapsulates the items in your list, and then wrap it up with a generic list. Modified in response to your changed requirements:
public class MyClass
{
private string _field1;
private string _field2;
private List<string> _field3 = new List<string>();
public string Field1
{
get { return _field1; }
set { _field1 = value; }
}
public string Field2
{
get { return _field2; }
set { _field2 = value; }
}
public List<string> Field3
{
get { return _field3; }
set { _field3 = value; }
}
}
... private List<MyClass> list = new List<MyClass>();
public void Add(MyClass item)
{
list.Add(item);
}
-- modified at 7:20 Tuesday 25th September, 2007
Deja View - the feeling that you've seen this post before.
|
|
|
|
|
I like to do a function in my Form that do a “print screen” on the whole form and saves it to a jpg-file.
_____________________________
...and justice for all
APe
|
|
|
|
|
|
You may take picture of whole form using DrawToBitmap function of Form and put it in a Bitmap object. After this you save it using save method of Bitmap object.
Following is a code snippet showing this-
------------------------Start Code----------------
Bitmap bmp1 = new Bitmap(this.ClientRectangle.Width, this.ClientRectangle.Height);
this.DrawToBitmap(bmp1, this.ClientRectangle);
bmp1.Save("C:\\FormImage.jpg");
-------------End Code-----------------------------
I hope this helps .
-Dave.
Dave Traister,
ComponentOne LLC.
www.componentone.com
|
|
|
|
|
Hmmmm... I only get a printscreen of the form itself. Not its subforms...
_____________________________
...and justice for all
APe
|
|
|
|
|
Yes because in the previous code DrawToBitmap function of a particular Form was used, this will return image of only one form.
However if you have multiple Forms on screen and you want to take image of whole screen, you may try following code which uses CopyFromScreen function and it will return image of every thing which is on screen –
int wth, ht; //modify width and height as per need
wth= 1000;
ht= 900;
Bitmap bmp2=new Bitmap(wth,ht);
Graphics grp = Graphics.FromImage(bmp2);
Point x1=new Point();
Point x2=new Point ();
x1.X=0;
x1.Y=0;
x2.X=0;
x2.Y=0;
Size sz = new Size(wth, ht);
grp.CopyFromScreen(x1,x2,sz, CopyPixelOperation.SourceCopy);
This should give you what you want. Let me know the result .
-Dave.
Dave Traister,
ComponentOne LLC.
www.componentone.com
|
|
|
|
|
Result:
_____________________________
...and justice for all
APe
|
|
|
|
|
|
|
Martin# wrote: Hope it helps!
Yes it did.
Thanks a bunch.
-- modified at 5:35 Tuesday 25th September, 2007
Best Regards,
Mushq
Mushtaque Ahmed Nizamani
Software Engineer
Ultimus Pakistan
|
|
|
|
|
Hi all,
I have a class which inherit from System.WindowsForm.UserControl and an interface (with a method named Update)
I want to implement the Update method of my interface and not the user control method
is there a way to do that ?
like in C++ void Interface::Update() ?
Thanks in advance
|
|
|
|
|
You can have two update methods.
public void Update()
{
}
public void IMyInterface.Update()
{
}
MyControl control = GetControl();
control.Update();
((IMyInterface)control).Update();
The version called depends on what you have a reference to. If you have a reference to the class or one of its bases then the Update() method will be called, if you have a reference to the interface the IMyInterface.Update() will be called.
|
|
|
|
|
Hi
void DoThis()
{
try
{
DangerousCall();
}
catch( MyExpectedException e )
{
}
catch ( Exception e1 )
{
}
}
You can replace the catch all catch ( Exception e1 ) with a parameterless catch catch { ... } .
...snip...
catch( MyExpectedException e )
{
}
catch
{
}
Why? What does this give you? Can you get any exception info?
I've done a test and you can't use catch (Exception e) with catch { } as the compiler knows that is already a catch all in there. Confused .
"More functions should disregard input values and just return 12. It would make life easier." - comment posted on WTF
"This time yesterday, I still had 24 hours to meet the deadline I've just missed today."
|
|
|
|
|
No. The error is caught, but you can't get any detail about it. It has the effect of suppressing the error.
All exceptions derive from System.Exception, so catch {Exception e} will catch all exceptions regardless of type. You should only use catch {} if you deliberately want to suppress an exception if it is raised.
Paul
|
|
|
|
|
Thanks. So it effectively replaces Catch(Exception e) but gives you less information.
Why would you want to not know what caused a problem?
I understand why you want to swallow exceptions, not rethrow them, etc, I do it when interfacing to an external system which is up and down like a yo-yo, but I like to at least look at the exception to see why if failed, and then optionally log it.
"More functions should disregard input values and just return 12. It would make life easier." - comment posted on WTF
"This time yesterday, I still had 24 hours to meet the deadline I've just missed today."
|
|
|
|
|
Malcolm Smart wrote: Why would you want to not know what caused a problem?
Generally it is laziness. It is part of the anti-pattern known as try-catch-ignore.
However, there are "good" uses for it. And I put "good" in quotes because it stretches my incredulity a bit.
You could have used it in .NET 1.x before they had things like TryParse on DateTime and int to check if the parse operation completed successfully. You were probably not interested in why it went wrong, just that it did. TryParse just returns a boolean to say if the parsing failed or not.
|
|
|
|
|
Malcolm Smart wrote: Why would you want to not know what caused a problem?
I'm not saying that it is good practice to use it, only that the language supports it.
Paul
|
|
|
|
|
That depends on if you are using framework 1 or 2.
In framework 1, the difference is that catch(Exception) catches .NET exception, while a parameterless catch catches all exceptions.
In managed code you can only throw exceptions that derive from System.Exception , but if you call unmanaged code it may throw any object as an exception.
If you need to handle all exceptions in framework 1, you should use both a catch(Exception) and a parameterless catch , so that you get all available information.
In framework 2, anything thrown that doesn't derive from System.Exception is wrapped inside a System.Runtime.CompilerServices.RuntimeWrappedException object, so there is no longer any use for a parameterless catch . To specifically catch unmanaged exceptions you use catch(RuntimeWrappedException) , otherwise you can just use catch(Exception) to catch them too.
---
single minded; short sighted; long gone;
|
|
|
|
|
Good explanation. I think that's the clearest one I've seen in a while.
|
|
|
|
|
Thanks.
---
single minded; short sighted; long gone;
|
|
|
|