How to display ok button at bottom in .net compact framework? - c#

I am developing mobile application in C#. I am using the following code in my application to display the messagebox but the button ok is displayed at the top right corner. I want to display the ok button at the bottom. This is my code
MessageBox.Show("Records successfully inserted","Customer Entry",MessageBoxButtons.OK,MessageBoxIcon.None,MessageBoxDefaultButton.Button1);
Is anything wrong in my code? or should I need to do different things ? Can you please provide me any code or link through which I can resolve the above issue?

It is the standard MessageBox behaviour in the compact framework to display the OK button at the top right corner (unless, I think, you are on a Windows Mobile 6.5.x, in that case it would be displayed at the bottom).
The only way I can see of "moving" that OK button at the bottom would be to create a form and use it instead of the MessageBox. That means creating a kind of custom MessageBox class.

This is quite annoying i agree. Especially when working on small touchscreens where pressing the OK in the top right is difficult.
Since you just want to present the OK button id suggest using MessageBox.OKCancel instead and just treat any button press as OK. Setting anything other than OK will show the buttons at the bottom.
MessageBox.Show("Records successfully inserted","Customer Entry",MessageBoxButtons.OKCancel,MessageBoxIcon.None,MessageBoxDefaultButton.Button1);

Related

Take a screenshot behind window in C# WinForm

I'm working on an app in c# windows forms, I have a form called Form1 with a button, and after click this button the idea is to take a screenshoot of everything behind it except the Form1 itself (without minimizing Form1).
Any idea or suggestion?
Thank you!
If you want a solution without hiding, moving, minimizing etc., you need the following approach:
EnumWindows() to iterate all windows. This will give you the windows top to bottom.
Don't forget to exclude your own window
Exclude windows that are invisible. Check out GetWindowLongPtr with GWL_STYLE and compare against WS_VISIBLE
GetWindowRect() to get their size
PrintWindow() to get a bitmap of the window, no matter whether it's in the background
Create a bitmap with the size of the VirtualScreen
Paint the windows in reverse order (bottom to top) using DrawImage()
I found that this is quite fast (514 ms on a 2560x1440 screen with 20 visible windows to draw).
Limitations:
since it sends a WM_PRINT message to the application, you can not capture applications that are "not responding"
For me, Firefox does not render well. It's missing page contents.
For me, control panel content appears black, although it's there when getting a screenshot of the whole screen.
you can use hard code. Actually light shot and other tools working such as. When you click to screenshot button you may close the form window after the event and reopen it. it is the basic way of solution...
Please check this way: How can i capture the screen without the Form?

Dynamic form with resizing in C# .net

As a learning project in C# .net I am re-creating a Gnome 3 plugin for seeing who of the streamers you follow on Twitch is live. I have the settings form done, I am now working on the interface that is viewed from a click on the taskbar.
This is a rough image of what I want the interface to look like. When two or more streamers are live the interface would add another block and resize the form vertically similar to the menu for selecting a Wifi network in Windows.
What would be the best way for me to complete this?
My current thought is to maybe create a custom control and just place those inside a FlowLayoutPanel with some kind of code to change the vertical size of the form to match the added entries. Maybe this can be done without a custom control and be done with code inside a FlowLayoutPanel? I'm not too sure.
Ideally I would also have a click event in the panel for each streamer so I could then open a browser to their channel. A slight highlight would also be a plus (maybe change the background colour based on mouse hover).
Thanks in advance for any suggestions!

Tile focus display issue

I'm working with a Windows Forms Application (.net/c#)
Using MetroFramework. Home page contains some MetroTiles. I need to focus on first tile when I launch Home page.
I Can do this focus is working fine. but it could show any indication for selected/focused tile at all. I could not find any properties.
In above image back Tile is selected now. but could not identify this as user and when I press 'enter' BACK button functionality is working fine. Same for other tiles also. Please help.
There is no property, but you can use the 'selected' event to change something yourself, like a slightly changed color or drawing a thin line around it.
As far as I know Metro still hasn't a built in a functionality for this case.
So try to use the workaround if possible.

How to create a Work Area during WIn Forms Design

How can i create a work Area in Win Forms?
My Design go like this:
I have a Set of buttons aligned on the right side where each buttons opens up another form to either fetch or submit data to my backend. Now i need that when i click on the button from Form1(Having all the Buttons) then in my work area i should get other Forms.
I tried MDI Container, it solves the issue to some extent but then the problem comes up when the form load initially the container part is fully blank which looks bad from User Experience point of view.
Request you to please guide me or help me on how to proceed with the same.
Regards
Vineet More
Don't use MDI. Even Microsoft on msdn.com 'strongly suggests' not to use it!
Use TDI instead with panels and tab controls.
Have a look at this: https://msdn.microsoft.com/en-us/library/system.windows.forms.tabcontrol.aspx
And this:
http://www.codeproject.com/Articles/269/A-multi-document-tabbed-interface

How to setup feedback link on Windows Forms caption using C#?

I would like to setup Feedback link on every windows form, so that user can send suggestion about design, functionality etc.. using C# (.NET 3.5) but I could not find solution.
Any help or suggestion will be appreciated.
On every form? You could create a "FeedbackLink" UserControl, and place that whereever you like. I wouldn't recommend trying to do it as a clever blanket-thing, because you can never assume the place you want the feedback hyperlink won't be used by something else.
My suggestion would actually be to add it to the "Help" menu on your main form, and possibly in some kind of (very intrusive) pop-up dialog. Maybe do it the way Visual Studio tackles it - by putting an icon in the systray with a bubble that pops up for the user to click on?
Example image (might take a second or two to appear):
Example http://www.freeimagehosting.net/uploads/b7939d58ae.png

Categories