c#


how to open a new window on middle of the parent window in c#


In C# windows desktop application I need to make a popup login window like this Popup login window.
When i tried this I failed to make like this login window.If I make a window like this,The popup window open different time different location.
I need the child (mean the login window)open on the top of the parent window, and this window must be unmovable and in the mean time the parent window inaccessible until i close the child window.
Try this code
<Grid x:Name="grdOverlay" Panel.ZIndex="1000" Visibility="Visible" KeyDown="grdOverlay_KeyDown">
<Grid.Background>
<SolidColorBrush Color="Black" Opacity=".5"/>
</Grid.Background>
</Grid>
If windows forms application, you can set starting position of your form by setting `form.StartPosition'. example given here
Form.StartPosition can be set by any value from FormStartPosition enum, described here
Let's say your child form named childForm.
1. go to your childForm design and in properties find StartPosition and change its value to CenterScreen. It will cause to load your form in center of screen always.
2. for making it unmovable, in properties, change FormBorderStyle to none. In this case you need to create a close button for your login form and in its on click event you should use this code:
this.Close();
3. from your main form you should open your login form using ShowDialog which cause your main form to be inaccessible while your login form is open.
childForm login = new childForm();
login.ShowDialog();

Related Links

I need help with this error please: Could not write to output file…file is being used by another process.
Http Response Object in new window
Why am I getting System.OutOfMemoryException?
Change display of DateTime in MVC
XML attribute to indicate overwrite vs. preserve existing value
EdmSchemaAttribute interrupt some pages and throws an exception
Setting a property hidden by control's interface
EF Code First 4.1: “Multiple Inheritence” (Is A) Question
TripleDESCryptoServiceProvider using hex key
Use SQL Server CE Locally and SQL Server 2008 on Production Entity Framework Code First?
CRM 2011 SecurityNegotiationException trying to access web services
How to place child controls in a certain order when binding a custom control?
How to get rid of the exception “The 'Microsoft.ACE.OLEDB.12.0' provider is not registered on the local machine” in Win 7
How to position a form on top of another form without taking the focus
filter IQueryable in a loop with multiple Where statements
How to write value to html field from asp.net code behind

Categories

HOME
airflow
joomla
gulp
itunesconnect
salesforce
apache-storm
artifactory
thermal-printer
msbi
sugarcrm
kohana
cdn
virtualhost
restheart
pyodbc
urllib2
suitecrm
decoding
luis
loss
brightway
k-means
reportlab
loader
audio-streaming
hl7-fhir
bootstrap-accordion
policy
datanucleus
android-cursorloader
orgchart
gulp-jshint
large-files
checkmarx
custom-fields
foxpro
contextmenustrip
voyager
matlab-compiler
outlook-2010
lex
instances
nscollectionview
byobu
ngrok
office-interop
file-descriptor
uitextview
togglebutton
react.rb
django-tables2
jcifs
android-vectordrawable
jtextarea
trusted-computing
cardview
msiexec
ownership
turbolinks
cherry-pick
django-taggit
boost-propertytree
salesforce-service-cloud
hana-sql-script
google-finance-api
jquery-draggable
magnet-uri
commercetools
strcpy
pymol
static-files
alpha-beta-pruning
quickfixn
crystal-reports-7
javadb
formbuilder
xpand
sendy
fastcgi-mono-server
autofilter
ie-developer-tools
select2-rails
gwt2
architectural-patterns
qt5.1
quit
netzke
isgl3d
xpolog
netduino
html5-animation
xcdatamodel
nscharacterset
pkcs#7
file-storage
rpxnow
jgrowl

Resources

Mobile Apps Dev
Database Users
javascript
java
csharp
php
android
MS Developer
developer works
python
ios
c
html
jquery
RDBMS discuss
Cloud Virtualization
Database Dev&Adm
javascript
java
csharp
php
python
android
jquery
ruby
ios
html
Mobile App
Mobile App
Mobile App