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

trying to int.parse multi array string
Dashed shapes drawing in unexpected scale
Make linq aware of uniqe ID
how to fetch wpf combobox selected value (key)
ASP.NET Membership Email Verification
How to call function of object passed by interop?
GridView Control with private fields. i want to bind the Gridview
StringBuilder in Async Method
Exception when trying to read null string in C# WinRT component from WinJS
Unexpected results when using .net ajax & paging in sharepoint web part with c#
Can a byte[] buffer for a MemoryStream have variable size?
How to print control characters in Console Window
Visual Studio C# 2010 Express Debug running Faster than Release
get permanent facebook access token
C# Resizing a panel from right to left
How to do Importing and exporting excel using C# and WPF?

Categories

HOME
grizzly
blob
reference
arcgis
cryengine
singleton
flowtype
open-search-server
rethinkdb
ionic-native
google-my-business-api
captcha
chef-recipe
oxid
jinja2
owncloud
samba
orange
draw2d
conditional-formatting
django-rest-auth
summernote
url-parameters
datazen-server
tcpdf
handle
ppp
pixels
rancher
expressionengine
stack-trace
launchd
bytebuffer
concrete5
ios9
language-detection
ports
leaderboard
libconfig
mockserver
latency
fisheye
ssdp
rbac
vpython
binary-decision-diagram
jks
ng-class
aws-rds
activesupport
tsc
symantec
vga
particle-system
key-value-store
airwatch
avi
jde
3d-rendering
clique
jquery-draggable
android-togglebutton
identifying
joomla3.3
firewire
accpac
touch-typing
diffmerge
growl
sync
nsmutableurlrequest
step
ant-contrib
mysql-error-1146
xcode5.1
nokogiri
android-library
uikit-dynamics
big-endian
nude.js
stl-algorithm
file-processing
cryptolicensing
javah
cinder
chars
browser-state
code-golf
focus-stealing

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