VS 2008 PrintDocument Causes Form To Minimize Or Lose Focus
Jan 16, 2012
I have this rather annoying problem when printing in VB.NET. I use the PrintDocument object and after it has done its job, the form gets minimized to the taskbar. I tried to force the focus on the form but to no avail. I was just wondering if someone else has encountered this problem and maybe has a solution for it?
i have this form, lets call it form1, i dont want the user to be able to click outside the form or let the form lose focus, kind of like when you are setting an options for a program and you click outside of the options settings and the options dialogue box flashes and refocuses your mouse on it and wont let you click anywhere until after you hit ok. i also dont want the user to do a cntrl + alt+ delete and open that options box thing that takes over your screen
I have an about form which I hope it can close by itself if I move the mouse to somewhere else. I try form_lostfocusevent but unfortunately this can NOT be done
i want my form to save to the database every time a control lose focus. can i make it global or do i have to code it for each and every control i have?
Private Sub TextBox10_LostFocus(ByVal sender As Object, ByVal e As System.EventArgs) Handles TextBox10.LostFocus Me.Validate()
I want to detect if a user has alt-tabbed to an other application, so that I can auto pause my application, or let my application blink in the taskbar. Problem is that I can't figure out when someone has alt tabbed to an other application or has clicked an other application.
I want to develop an app which won't allow the user to open or jump to another application while it is open. It should be in Visual Basic. For example, if my application is open (running) and the user tries to open any other windows application like "media player" then it shouldn't open. The app should not even allow "task manager" to run. The application should completely block the windows environment while it is running.
I've got a lose focus textbox which when data in entered and the tab key is hit the code is executed as expected and a message box appears informing the user of the outcome. However when I used a barcode scanner with a tab function embedded, the code is executed and the data is inserted into a database but the textbox to say if the request was successfully completed or not does not show as expected.
I have a problem with the printpreviewcontrol under windows 7.It only occures under windows 7 not xp.I start a new form with the PrintPreviewContol on it and a PrintDocument.In this case, everything goes perfect.But when i add the PrintDocument to the PrintPreviewControl it goes wrong (PrintPreviewControl1.Document = PrintDocument1)
I have two forms in an application. One is he background and then I show another keypad form called with the show() method (not showDialog) because I need to perform some validations on btn click.
The kepad has 10 buttons and an Enter Button. The problem is that the form keeps loosing focus (I checked this with a messagebox which keeps poping up once for focus=true and again for focus=false, it continuously keeps losing and gaining focus) so it does not process any keypress events untill i click somewhere on the form. I tried using me.focus() in form load event but to no avail. The forms TopMost property is also set to true.
i am working on a System. But everytime i show another Form, or Focus Something Else, One Particular Form gains Focus on it's own right after. Does anyone know how i can Fix this?
form1 (startup) has buttons which show form2 and form3. when I press the button to show from2, form3 or form4 and set focus to a txtbox in form2, it does that, but after 2 to 5 seconds focus jumps back to form1 without my doing anything. This happens only on starting the program - if I click on form2 where I want to be, everything does OK from then on, but I don't want the user to have to do that. There is no timer on any of the forms. forms 1, 2, and 3 stay visible at the same time per design, but the focus always reverts to form1. I have tried many combinations of showing form2 and form3 (and form4), but with no change. I have also changed properties of the forms which I think may have something to do with the problem - no luck.I can't find anything in the help file which addresses "form focus changing". [code]
I have my form set up to be able to be kept on top if the user so chooses. When it is set to be kept on top, I want the opacity to be reduced when the form loses focus. When I set opacity on init, it works fine. When I use this code, it doesn't work:
Private Sub Form1_LostFocus(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Me.LostFocus Me.Opacity = 0.2 End Sub
[code]....
Maybe I misunderstand how LostFocus and GotFocus work, but according to MSDN this appeared to be what I wanted.
My problem here is that what the loop does is click on another program, thus taking the focus off of mine, how would i be able to make my app see if I press the key even if the form isn't in focus?
when i try to minimize a form and restore to normal the form is being resize.It's resize getting extending a form when time to minimizing a form and restore it.my form is set to formborderstyle is fixedsingle and i'm using namespace. why is hapening like that...i don't know why
how to minimize child form inside of parent mdi form in vb.net? I change the property of "IsMdiContainer" to "True". but when i minimize parent mdi form, it is not minimize the child form.
Q1: How can i make it so that my window that i want to show as a drop down does not appear to take the focus off the main form that is calling it?
Q2: The form that is dropping down has the FormBorderStyle Property set to None - thus the window does not have a drop down shadow - how can I make the popup window have a shadow?
I am printing my form by using the printdocument of VS and the printform found in powerpacks. I never got the preview to work so when ever I want to print I send my information on a new form (form1) which I have altered ( colour borders ) so it is printable. To print form1 I have added a toolstrip with a print button so when the user sees all is ok on the form1 he clicks on it which hides the toolstrip and prints form1. All this sequence works fine. The problem I have been getting lately is that I can print on the first try but when I call another form to print the toolstrip ( with the print button ) is always hidden. I have to exit the application and re enter to get it to show up. Any solution to this or even how to print in a better way. (have the preview to work for example ). I have tried to use printdialog to print but I have never been able to send the document to print.
I created an app that allows the user to look up pricing and search for items, to help speed up dealing with customer asking for pricing and what not. The form stays atop all windows at the top of the desktop, and is setup, currently, to shrink down (or up in this case) by double clicking on the title bar; I've disabled the minimize and maximize buttons.
How it is setup now is okay, but not as sleek as I want it to be. Is there any way to minimize the form to just the caption bar, like what happens with a command window; it minimizes to the a title bar above the start menu, but I want it to minimize to the top of the screen, almost blending into the title bar of the other open windows. Right now, the form is out of the clients way when minimized, or shrunk up, but it looks kind of lame, with a thin strip of the gray part the form still showing.
I want to use the added functionality (for word wrap etc) of the TextRenderer.DrawText method.... but this does not seem to work correctly on the Graphics object in the PrintPage event in the PrintDocument Object and does not take into consideration any transformations that have been applied. Does anyone have a replacement way or workaround for this?
I am drawing graphics on the screen and when the form resizes it needs to clear and redraw all the graphics b/c the form is a different size and the graphics are supposed to scale with the size of the form. Well that works, but not for maximize or restore. So I had to look on the internet for how to capture the maximize and restore event. I got it from here and it does capture it, but it does all the events (such as redrawing the graphics) first and then it maximizes, which totally defeats the purpose. I tried to do Application. DoEvents but it still doesn't do it. Any way to have the graphics redraw AFTER it maximizes?
Code: Private Const SC_RESTORE As Int32 = &HF120 'When a Form is Restored Private Const SC_MINIMIZE As System.Int32 = &HF020& 'When a Form is Minimized Private Const SC_MAXIMIZE As System.Int32 = &HF030& 'When a Form is Maximized Private Const WM_SYSCOMMAND As System.Int32 = &H112 'Minimized/Maximized/Restore comes when we have this msg Const WM_NCLBUTTONDBLCLK As Int32 = &HA3 'When User Clicks on the Title Bar Protected Overrides Sub WndProc(ByRef m As Message) [Code] .....
i made a border-less form. I minimize it by clicking on a picture-box.
Private Sub picminimize_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles picminimize.Click Me.WindowState = FormWindowState.Minimized End Sub
If my form was not borderless then i could minimize and restore it by clicking on taskbar icon.... But since i made it borderless it doesnot get minimize on doing so... How do i enable it. Such that when user clicks the icon of my program on taskbar it gets minimized..