|
Yeah, it's kind of cool, but I've run into a couple of apps over the years that didn't like it when you did this. Rendering got all screwed up in those apps. Never did find a work around for it.
|
|
|
|
|
something on your sample isn't working for me in 2k8. The SetParent call causes notepad to disappear but it's not showing up embedded in the panel either.
Today's lesson is brought to you by the word "niggardly". Remember kids, don't attribute to racism what can be explained by Scandinavian language roots.
-- Robert Royall
|
|
|
|
|
Well, I can tell you it works on 2000 and XP. I haven't had cause to use it on Vista or 2008.
|
|
|
|
|
*sigh*
I'm running in XP. Did you do anything other than adding the 2 using directives, dragging the button and panel onto the form and wiring up the event and dllimport?
Today's lesson is brought to you by the word "niggardly". Remember kids, don't attribute to racism what can be explained by Scandinavian language roots.
-- Robert Royall
|
|
|
|
|
Nope. That's all I did.
OK. This is weird. It works on my home dev machine, but not on my work laptop. I think it might be because of a patch that was installed. My dev machine is about 6 months behind in patches .
|
|
|
|
|
It was invisible on my (Vista) system briefly until I made the panel a reasonable size - then it suddenly appeared.
DaveBTW, in software, hope and pray is not a viable strategy. (Luc Pattyn)Visual Basic is not used by normal people so we're not covering it here. (Uncyclopedia)
|
|
|
|
|
didn't help on my XP system even with the app sized to 1600x1200 I've got whatever the MSDN standard version was as of mid summer.
Today's lesson is brought to you by the word "niggardly". Remember kids, don't attribute to racism what can be explained by Scandinavian language roots.
-- Robert Royall
|
|
|
|
|
I just tried it on my XP machine and it didn't show. The problem was Notepad remembers it's last size and location and it assumes that relative to the hwnd's top left.
Using SetWindowPos sorts it. This will make it the same size as the panel and at point 0,0.
private void button1_Click(object sender, EventArgs e)
{
Process p = Process.Start("Notepad.exe");
p.WaitForInputIdle();
SetParent(p.MainWindowHandle, panel1.Handle);
SetWindowPos(
p.MainWindowHandle,
IntPtr.Zero,
0, 0,
panel1.Width, panel1.Height,
0u);
}
[DllImport("user32.dll", EntryPoint = "SetParent", SetLastError = true)]
private static extern IntPtr SetParent(IntPtr hwndChild, IntPtr hwndParent);
[DllImport("user32.dll")]
private static extern bool SetWindowPos(
IntPtr hWnd,
IntPtr hWndInsertAfter,
int X, int Y,
int cx, int cy,
uint uFlags);
DaveBTW, in software, hope and pray is not a viable strategy. (Luc Pattyn)Visual Basic is not used by normal people so we're not covering it here. (Uncyclopedia)
|
|
|
|
|
DaveyM69 wrote: The problem was Notepad remembers it's last size and location and it assumes that relative to the hwnd's top left.
Mine too. Test app was loading on the left monitor, notepad on the right before being captured.
Today's lesson is brought to you by the word "niggardly". Remember kids, don't attribute to racism what can be explained by Scandinavian language roots.
-- Robert Royall
|
|
|
|
|
Try SetWindowPos a coule of replies down here[^].
DaveBTW, in software, hope and pray is not a viable strategy. (Luc Pattyn)Visual Basic is not used by normal people so we're not covering it here. (Uncyclopedia)
|
|
|
|
|
Here is a sample application that shows how to host other windows: Window Tabifier[^]
|
|
|
|
|
thanks guys, but since the videowindow cant be hosted/tabbed, and has to be fullscreen, ive sort of given up
But thanks anyway
|
|
|
|
|
I have edited project options Build-> "Conditional compilation symbols" /define:CLASSTEST
In my main function i have>>
namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
#if (CLASSTEST)
Console.WriteLine("works");
#else
Console.WriteLine("not defined");
#endif
I have tried project build, rebuild solution etc and the #if section is not recognized in IDE code completion does not evaluate statement
build configuration also has debug
Any ideas on what is going on?
|
|
|
|
|
remove the /Define:
Need software developed? Offering C# development all over the United States, ERL GLOBAL, Inc is the only call you will have to make.
Happiness in intelligent people is the rarest thing I know. -- Ernest Hemingway
Most of this sig is for Google, not ego.
|
|
|
|
|
How can I add a button when run time? and if there is a button in the form, how can it added next to it? Could you help me,please?
Thanks in advance.
|
|
|
|
|
drago123 wrote: How can I add a button when run time?
You just create the button and add it to the forms Controls collection.
Button b = new Button();
this.Controls.Add(b);
drago123 wrote: and if there is a button in the form, how can it added next to it? Could you help me,please?
You need to work out the position of the existing button, and position your new button alongside it.
int left = existingButton.Left;
left += existingButton.Width;
left += 20;
int top = existingButton.Top;
Button newButton = new Button();
newButton.Left = left;
newButton.Top = top;
this.Controls.Add(newButton); That help?
Simon
|
|
|
|
|
|
Hi,
I have a grid, that has a column of checkboxes. I also have a button outside the grid, that if clicked should toggle the grid view to show only the rows that have checkboxes checked.
What whould be the best way to achieve that?
Set the grid's datasource to a dataview with the filter set?
Any code samples will be really appreciated.
Thank you very much.
|
|
|
|
|
The easiest way is to assign a name attribute to all of the check boxes in the grid that is the same. You can then get a collection returned in javascript and do the assignment without a postback.
Need software developed? Offering C# development all over the United States, ERL GLOBAL, Inc is the only call you will have to make.
Happiness in intelligent people is the rarest thing I know. -- Ernest Hemingway
Most of this sig is for Google, not ego.
|
|
|
|
|
Sorry,
I am talking about a Windows forms grid.
|
|
|
|
|
On the checkbox click event assign the underlying datasource to have the value alternated and then Rebind or Refresh the datagrid.
Need software developed? Offering C# development all over the United States, ERL GLOBAL, Inc is the only call you will have to make.
Happiness in intelligent people is the rarest thing I know. -- Ernest Hemingway
Most of this sig is for Google, not ego.
|
|
|
|
|
I want to know how can I send a text file through a phone line to another computer just like pcAnyWhere?
|
|
|
|
|
modem
Need software developed? Offering C# development all over the United States, ERL GLOBAL, Inc is the only call you will have to make.
Happiness in intelligent people is the rarest thing I know. -- Ernest Hemingway
Most of this sig is for Google, not ego.
|
|
|
|
|
You need a FoneFileFunnel (tm).
"Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997 ----- "...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001
|
|
|
|
|
what is that?
and how to do it in c#?
any examples?
|
|
|
|