Beispiel #1
0
    public void ButtonImportImageOnClick()//ImportImage按钮被点击
    {
        CloseFilePanel();
        OpenFileName ofn = new OpenFileName();

        ofn.structSize   = Marshal.SizeOf(ofn);
        ofn.filter       = "图片文件(*.jpg*.jpeg*.png)\0*.jpg;*.png;*.jpeg";
        ofn.file         = new string(new char[256]);
        ofn.maxFile      = ofn.file.Length;
        ofn.fileTitle    = new string(new char[64]);
        ofn.maxFileTitle = ofn.fileTitle.Length;
        ofn.initialDir   = Application.streamingAssetsPath.Replace('/', '\\');//默认路径
        ofn.title        = "导入图像";
        ofn.flags        = 0x00080000 | 0x00001000 | 0x00000800 | 0x00000008;
        if (LocalDialog.GetOpenFileName(ofn))
        {
            Debug.Log("file: " + ofn.file);
            objManager.LoadImage(ofn.file);
        }
    }