예제 #1
0
        //Load settings from the registry and aply them to main window,
        //such as last position, dimensions and font family & size
        private void LoadLastPos()
        {
            int top;
            int left;
            int height;
            int width;

            int.TryParse(settings.GetSetting(WND_TOP), out top);
            int.TryParse(settings.GetSetting(WND_LEFT), out left);
            int.TryParse(settings.GetSetting(WND_WIDTH), out width);
            int.TryParse(settings.GetSetting(WND_HEIGHT), out height);

            if (top > 0)
            {
                Top = top;
            }

            if (left > 0)
            {
                Left = left;
            }

            if (height >= MinimumSize.Height)
            {
                Height = height;
            }

            if (width >= MinimumSize.Width)
            {
                Width = width;
            }

            //load font 'serialized' string and convert it into a Font object, via the FontConverter class
            string fontStr;

            fontStr = settings.GetSetting(WND_FONT);
            if (fontStr != "")
            {
                FontConverter fontCon = new FontConverter();
                try{
                    Font fontObj = (Font)fontCon.ConvertFromString(fontStr);
                    textBoxGreek.Font = fontObj;
                    textBoxLatin.Font = fontObj;
                }catch (Exception) { }
            }
        }