如何获取getEnabled回调方法在VB.net Ribbon项目中运行

时间:2017-05-02 11:04:27

标签: excel ribbon

我有一个用于功能区按钮的XML代码

<button id="Button9" label="Cover Index" image="cover"
                size="large" onAction="Viewcover" getEnabled="GetBEnabled" />

我使用Visual Studio并按照指示在回调区域中插入此getEnabled回调方法

Public Sub GetBEnabled(ByVal control As Office.IRibbonControl, ByVal returnedVal As Boolean)

    returnedVal = True

End Sub

虽然returnVal设置为True,但仍未启用该按钮。我做错了什么?

1 个答案:

答案 0 :(得分:0)

我认为VB.net中getEnabled回调方法的正确语法是:

<?php
function encrypt_decrypt($action, $string) {
    $output = false;

    $encrypt_method = "AES-256-CBC";
    $secret_key = 'This is my secret key';
    $secret_iv = 'This is my secret iv';

    // hash
    $key = hash('sha256', $secret_key);

    // iv - encrypt method AES-256-CBC expects 16 bytes - else you will get a warning
    $iv = substr(hash('sha256', $secret_iv), 0, 16);

    if ( $action == 'encrypt' ) {
        $output = openssl_encrypt($string, $encrypt_method, $key, 0, $iv);
        $output = base64_encode($output);
    } else if( $action == 'decrypt' ) {
        $output = openssl_decrypt(base64_decode($string), $encrypt_method, $key, 0, $iv);
    }

    return $output;
}

$plain_txt = "This is my plain text";
echo "Plain Text =" .$plain_txt. "\n";

$encrypted_txt = encrypt_decrypt('encrypt', $plain_txt);
echo "Encrypted Text = " .$encrypted_txt. "\n";

$decrypted_txt = encrypt_decrypt('decrypt', $encrypted_txt);
echo "Decrypted Text =" .$decrypted_txt. "\n";

if ( $plain_txt === $decrypted_txt ) echo "SUCCESS";
else echo "FAILED";

echo "\n";

?>

由于