コード例 #1
0
ファイル: G510Gui.cs プロジェクト: siasur/G510Display
        private void btnLoad_Click(object sender, EventArgs e)
        {
            bool success = false;

            using (OpenFileDialog fileDialog = new OpenFileDialog())
            {
                fileDialog.Filter           = "G510 Image|*.g510";
                fileDialog.InitialDirectory = string.IsNullOrEmpty(_lastPath) ? Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments) : _lastPath;
                fileDialog.CheckFileExists  = true;
                fileDialog.Multiselect      = false;

                if (fileDialog.ShowDialog() == DialogResult.OK)
                {
                    _lastPath = Path.GetDirectoryName(fileDialog.FileName);
                    success   = _core.LoadFromFile(fileDialog.FileName);
                }
            }

            if (!success)
            {
                return;
            }

            _blockUpdate = true;
            G510Data data = _core.G510Data;

            cboFont.SelectedItem = data.FontName;
            numFontSize.Value    = data.FontSize;
            numPosX.Value        = data.X;
            numPosY.Value        = data.Y;
            txtText.Text         = data.Text;
            _blockUpdate         = false;
        }