I'm maintaining an application that shows a toolTip in certain conditions on a userControl. (When the mouse is over some area a timer starts, when it stops, and the mouse is still there, the toolTip displays a text, by calling "Show(..)".
This works fine.
A different applicatiion is holding this app as an MdiClient. The toolTip now only shows when the application is not active: If the user opens a different application on the computer, "WORD" for example, and then returns to mine without clicking on it, holding the mouse on the right region, then the text is displayed. Otherwise, although the "Show" is called, the "Popup" event is never raised.
Does anyone have an idea about how to solve this?
Thanks, Tali.
If I've understood the problem correctly, I think what you need to do is track when the window (which will show the tooltip) loses and gains focus. So when it loses focus, disable showing tooltips, then enable when it gains focus.
Related
I'm experiencing a strange bug(?) with my uwp app.
I have a page with multiple textboxes for user input that each have the InputScope set to number, which then opens the keyboard in tablet mode as expected. However if you tap on the next box the keyboard closes and a second tap is needed to open the keyboard. This also happens if the user hits tab to switch boxes.
I presume this has something to do with the Focus() event firing before the previous textbox has fired the loss of focus event but im unsure how to override the behavior.
How can i prevent the onscreen keyboard from closing, but also make sure the correct inputscope is still maintained?
Edit: Upon further investigation, the issue seems to be almost random. Sometimes you can move to different boxes and it remains open but other times it closes the keyboard every time.
This issue has been resolved with some others, in Windows 10 version 1803 released on 30th April, 2018.
You can try to play with InputPane that is a container for on-screen keyboard. For example, doing a small delay once the pane is trying to hide, then detect attempts to show the pane again (and cancel pending hide).
myPane = InputPane.GetForCurrentView();
myPane.Showing += myShowingHandler();
myPane.Hiding += myHidingHandler();
At least, you can receive a size of underlying screen region on the pane showing so you can put a placeholder (margin or dummy grid) on your UI to prevent it jumping up and down on keyboard show/hide.
I tried your case on my WP but I cannot reproduce your experience:
When I tap to other TextBox, keyboard stays opened and I can continue typing.
Keyboard hides as expected when I tap somewhere to whitespace.
Don't you have keyboard connected to your device?
INTRODUCTION
Using C# or VB.NET. I'm trying to make a form's background transparent; this form will be overlaped to other window, it will be a top-most window, so the transparent form (and its controls) must have the ability that they must not receive focus and they must can be clicked trough, this means if for example I perform a left-click on the transparent background, then the window on background of that (in the Z-order window) is the window that must receive the click instead.
Notes:
For avoiding the focus I'm overriding the CreateParams property as explained here.
For making my form transparent, I'm calling Win32 DwmExtendFrameIntoClientArea function and also using SharpDX library as explained here. But I think this really doesn't matter with the question itself.
PROBLEM
I'll show a demostration of what I mean using images. Here below is a image of a form (with no transparency, just to simplify understanding) overlapped to a window of a text editor program; note that my form doesn't receive focus. Well, the problem is when I do click on the form's background (or one of its controls) the window on background (the text editor window) still have focus but it can't receive the click.
Here is the same image of above but with a transparent form:
RESEARCH
I'm not really sure about what to investigate, so I'm going blind trying to find something useful in a trial-and-error stage by overriding the Window procedure (WndProc) of the transparent form to test related windows messages, like WM_NCHITEST or WM_MOUSEACTIVATE message as said here:
Windows form with a transparent background that cannot be clicked through
Make a form not focusable in C#
How do I create an "unfocusable" form in C#?
You can do this by sending click (mouse up & mouse down) messages to the window underneath the transparent window using WinAPI.
PostMessageA
You'll need to find the window underneath the point you require.
WindowFromPoint
You'll have to translate the position of the click events accordingly since messages are processed based on relative window position, not absolute screen position.
I actually did this quite successfully to automatically play a facebook game many years ago.
Check the RAD designer in Visual Studio.
Is the label docked to fill?
Where is the main form clickable?
The transparent color is click-though in the main parent, however, components will still retain clicks.
As I am working on screentime, I would like to block the screen after the user's allowed time gets over. My screen will be on the top after allowed time gets over.
In Microsoft family safety screentime even if the user presses windows button, start menu will appear behind the microsoft's blocking screen. I dont know how to do the same. They've not blocked any inputs. Whatever the user does will happen behind the screen.
In my app user cannot switch to another screen. I put window.topmost = true
in both OnLostFocus event and Deactivated event.
Everything is working fine except the start menu case.
What is actually happening when start menu appears, which event is taking place? How can I override it?
Hello,
Above is the program I am writing. On the right panel is basically two custom controls (the blue rectangle area) I created and just added them as controls to the background panel control when this winform program loads.
I used MS paint to draw out the pop up balloon that I want to see when my mouse enter this control's area. I want to do the following:
1. If mouse enter the control area, the yellow area balloon pop up and populate with the information of that specific control
2. If mouse move out of the control area, the pop up balloon disappear.
Can this be done with Winform application? I looked around and found out about Tooltip class but so far from researching I don't know if it does what I want to do.
I could be wrong but googling around gave me the impress that Tooltip offers very little in term of style. Ideally I want to make this pop up balloon into almost like a border-less pop up window where I can put image , font ect.....at will. Also Tooltip works if you hover over a button or specific field whereas I want the entire control area.
Can this be done? I appreciate if you can point me to any work around if there is one.
I wrote a comment, but I figure I'll expand it into a full answer. This is assuming you want a new control, which isn't a tooltip, for maximum customizability. I did something similar to this for work recently, to act as a non-modal info popup that disappears when clicked.
Creating a Custom Popup Form
What you want is essentially a floating popup that appears over your form, which means you'll want to define a new Form object, rather than a UserControl, as it won't actually be embedded within your other form.
Give it a multiline, non-editable textbox that you can fill with the information you want to populate, then simply call a new instance of the form on your Mouse_Enter event. Close it upon Mouse_Leave.
Adjusting The Style
You'll have to play with it a bit to get it to actually act like a popup and not just a window. I'd recommend setting it to a non-modal popup, and removing the border. You can write a function to automatically size it to its contents. I don't imagine you'll want the user manually resizing it.
Some other things to look into would be overriding the CreateParams property that comes with the basic Form object. You can force DropShadows and TopMost forms without making the form modal. Overriding ShowWithoutActivation to always return true will prevent the form from stealing focus when it pops up.
I'm not sure if you can pull off rounded edges like you have in your mockup. Perhaps you can pull it off with some wizardry in the OnPaint() function, but I couldn't tell you how to do it.
It might be a bit of a pain for fiddling around with, but you can get some good functionality and appearance out of it. If you think you can pull it off acceptably with the ToolTip class, go for it. It took me about a week to get my notifications where I wanted them (though I added several features that you probably don't need to worry about).
Examples
Some keywords to look up in related searches would be Toast Notification and Non-Modal Popup. This might be some use:
http://www.codeproject.com/Articles/442983/Android-Style-Toast-Notification-for-NET
Since you already have implemented custom user controls you might want to try it again. Make a control that is that style and color, changes it's size based on it's text. You can feed it information (such as the text to display) from your existing user control object. You can also have the mouse enter/leave code reside in your first user control.
If you're not sure how to make a rectangle with round corners you can either make it on the fly using a graphics object (which will turn into a bitmap on the screen) or make it how you want it to look in GIMP (or photoshop if you have it) then use that image as the background on your user control. Make the default background transparent (so your voids above the round corners are not grey). If you make a pre loaded image you'll need to be aware you will only be able to scale it equally in Y and X directions. unequal scaling will make it look distorted.
Can you use the Mouse_Enter event on the control?
We have a wierd issue here.
We have a win-form application. The application has a tabbed form with few textboxs, combo boxes and 3 bottons. The application runs fine in most machines but in 1 machine the buttons are not visible .
Rest all are working fine. Just the buttons are invisible. But the button is present as Iam able to fire the event using tab and enter.
We have checked the log.but cannot find any exceptions logged.
We have checked various resolution but didnt help.
Any help ?
Buttons are at the bottom of the screen just above the taksbar. Taskbar is visible.
We have checked the dotnet frame work .Its fine
Issue is found in a Vista Machine
Thanks in Advance
My guess would be that the one machine has a different DPI setting. Perhaps it's pushing the buttons more downwards than they're supposed to be and that causes the buttons to disappear beneath the border of the form?
Also, I'd check the buttons' Anchor property to see where they're anchored to and that they're not moved around by weird window size to behind something else.
It could be that the buttons are not included in a tab which is on top of the buttons. Try making tabs (or various other controls) invisible to make sure the buttons not being obscured.
Setting the WrapContents to false on the FlowLayouPanel we were using, fixed a very similar issue.
The Buttons were near the bottom edge of the dialog box and would disappear in certain monitors resolutions. I think the WrapContents=false clips the buttons than completely removing them.
In my case I had login Panel where the height of it was depending on Main Form size, For example the height was Form size * 0.1.
The fix was to make the Login Panel resize its size depending on its components by setting loginPanel.AutoSize = true;