Visual Studio 2019是Microsoft Visual Studio的一个版本。除非您对此特定版本有特定问题,否则请勿使用此标记。
在 Visual Studio 2019 中发布时获取 DestinationFiles 指 1 个项目,sourcefiles 指 1 个项目
非常需要帮助。发布到文件夹时出现以下错误。 使用以下发布设置 该解决方案在运行时工作得非常好。仅在发布时出现此错误。 请...
Visual Studio 2019:调试期间“本地”面板中出现错误 - “检索本地值的内部错误”
原始问题 (有关复制说明,请参阅更新 II) 我最近在调试会话期间摆弄了 Visual Studio 2019。我固定了类“SqlCommand&qu...
VB.Net 网站项目返回错误,当我尝试在 vs2019 中构建它时,这些错误不是错误
我在Visual Studio 2019中对一个VB.Net网站项目做了一些更改,然后我将它们合并到TFS中的UAT项目中,这样就可以将它们发布到我们的UAT网站上。当我尝试构建专业版时...
解决方案资源管理器中定位当前文件的按钮在新的 VS2019 中去了哪里?
我重新安装了 VS2019,但在解决方案资源管理器中找不到定位当前打开文件的按钮。哪里丢了,如何恢复?
创建自定义语音气泡工具提示,根据每种情况调整/放置其箭头/指针
我有一个 WPF 语音气泡工具提示,运行良好。 <Setter Property="OverridesDefaultStyle" ...</desc> <question vote="0"> <p>我有一个 WPF 语音气泡工具提示,运行良好。</p> <pre><code><Style x:Key="{x:Type ToolTip}" TargetType="ToolTip"> <Setter Property="OverridesDefaultStyle" Value="true" /> <Setter Property="HorizontalOffset" Value="1" /> <Setter Property="VerticalOffset" Value="1" /> <Setter Property="Background" Value="White" /> <Setter Property="Foreground" Value="Black" /> <Setter Property="FontSize" Value="12" /> <Setter Property="FontFamily" Value="Segoe UI" /> <Setter Property="DataContext" Value="{Binding Path=PlacementTarget.DataContext, RelativeSource={x:Static RelativeSource.Self}}"/> <Setter Property="Template"> <Setter.Value> <ControlTemplate TargetType="ToolTip"> <Canvas Width="225" Height="131"> <Path x:Name="Container" Canvas.Left="0" Canvas.Top="0" Margin="0" Data="M8,7.41 L15.415,0 L22.83,7.41 L224,7.41 L224,130 L0,130 L0,7.41 L8,7.41" Fill="{TemplateBinding Background}" Stroke="Gray"> <Path.Effect> <DropShadowEffect BlurRadius="10" Opacity="0.5" ShadowDepth="4" /> </Path.Effect> </Path> <TextBlock Canvas.Left="10" Canvas.Top="10" Width="100" Height="65" Text="{TemplateBinding Content}" TextWrapping="WrapWithOverflow" /> </Canvas> </ControlTemplate> </Setter.Value> </Setter> </Style> </code></pre> <p>上述方法的问题是,无论情况如何,语音气泡工具提示(路径)的箭头/指针始终放置在相同的位置,我希望它适应情况并使用以下之一(以上样式实现箭头位于左上角,下面屏幕截图中的第一个工具提示):</p> <p><a href="https://i.stack.imgur.com/T2MdB.png" target="_blank"><img src="https://cdn.imgupio.com/i/AWkuc3RhY2suaW1ndXIuY29tL1QyTWRCLnBuZw==" alt=""/></a></p> <p>我该怎么做?可以吗?</p> </question> <answer tick="false" vote="1"> <p>这是此任务的完整代码:</p> <pre><code>using System.Windows; using System.Windows.Controls; using System.Windows.Media; namespace Decorators { public enum Position { None, Top, Bottom, RightSide, LeftSide, } public enum SpecificPosition { None, LeftOrTop = 25, Center = 50, RightOrBottom = 75, } internal class BubbleTextDecorator : Decorator { #region DependencyProperties public static readonly DependencyProperty VerticalMarginProperty = DependencyProperty.Register("VerticalMargin", typeof(double), typeof(BubbleTextDecorator), new FrameworkPropertyMetadata(0.0, FrameworkPropertyMetadataOptions.AffectsMeasure | FrameworkPropertyMetadataOptions.AffectsRender)); public double VerticalMargin { get { return (double)GetValue(VerticalMarginProperty); } set { SetValue(VerticalMarginProperty, value); } } public static readonly DependencyProperty HorizontalMarginProperty = DependencyProperty.Register("HorizontalMargin", typeof(double), typeof(BubbleTextDecorator), new FrameworkPropertyMetadata(0.0, FrameworkPropertyMetadataOptions.AffectsMeasure | FrameworkPropertyMetadataOptions.AffectsRender)); public double HorizontalMargin { get { return (double)GetValue(HorizontalMarginProperty); } set { SetValue(HorizontalMarginProperty, value); } } public static readonly DependencyProperty PointerPositionProperty = DependencyProperty.Register("PointerPosition", typeof(Position), typeof(BubbleTextDecorator), new FrameworkPropertyMetadata(Position.None, FrameworkPropertyMetadataOptions.AffectsRender | FrameworkPropertyMetadataOptions.AffectsMeasure)); public Position PointerPosition { get { return (Position)GetValue(PointerPositionProperty); } set { SetValue(PointerPositionProperty, value); } } public static readonly DependencyProperty AlignmentPositionProperty = DependencyProperty.Register("AlignmentPosition", typeof(SpecificPosition), typeof(BubbleTextDecorator), new FrameworkPropertyMetadata(SpecificPosition.None, FrameworkPropertyMetadataOptions.AffectsRender | FrameworkPropertyMetadataOptions.AffectsMeasure)); public SpecificPosition AlignmentPosition { get { return (SpecificPosition)GetValue(AlignmentPositionProperty); } set { SetValue(AlignmentPositionProperty, value); } } public static readonly DependencyProperty PointerHeightProperty = DependencyProperty.Register("PointerHeight", typeof(double), typeof(BubbleTextDecorator), new FrameworkPropertyMetadata(0.0, FrameworkPropertyMetadataOptions.AffectsMeasure | FrameworkPropertyMetadataOptions.AffectsRender)); public double PointerHeight { get { return (double)GetValue(PointerHeightProperty); } set { SetValue(PointerHeightProperty, value); } } public static readonly DependencyProperty PointerWidthProperty = DependencyProperty.Register("PointerWidth", typeof(double), typeof(BubbleTextDecorator), new FrameworkPropertyMetadata(0.0, FrameworkPropertyMetadataOptions.AffectsMeasure | FrameworkPropertyMetadataOptions.AffectsArrange | FrameworkPropertyMetadataOptions.AffectsRender)); public double PointerWidth { get { return (double)GetValue(PointerWidthProperty); } set { SetValue(PointerWidthProperty, value); } } #endregion protected override Size ArrangeOverride(Size arrangeSize) { Size desiredSize = base.ArrangeOverride(arrangeSize); if (Child != null) { switch (PointerPosition) { case Position.Top: Child.Arrange(new Rect(new Point(0.0, PointerHeight), new Point(desiredSize.Width, desiredSize.Height))); break; case Position.Bottom: Child.Arrange(new Rect(new Point(0.0, 0.0), new Point(desiredSize.Width, desiredSize.Height - PointerHeight))); break; case Position.LeftSide: Child.Arrange(new Rect(new Point(PointerHeight, 0.0), new Point(desiredSize.Width, desiredSize.Height))); break; case Position.RightSide: Child.Arrange(new Rect(new Point(0.0, 0.0), new Point(desiredSize.Width - PointerHeight, desiredSize.Height))); break; } } return arrangeSize; } protected override Size MeasureOverride(Size constraint) { Size desiredSize = base.MeasureOverride(constraint); Size size = (PointerPosition == Position.Top || PointerPosition == Position.Bottom) ? new Size(desiredSize.Width + (HorizontalMargin * 2), desiredSize.Height + (VerticalMargin * 2) + PointerHeight) : new Size(desiredSize.Width + (HorizontalMargin * 2) + PointerHeight, desiredSize.Height + (VerticalMargin * 2)); return size; } protected override void OnRender(DrawingContext drawingContext) { Brush renderBrush = Brushes.Transparent; Pen renderPen = new Pen(Brushes.Black, 1); StreamGeometry geom = new StreamGeometry(); switch (PointerPosition) { case Position.Top: DrawTop(geom); break; case Position.Bottom: DrawBottom(geom); break; case Position.RightSide: DrawRight(geom); break; case Position.LeftSide: DrawLeft(geom); break; } // Some arbitrary drawing implements. drawingContext.DrawGeometry(renderBrush, renderPen, geom); } private void DrawLeft(StreamGeometry geom) { using (StreamGeometryContext ctx = geom.Open()) { ctx.BeginFigure( new Point(PointerHeight, 0.0), true, true); ctx.LineTo( new Point(ActualWidth, 0.0), true, false); ctx.LineTo( new Point(ActualWidth, ActualHeight), true, false); ctx.LineTo( new Point(PointerHeight, ActualHeight), true, false); ctx.LineTo( new Point(PointerHeight, (ActualHeight * (double)AlignmentPosition / 100) + (PointerWidth / 2)), true, false); ctx.LineTo( new Point(0.0, ActualHeight * (double)AlignmentPosition / 100), true, false); ctx.LineTo( new Point(PointerHeight, (ActualHeight * (double)AlignmentPosition / 100) - (PointerWidth / 2)), true, false); ctx.LineTo( new Point(PointerHeight, 0.0), true, false); } } private void DrawRight(StreamGeometry geom) { using (StreamGeometryContext ctx = geom.Open()) { ctx.BeginFigure( new Point(0.0, 0.0), true, true); ctx.LineTo( new Point(ActualWidth - PointerHeight, 0.0), true, false); ctx.LineTo( new Point(ActualWidth - PointerHeight, (ActualHeight * (double)AlignmentPosition / 100) - (PointerWidth / 2)), true, false); ctx.LineTo( new Point(ActualWidth, ActualHeight * (double)AlignmentPosition / 100), true, false); ctx.LineTo( new Point(ActualWidth - PointerHeight, (ActualHeight * (double)AlignmentPosition / 100) + (PointerWidth / 2)), true, false); ctx.LineTo( new Point(ActualWidth - PointerHeight, ActualHeight), true, false); ctx.LineTo( new Point(0.0, ActualHeight), true, false); ctx.LineTo( new Point(0.0, 0.0), true, false); } } private void DrawBottom(StreamGeometry geom) { using (StreamGeometryContext ctx = geom.Open()) { ctx.BeginFigure( new Point(0.0, 0.0), true, true); ctx.LineTo( new Point(ActualWidth, 0.0), true, false); ctx.LineTo( new Point(ActualWidth, ActualHeight - PointerHeight), true, false); ctx.LineTo( new Point((ActualWidth * (double)AlignmentPosition / 100) + (PointerWidth / 2), ActualHeight - PointerHeight), true, false); ctx.LineTo( new Point(ActualWidth * (double)AlignmentPosition / 100, ActualHeight), true, false); ctx.LineTo( new Point((ActualWidth * (double)AlignmentPosition / 100) - (PointerWidth / 2), ActualHeight - PointerHeight), true, false); ctx.LineTo( new Point(0.0, ActualHeight - PointerHeight), true, false); ctx.LineTo( new Point(0.0, 0.0), true, false); } } private void DrawTop(StreamGeometry geom) { using (StreamGeometryContext ctx = geom.Open()) { ctx.BeginFigure( new Point(0.0, PointerHeight), true, true); ctx.LineTo( new Point((ActualWidth * (double)AlignmentPosition / 100) - (PointerWidth / 2), PointerHeight), true, false); ctx.LineTo( new Point(ActualWidth * (double)AlignmentPosition / 100, 0.0), true, false); ctx.LineTo( new Point((ActualWidth * (double)AlignmentPosition / 100) + (PointerWidth / 2), PointerHeight), true, false); ctx.LineTo( new Point(ActualWidth, PointerHeight), true, false); ctx.LineTo( new Point(ActualWidth, ActualHeight), true, false); ctx.LineTo( new Point(0.0, ActualHeight), true, false); ctx.LineTo( new Point(0.0, PointerHeight), true, false); } } } } </code></pre> <p>这就是你如何使用它:</p> <pre><code><localdecorators:BubbleTextDecorator PointerHeight="10" PointerWidth="20" PointerPosition="LeftSide" AlignmentPosition="Center" VerticalMargin="30" HorizontalMargin="30" HorizontalAlignment="Left"> <TextBlock Text="this" HorizontalAlignment="Center" VerticalAlignment="Center"/> </localdecorators:BubbleTextDecorator> </code></pre> <p><a href="https://i.stack.imgur.com/0ycsH.png" target="_blank"><img src="https://cdn.imgupio.com/i/AWkuc3RhY2suaW1ndXIuY29tLzB5Y3NILnBuZw==" alt=""/></a></p> </answer> <answer tick="false" vote="0"> <p>目前我正在努力解决同样的问题。 您已经有解决这个问题的方法了吗?</p> <p>致以诚挚的问候</p> </answer> <answer tick="false" vote="-1"> <p>这是创建Decorator的典型案例。我曾经围绕文本制作了一个可定制的 ArrowBorder。你需要继承Decorator类。</p> <pre><code>internal class ArrowBorderDecorator : Decorator </code></pre> <p>然后你需要一些 DependencyProperties 以便于自定义。 在我的例子中,这是 <pre><code>ArrowTipToArrowTriangleBaseDistance</code></pre> 属性,这意味着箭头应该有多“尖”。在你的例子中,气泡文本箭头应该在哪里。</p> <pre><code> public static readonly DependencyProperty ArrowTipToArrowTriangleBaseDistanceProperty = DependencyProperty.Register("ArrowTipToArrowTriangleBaseDistance", typeof(double), typeof(ArrowBorderDecorator), new FrameworkPropertyMetadata(0.0, FrameworkPropertyMetadataOptions.AffectsMeasure | FrameworkPropertyMetadataOptions.AffectsRender)); public double ArrowTipToArrowTriangleBaseDistance { get { return (double)GetValue(ArrowTipToArrowTriangleBaseDistanceProperty); } set { SetValue(ArrowTipToArrowTriangleBaseDistanceProperty, value); } } </code></pre> <p>然后您需要重写 <pre><code>ArrangeOverride</code></pre>、<pre><code>MeasureOverride</code></pre> 和 <pre><code>OnRender</code></pre> 方法。前两个来自 Decorator 类,第三个来自 UIElement 类。</p> <p>这里有一个很好的<a href="https://stackoverflow.com/questions/66818340/measureoverride-and-arrangeoverride-what-is-really-availablesize-desiredsize">链接</a>来理解前两个。 在 <pre><code>OnRender</code></pre> 中,您有一个 DrawingContext,可以使用 DependenyProperties 绘制所需的形状。</p> <p>在这些之后,您可以像这样在 xaml 中使用装饰器:</p> <pre><code><localdecorators:ArrowBorderDecorator ArrowBaseHalfSegment="0" FillColor="{DynamicResource MahApps.Brushes.Accent3}" StrokeColor="{DynamicResource MahApps.Brushes.ThemeForeground}" ArrowBorderThickness="1" ArrowTipToArrowTriangleBaseDistance="10"> <TextBlock Text="{Binding Path=Title}" Foreground="{DynamicResource MahApps.Brushes.IdealForeground}" Padding="10 1 10 1" VerticalAlignment="Center" FontWeight="Bold"> </TextBlock></localdecorators:ArrowBorderDecorator> </code></pre> <p><a href="https://i.stack.imgur.com/bETwO.png" target="_blank"><img src="https://cdn.imgupio.com/i/AWkuc3RhY2suaW1ndXIuY29tL2JFVHdPLnBuZw==" alt=""/></a> <a href="https://i.stack.imgur.com/njfyp.png" target="_blank"><img src="https://cdn.imgupio.com/i/AWkuc3RhY2suaW1ndXIuY29tL25qZnlwLnBuZw==" alt=""/></a></p> </answer> </body></html>
在 C 代码上使用 VisualStudio 2019: 当我将 C 语言规范设置为除 Legacy 之外的任何内容时... ...然后我得到: 我尝试了 C++/C 规范的不同组合(即使我只有 C 文件,所以 C++ 应该......
如果我有以下课程: 公共课 Foo { 公共字符串代码{获取;放; } 公共字符串描述{获取;放; } 公共日期时间?有效日期 { 获取;放; } } 我想要
Visual Studio Intellisense 不断弹出
在 Visual Studio 2019 中使用 VB.NET。在代码库中的任意位置键入一个空格字符,弹出窗口会显示一长串选项。您必须不断点击或按 ESC 键。这很快...
'_Ty *std::allocator<_Ty>::address(_Ty &) no except const' 将 c++ 项目从 VS2010 升级到 VS2019 时出错
我们正在将 C++ 项目从 VS2010 迁移到 VS2019。 得到 错误:'_Ty *std::allocator<_Ty>::address(_Ty &) noexcept const':成员函数已定义或声明 在 'xmem...
如何从 Visual Studio 打开窗口中删除旧项目条目/列表/历史记录?
所有最近工作的项目都将在 Visual Studio 打开窗口中可用。 即使项目从我们的文件资源管理器中删除,这些名称也将存在于 VS 打开窗口中。 我可以...
有没有办法下载 Visual Studio 2019,发生的情况是我删除了该文件夹,现在安装程序认为我有 Visual Studio 2019 并且不会让我下载它,如果我尝试删除...
如何在Visual Studio 2019中选择正确的.Net版本?
实际上,我在 Visual Studio 2019 中选择了 .net Framework 2.0,并且我知道部分方法是通过 C# 3 引入的,但是我如何在 dot net Framework 2.0 中使用部分方法。编译器不是
Visual Studio 2019 安装无法获取包 Microsoft.VisualStduio.MinShell.Msi.Resources
每次尝试安装 Visual Studio 2019 时,都会收到错误 无法安装 Microsoft.VisualStudio.MinShell.Msi.Resources。 我已经尝试了在互联网上找到的所有内容。当我...
x86-64 架构 //之后寄存器RAX会有什么值 //执行以下指令序列? 莫夫阿尔,-5 异或啊啊啊 移动 cl, 5 分区 //a) -1 ...
为什么 Visual Studio 找不到 Visual Studio 安装程序安装的 Node.js 运行时?
这就是我所做的 我使用 Visual Studio 安装程序安装了 Node.js: 我关闭了安装程序,打开了 Visual Studio,关闭了 Visual Studio,然后重新启动了电脑。 我搜索了我的 Visual Studio
如何在 Visual Studio 2019 中使用 C++ 保存的模型?
首先这是我的环境。 系统信息 操作系统平台和发行版(例如Linux Ubuntu 16.04):Windows10 TensorFlow 安装自(源代码或二进制文件):tensorflow/tensorflow TensorFlow 已经...
如何在 Visuals Studio 2019 中使用 C++ 保存的模型?
首先这是我的环境。 系统信息 操作系统平台和发行版(例如Linux Ubuntu 16.04):Windows10 TensorFlow 安装自(源代码或二进制文件):tensorflow/tensorflow TensorFlow 已经...
我需要将现有的 2017 SSIS 包转换为 2019 年。其中许多连接到 Oracle 19c 数据库。在 VS2017 中我们成功使用了 Attunity 连接器。 我目前安装了 VS2017 和 VS2019...
如何强制 Visual Studio 2019 始终以 100% 缩放开始?
我想强制 Visual Studio 始终以 100% 缩放开始,以便设计人员不会放错项目。 我知道开发人员命令提示符命令:devenv /noScale 但我该怎么办...
VS2019 尝试添加引用时出现“错误 HRESULT E_FAIL 已从对 COM 组件的调用返回”
VS2019 尝试添加引用时出现“错误 HRESULT E_FAIL 已从对 COM 组件的调用返回”。我看过其他帖子并尝试了一件事,但没有任何结果...