void ExifFormActivated(object sender, EventArgs e) { int wX = this.Left; int wY = this.Top; int wW = this.Width; int wH = this.Height; bool visible; Rectangle screenRectangle = RectangleToScreen(this.ClientRectangle); int titleHeight = screenRectangle.Top - this.Top; Multi.FormShowVisible(out visible, ref wX, ref wY, wW, titleHeight); if (!visible) { this.Left = wX; this.Top = wY; } else { Multi.FormShowVisible(out visible, ref wX, ref wY, wW, wH); if (!visible) { this.Left = wX; this.Top = wY; } } }
void ExifFormFormClosing(object sender, FormClosingEventArgs e) { int le = this.Left; int to = this.Top; Multi.ExifSave(le, to); Settings.Default.ExifW = this.Width; Settings.Default.ExifH = this.Height; Settings.Default.Save( ); e.Cancel = true; this.Hide(); }
void ExifFormLoad(object sender, EventArgs e) { TranslateExifForm(); int le; int to; int wi = Settings.Default.ExifW; int he = Settings.Default.ExifH; Multi.ExifLoad(out le, out to); this.Left = le; this.Top = to; this.Width = wi; this.Height = he; //Debug.WriteLine("Exif pos: X: {0} Y: {1} W: {2} H: {3} ", Left, Top, Width, Height); }
void FrmMainFormClosed(object sender, FormClosedEventArgs e) { // DockContent has no close event when main form closes if (m_Image != null) { m_Image.Close2nd(); } //Debug.WriteLine("main FormClosed:"); int le = this.Left; int to = this.Top; Multi.MainSave(le, to); Settings.Default.MainW = this.Width; Settings.Default.MainH = this.Height; string recentPath = ""; recentItem1.StringList(ref recentPath); Settings.Default.RecentImgs = recentPath; Settings.Default.Save( ); // last program line for debugger }
void FrmImageFormClosing(object sender, FormClosingEventArgs e) { if (_wType == WinType.second){ _ndRunning = false; int wX = this.Left; int wY = this.Top; Multi.SecondSave(wX, wY); Settings.Default.SecondW = this.Width; Settings.Default.SecondH = this.Height; Settings.Default.Save( ); //Debug.WriteLine("close 2nd y: {0} ", Settings.Default.SecondY); } if (_wType == WinType.normal){ e.Cancel = true; this.Hide(); //Debug.WriteLine("hide img "); } if (_wType == WinType.full){ _fullRunning = false; } if (CanShowExif()){ m_Exif.Close(); } }
//-------------------------- form ---------------------------// void FrmMainLoad(object sender, EventArgs e) { Debug.WriteLine("Main start: "); listener = new XDListener(); listener.MessageReceived += new XDListener.XDMessageHandler(listener_MessageReceived); listener.RegisterChannel("NVMessage"); bool kShift = (Control.ModifierKeys == Keys.Shift); bool created; s_event = new EventWaitHandle(false, EventResetMode.ManualReset, "Next-View", out created); // instead of mutex if (created || kShift) // 1st instance or shift key { if (Properties.Settings.Default.UpgradeRequired) { Settings.Default.Upgrade(); Settings.Default.UpgradeRequired = false; Settings.Default.Save( ); } int wX; int wY; int wW = Settings.Default.MainW; int wH = Settings.Default.MainH; Multi.MainLoad(out wX, out wY); //Debug.WriteLine("open main 1 y: {0} ", wY); bool visible; // menu bar visible Rectangle screenRectangle = RectangleToScreen(this.ClientRectangle); int titleHeight = screenRectangle.Top - this.Top; Multi.FormShowVisible(out visible, ref wX, ref wY, wW, titleHeight); if (!visible) { this.Left = wX; this.Top = wY; //Debug.WriteLine("open main 2 y: {0} ", wY); } else { Multi.FormShowVisible(out visible, ref wX, ref wY, wW, wH); this.Left = wX; this.Top = wY; //Debug.WriteLine("open main 3 y: {0} ", wY); } this.Width = wW; this.Height = wH; string curDir = Path.GetDirectoryName(System.Reflection.Assembly.GetEntryAssembly().Location); string moPath = curDir + @"\language\"; string cultureStr = Settings.Default.Language; if (cultureStr == "") { cultureStr = CultureInfo.InstalledUICulture.ToString(); Settings.Default.Language = cultureStr; } //Debug.WriteLine("Culture: " + cultureStr); T.SetCatalog(moPath, cultureStr); TranslateMainForm(); tbNoGif(); string recentPath = Settings.Default.RecentImgs; this.recentItem1.LoadList(recentPath); this.recentItem1.UpdateList(); this.recentItem1.MaxItems = 5; this.recentItem1.ItemClick += new System.EventHandler(recentItem_Click); this.recentItem1.UpdateList(); //Debug.WriteLine("open main y: {0} ", Settings.Default.MainY); } else // 2nd instance, give image path to 1st instance and end this 2nd { string[] args = Environment.GetCommandLineArgs(); string commandLine = "S"; if (args.Length > 1) { commandLine = args[1]; } //Debug.WriteLine("send message:"); XDBroadcast.SendToChannel("NVMessage", commandLine); // receive: listener_MessageReceived // send is to itself as well, before exit // NvSendMsg(); does not work for strings, ExitApp(); } }
void FrmImageLoad(object sender, EventArgs e) { if (_wType == WinType.normal){ _ndRunning = false; _fullRunning = false; _scWidth = Screen.FromControl(this).Bounds.Width; _scHeight = Screen.FromControl(this).Bounds.Height; picBox.BackColor = SystemColors.Control; } if (_wType == WinType.full){ _ndRunning = false; _fullRunning = true; _scWidth = Screen.FromControl(this).Bounds.Width; _scHeight = Screen.FromControl(this).Bounds.Height; //Debug.WriteLine("Full Image W / H: {0}/{1}", _scWidth, _scHeight); ScollbarVis(false); //this.Width = _scWidth; //this.Height = _scHeight; //this.Top = 0; //this.Left = 0; picBox.BackColor = Color.Black; this.FormBorderStyle = FormBorderStyle.None; this.WindowState = FormWindowState.Maximized; } TranslateImageForm(); if (_wType == WinType.second){ popClose.Text = T._("Close"); // not Exit int wX; int wY; int wW = Settings.Default.SecondW; int wH = Settings.Default.SecondH; Multi.SecondLoad(out wX, out wY); bool visible; // menu bar visible Rectangle screenRectangle = RectangleToScreen(this.ClientRectangle); int titleHeight = screenRectangle.Top - this.Top; Multi.FormShowVisible(out visible, ref wX, ref wY, wW, titleHeight); if (!visible){ this.Left = wX; this.Top = wY; } else { Multi.FormShowVisible(out visible, ref wX, ref wY, wW, wH); this.Left = wX; this.Top = wY; } this.Width = wW; this.Height = wH; this.Icon = Icon1.Icon; //Debug.WriteLine("open 2nd y: {0} ", Settings.Default.SecondY); _ndRunning = true; _fullRunning = false; _mainWidth = picBox.Width; _mainHeight = picBox.Height; _scWidth = this.Width; _scHeight = this.Height; picBox.BackColor = SystemColors.Control; } // end 2nd }