C# Winform How to Pin/UnPin WebBrowser control - c#

I have a web browser control embedded in a tabPage in my application. How do I drag it out of my desktop app, that is an option to dock/undock or unpin it.
Edit: After reading a bit, I think I should do this with DragDrop events. I saw several examples to drag and drop within an application or between applications, but I am wondering if it is possible to drag the control outside my application to another screen. Should I record the screen coordinates to do this?
Edit: So far I have tried to capture MouseUp/MouseDown events with a simple button control but that only helps with moving the control within the form.
When I was reading DragDrop documentation in MSDN, it says 'AllowDrop' needs to be set to the target. But my target is not limited to a form it can also be a desktop screen. It makes me think I am totally on the wrong route. I am not pasting any code because I believe I am looking for an approach or some suggestion to do this. I am a novice so if this is not clear, please ask me further questions.
Hoping to hear from someone.
Thanks!

If anyone is interested, this codeproject link helped me get started:
http://www.codeproject.com/Articles/15418/PullApartTabPage-Docking-and-Undocking-Your-TabPag

Related

How can I set focus to explorer in C# WindowsApiCodepack, when used in WPF via WindowsFormsHost

i´m writing a small C# Wpf application and I integrated the ExplorerBrowser of the WindowsApiCodepack.
This is working really nice.
The only problem I have and where I haven´t found a solution so far is:
How can I programatically set the focus (keyboard focus) to the ExplorerBrowser control, so that I can select a folder without clicking on it with the mouse before?
Does someone have exerience with the control?
Additional Note:
What I found out so far is, that focus problems are a common problem for winform controls, which are inserted into a wpf window via the WindowsFormsHost class.
But i haven´t found a good workaround so far.
I don't have a clue about the WindowsApiCodepack, but I think u just have to call the ".Focus()" function of the control.

How to have windows forms control catch drag enter instead of embedded WPF canvas

This is a pretty basic setup. I have a System.Windows.Forms Panel that holds an ElementHost control that holds a System.Windows.Controls Canvas. The user begins a drag operation and the drag enter event is fired from the Canvas control, but what I really want is for the canvas to ignore the drag enter and for the event to be caught by the parent System.Windows.Forms.Panel that holds the canvas. How can I do this?
The simple answer to this, is that you cannot do that. If you mix Win32, WPF, or DirectX technologies on top of each other, then the one on top takes precedence and it is a black hole to the other technologies. The limitation you are experiencing is called Airspace and if you search around you will find many articles discussing airspace restrictions and mixing WPF/Winforms/DirectX content. Please see the following link:
Technology Regions Overview
There may be methods that would help to provide a workaround for what you are trying to accomplish. For example, handling the input in WPF and then passing it explicitly back to your program in some other manner. Some quick googling shows:
Mitigating Airspace Issues
WPF and Win32 Interoption

Create a popover-like control in C# WinForms?

So, one of my favorite things about iOS/ObjC in general is the "popover" control.
I am building an app in C# WinForms that would benefit greatly from this type of control- anyone have any ideas on how I might be able to emulate this type of look?
For reference, here's an example screenshot of what I'm talking about http://i.imgur.com/IzbbzrA.png
Thanks for any ideas!
You can create a simple popup control by following the articles linked below
Simple Popup Control
I don't think such a control exists in .Net. What I would do from this point if I were you is try to making one using a customized windows form on top of it. Play with the Mouse Hover events of the control and make the form appear for a short time. Make it without borders. With a little imagination you can have your own version of the PopOver.

How to place a control over the task bar in windows using c#

i googled a lot and found out some info about the band object from which we can make the ad-in for the task bar, can i get some more tutorials from scratch & some sample programmes.
is there any other alternative way is there to place a control over the windows task bar apart from band objects?
Thanks in advance
If you want to place a textbox in the taskbar like the Google Desktop search bar, then you're not actually trying to place the control over the taskbar, you want to place it within the taskbar.
The proper solution here is a Desk Band. You can find an MSDN article explaining those here. I'm not really sure why you say that you want to avoid band objects. That's the right way to do this.
There's even a sample implementation in C# available on Code Project: Extending Explorer with Band Objects using .NET and Windows Forms
To make a window overlap the Taskbar you can set it's TopMost property to true. But then you will have to control the positioning yourself, and it will also overlap anything else beneath it, but it is a solution at least :)

tooltip appearing behind the form/window! (C# / VS 2008)

For some strange reason, my toopltip in the VS 2008 C# winforms application shows up behind the form! It's very frustrating and I can't figure out what I should do. Anyone face this before? Ideas?
(PS - I'm doing a toolstip.show programmatically within the form)
There are a few things you might want to check:
Make sure the tooltip knows what its parent window is.
Make sure the window the tooltip belongs to is in the foreground (no, this isn't a requirement for displaying tooltips, it just helps debug.)
Try giving focus to the owner of the tooltip. If that fixes the problem, then there's probably an ownership problem with your tooltip.
Try bringing your page element to the front. (Right click on element, bring to front). Is this happening on all tool tips you have configured? And no, I have not seen this before
There is a similar (and known) problem with tooltips appearing behind the Windows task bar. The problem is sporadic and I have never seen a solution. If you're also seeing this behavior sporadically (and I suggest that you try this on different machines), then it may be related. Otherwise, if the problem is consistent across multiple machines, let's see your code, because you're probably doing something wrong.
I have a similar issue. I have a user control written as C++ WTL, being used in a C# .NET2 app. If the control is just on the form then the controls tooltips work fine, however if the user control is on a panel or in a group then the tooltip is behind. I've tried changing the WTL code to force the tip to the front, this works but causes issues with lost focus/selection in other controls.
This problem is almost always caused by the window being TopMost. Try using SetWindowPos to set your tooltip to HWND_TOPMOST. I haven't tried this though...
I've seen this issue happen in both Windows.Forms and Delphi (native windows) based applications, caused by the interaction of "stay on top" with the Windows API.
Essentially, marking a form as TopMost makes it stay on top of some windows, but not others - Window management has more than two distinct levels.
What I found is this: my applications would behave themselves when run normally, with tooltips showing on top. Problems would occur when switching to- and from- other applications - somehow the "TopMost" of the windoww would become "very-ultra-top-most" (non-technical term ;-) ) with the tooltips appearing behind the window.
Having described the problem, I'd like to offer you a solution - but I never did find a good one. Sigh.
Hope that the additional information will be enough for you to find the solution you need.
I have seen this happen on Windows XP, particularly on the taskbar.
Are you sure it's an issue with your application, rather than the OS?

Categories