Debugger.HexDisplayMode 属性

获取或设置是以十六进制还是以十进制格式输出表达式。

命名空间:  EnvDTE
程序集:  EnvDTE(在 EnvDTE.dll 中)

语法

声明
Property HexDisplayMode As Boolean
    Get
    Set
bool HexDisplayMode { get; set; }
property bool HexDisplayMode {
    bool get ();
    void set (bool value);
}
abstract HexDisplayMode : bool with get, set
function get HexDisplayMode () : boolean
function set HexDisplayMode (value : boolean)

属性值

类型:System.Boolean
如果采用十六进制格式,则为 true,否则为 false。

备注

使用 HexDisplayMode 来确定或设置是以十六进制还是以十进制格式输出表达式。 HexDisplayMode 与 “选项”对话框 ->“调试”->“常规” 中的设置直接对应。

有关更多信息,请参见 调试器中的表达式

示例

下面的示例演示如何使用 HexDisplayMode 属性。

测试此属性:

  1. 在目标应用程序中设置一个断点。

  2. 以调试模式运行目标应用程序。

  3. 当此应用程序停在该断点处时,运行外接程序。

public static void HexDisplayMode(DTE dte)
{
    // Setup the debug Output window.
    Window w = (Window)dte.Windows.Item(EnvDTE.Constants.vsWindowKindOutput);
    w.Visible = true;
    OutputWindow ow = (OutputWindow)w.Object;
    OutputWindowPane owp = ow.OutputWindowPanes.Add("Hex Display Mode Test");
    owp.Activate();

    dte.Debugger.HexDisplayMode = false;
    EnvDTE.Expression exp = dte.Debugger.GetExpression("length", true, 1);
    owp.OutputString("Value of variable length in decimal: " + exp.Value);

    dte.Debugger.HexDisplayMode = true;
    exp = dte.Debugger.GetExpression("length", true, 1);
    owp.OutputString("\nValue of variable length in hex: " + exp.Value);
}
Shared Sub HexDisplayMode(ByRef dte As EnvDTE.DTE)
    Dim exp As EnvDTE.Expression
    dte.Debugger.HexDisplayMode = False
    exp = dte.Debugger.GetExpression("length", True, 1)
    MessageBox.Show("Value of variable length in decimal: " + exp.Value, _
                    "Debugger Test - HexDisplayMode")
    dte.Debugger.HexDisplayMode = True
    exp = dte.Debugger.GetExpression("length", True, 1)
    MessageBox.Show("Value of variable length in hex: " + exp.Value, _
                    "Debugger Test - HexDisplayMode")
End Sub

.NET Framework 安全性

请参见

参考

Debugger 接口

EnvDTE 命名空间