OpenFileDialog.ReadOnlyChecked プロパティとは? わかりやすく解説

Weblio 辞書 > コンピュータ > .NET Framework クラス ライブラリ リファレンス > OpenFileDialog.ReadOnlyChecked プロパティの意味・解説 

OpenFileDialog.ReadOnlyChecked プロパティ

読み取り専用チェック ボックスオンオフかを示す値を取得または設定します

名前空間: System.Windows.Forms
アセンブリ: System.Windows.Forms (system.windows.forms.dll 内)
構文構文

Dim instance As OpenFileDialog
Dim value As Boolean

value = instance.ReadOnlyChecked

instance.ReadOnlyChecked = value
public bool ReadOnlyChecked { get;
 set; }
public:
property bool ReadOnlyChecked {
    bool get ();
    void set (bool value);
}
/** @property */
public boolean get_ReadOnlyChecked ()

/** @property */
public void set_ReadOnlyChecked (boolean value)
public function get ReadOnlyChecked
 () : boolean

public function set ReadOnlyChecked
 (value : boolean)

プロパティ
読み取り専用チェック ボックスオン場合trueそれ以外場合false既定値false です。

解説解説
使用例使用例

ReadOnlyChecked プロパティ使用方法を示すコード例次に示します。この例では、ShowReadOnly プロパティtrue設定された OpenFileDialog ボックス表示しますオプションクリックしてファイル読み取り専用モードで開くと、ReadOnlyChecked プロパティtrue評価されOpenFile メソッド使用してファイル開かれます。それ以外場合は、FileStream クラス使用して読み取り/書き込みモードファイル開かれます。

Private Function OpenFile() As
 FileStream

    ' Displays an OpenFileDialog and shows the read/only files.

    Dim DlgOpenFile As New
 OpenFileDialog()
    DlgOpenFile.ShowReadOnly = True
    Dim Fs As FileStream

    If DlgOpenFile.ShowDialog() = DialogResult.OK Then

        ' If ReadOnlyChecked is true, uses the OpenFile method to
        ' open the file with read/only access.

        If DlgOpenFile.ReadOnlyChecked = True
 Then

            Return DlgOpenFile.OpenFile()

            ' Otherwise, opens the file with read/write access.

        Else

            Dim Path As String
 = DlgOpenFile.FileName
            Return New FileStream(Path, System.IO.FileMode.Open,
 _
                    System.IO.FileAccess.ReadWrite)


        End If

    End If


End Function

private FileStream OpenFile()
{
    // Displays an OpenFileDialog and shows the read/only files.

    OpenFileDialog dlgOpenFile = new OpenFileDialog();
    dlgOpenFile.ShowReadOnly = true;


    if(dlgOpenFile.ShowDialog() == DialogResult.OK)
    {

        // If ReadOnlyChecked is true, uses the OpenFile method to
        // open the file with read/only access.

        if(dlgOpenFile.ReadOnlyChecked == true)
        {
            return (FileStream)dlgOpenFile.OpenFile();

        }

        // Otherwise, opens the file with read/write access.

        else
        {
            string path = dlgOpenFile.FileName;
            return new FileStream(path, System.IO.FileMode.Open
,
 
                    System.IO.FileAccess.ReadWrite);
        }


    }

    return null;


}

private:
   FileStream^ OpenFile()
   {
      // Displays an OpenFileDialog and shows the read/only files.
      OpenFileDialog^ dlgOpenFile = gcnew OpenFileDialog;
      dlgOpenFile->ShowReadOnly = true;
      if ( dlgOpenFile->ShowDialog() == ::DialogResult::OK
 )
      {
         // If ReadOnlyChecked is true, uses the OpenFile method to
         // open the file with read/only access.
         if ( dlgOpenFile->ReadOnlyChecked == true
 )
         {
            return dynamic_cast<FileStream^>(dlgOpenFile->OpenFile());
         }
         // Otherwise, opens the file with read/write access.
         else
         {
            String^ path = dlgOpenFile->FileName;
            return gcnew FileStream( path,System::IO::FileMode::Open,System::IO::FileAccess::ReadWrite
 );
         }
      }

      return nullptr;
   }
private FileStream OpenFile()
{
    // Displays an OpenFileDialog and shows the read/only files.
    OpenFileDialog dlgOpenFile = new OpenFileDialog();
    dlgOpenFile.set_ShowReadOnly(true);
    if (dlgOpenFile.ShowDialog().Equals(get_DialogResult().OK))
 {
        // If ReadOnlyChecked is true, uses the OpenFile method to
        // open the file with read/only access.
        if (dlgOpenFile.get_ReadOnlyChecked() == true)
 {
            return (FileStream)dlgOpenFile.OpenFile();
        }
        // Otherwise, opens the file with read/write access.
        else {
            String path = dlgOpenFile.get_FileName();
            return new FileStream(path, System.IO.FileMode.Open
,
                System.IO.FileAccess.ReadWrite);
        }
    }
    return null;
} //OpenFile 
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照
関連項目
OpenFileDialog クラス
OpenFileDialog メンバ
System.Windows.Forms 名前空間
ShowReadOnly



英和和英テキスト翻訳>> Weblio翻訳
英語⇒日本語日本語⇒英語
  

辞書ショートカット

すべての辞書の索引

「OpenFileDialog.ReadOnlyChecked プロパティ」の関連用語

OpenFileDialog.ReadOnlyChecked プロパティのお隣キーワード
検索ランキング

   

英語⇒日本語
日本語⇒英語
   



OpenFileDialog.ReadOnlyChecked プロパティのページの著作権
Weblio 辞書 情報提供元は 参加元一覧 にて確認できます。

   
日本マイクロソフト株式会社日本マイクロソフト株式会社
© 2024 Microsoft.All rights reserved.

©2024 GRAS Group, Inc.RSS