I have created a window in C# by win api. And made it as child to another window. This parent window is an external program and I don't know its source code.
When i move my window inside parent window some parent's elements draw itself on my window.
For, better understanding i've made some screens.
This is before I move my window. My window is gray.
And this one is after moving my window over the "SeatOpen" button.
I have no idea how parent window can draw on my window.
So, why this is happening and how to fix?
The parent window is not drawing on your window... you are failing to draw on your window yourself -- your window is not responding to WM_PAINT messages for some reason so whatever garbage was on the screen remains there.
Try to redraw your window when location is changed and it is over Seat Open button.
Related
I have a main WPF window. (henceforth, parent window). In this parent window I have a button. When button is clicked I open a custom messagebox window (henceforth, child window) in a position within parent window. When opening child window I pass as an argument the parent window, and another argument to indicate the child window where I want to locate it. Then within child window, according these parameters passed as arguments, I do some calculations based on the Top and Left coordinates of the parent Window.
I have seen that when parent window is maximized, then its Top and Left coordinates are not being updated, they are the same, I mean they keep unchanged keeping last values before parent window is maximized. Why?
As a result of this, when doing some calculations using Parent.Top and Parent.Left from child window, it is making my logic failing.
How can I obtain correct Parent.Top, Parent.Left and others like Parent.Height and Parent.Width from child window logic?
I use Visual Studio 2008 and NET 3.5 SP1.
When I set the main window's visibility to hidden, No icon is shown in taskbar, so I have no control over the window to show it again. I want for the application's icon to be visible even when I hide the window, and to show the window when I click it's button in the taskbar. (something like minimize behavior)
How can I achieve that using WPF and .Net 4.0 in C#?
Edit: I mean the icon in taskbar (usually in the left and middle of the horizontal taskbar) not the notifyicon in system tray.
So, based on "comments" section, what you are looking to do is minimize or hide a window but still show some windows or dialogues that the window opens. First if you want to keep your window in the task bar, you should minimize with:
this.WindowState = WindowState.Minimized
That can be called from anywhere within the form. As you mentioned, though, this will close hide any dialogues that have this window set as the parent. The key, then is to not use this window as the parent. Lets say your dialogues inherit from form. You want to use:
newWindow.Show();
I am guessing that you are calling "ShowDialog", which ties the window state to the parent window state. Try this out and hopefully it will help!
Edit
One more note: the same is actually true of MessageBoxes, but the way to control the parent form is with the first parameter of the MessageBox.Show() call. If you pass in a form as the first parameter, that will be the parent, otherwise the parent will not be set.
I am making a webbrowser and I have to make the tabs draggable. So when you pull out a tab, I delete the tabitem from the tabcontrol and put it in another window, which I create on that very moment, and that's the tab, the window, you drag. Now I have to be able to drop the tab back in so I need to check if the window, the window I am dragging, is over another window where it could be dropped.
So I actually need two things:
1) Is the window over another one?
2) If it is over a window, is it the first window underneath the window youre dragging?
Thanks in advance
This should give you a good starting point Drag and Drop Overview
I have been working on a windows form application based in c# and I am in need of some assistance. I am trying to recreate the window flicker that most windows applications have when a form loses focus to a parent form. Best way I can explain this is open up calculator open the help window and try to click the calculator, the help window then without falling behind the calculator flickers losing and gaining the shadowing around the edges.
I have managed to regain the focus on the child window when the parent is clicked but this creates a odd flickering effect as the parent window is momentarily brought in front of the child window. I am only guessing but that effect I am looking for appears to be that the calculator is never brought in front of the help window and then the help window is simply activated and deactivated a few times.
I tried doing some searches and I have seen a few topics relating to this but none of the solutions quite match. I am fairly new to making windows form applications so there are still a things I don't understand so be patient with me if I don't understand something at first.
Thank you in advance
An elaboration on the calculator example:
1) open up calculator from windows accessories
2) in the toolbar go to the help tab and open the about calculator option
3) click on the calculator window
4) the about calculator window will then flicker while never falling behind the calculator
The only progress I have made towards this is
private void MainForm_Activated(object sender, EventArgs e)
{
if (Open == true)
{
//blink active window
_addForm.Activate(); //makes window active
}
}
The open variable is something I use to keep track of if open forms and is made true when I show another form.
In your example the About window is called a modal window. A modal window prevents the user from interacting with the parent window until it is closed. Use Form.ShowDialog instead of Form.Show to present a Form to the user as a modal window.
Make the child form modal. This means that the child must be closed properly before focus can be transferred back to the parent.
I am just trying to create a form control in winform in .net with custom shaped of balloon shape.
There is need of a balloon tooltip which is transparent and I can put buttons on tooltip,but
tooltip in .net does not provide facality that we can put the buttons on tooltip control so
I want to make a form control looks like a balloon tooltip and so I can put buttons on that form looking like a tooltip.But I cannot show window form control look like a balloon tooltip.
So what should I do??
I tried in one way that I create a image in powerpoint of balloon shape and set it to as background image of form property.But there is no solution with that.
The Control class supports a BackColor with an alpha < 255, it is automatic. It asks the Parent to draw itself to produce the background of the control, then draws itself on top of that. However, you'll want a top-level window for a balloon. That's a window type that can arbitrarily overlap another window and isn't confined by the client area of an underlying window. It has no Parent. A ToolTip is such a window.
The only control available in Windows Forms that can be an top-level window is a Form. Problem is: the transparency trick no longer works. Since a top-level window doesn't have a Parent, there isn't any obvious window to ask to draw the background. It could be many windows, belonging to other processes. You can get transparency in a Form with its TransparencyKey property. But that's a "hard" transparency, equivalent to an alpha of 0. You probably want a soft one. Another nasty problem is that drawing anti-aliased (ClearType) text no longer works since there is no reliable background pixel color anymore.
Long story short: you can't make this work well unless you confine the balloon to the client area of a form. A control, not a form.
You can try to hook on the Paint event of the control and draw the Visual of the button there.