
我给你DataPointStyle的样式吧。思路是用blend编辑Series的DataPointStyle。修改DataPoint模板中的Tooltip。
<Style x:Key="LineDataPointStyle1" TargetType="{x:Type dc:LineDataPoint}">
<Setter Property="Background" Value="Orange"/>
<Setter Property="BorderBrush" Value="Gray"/>
<Setter Property="BorderThickness" Value="1"/>
<Setter Property="IsTabStop" Value="False"/>
<Setter Property="Width" Value="8"/>
<Setter Property="Height" Value="8"/>
<Setter Property="Template">
<SetterValue>
<ControlTemplate TargetType="{x:Type dc:LineDataPoint}">
<Grid x:Name="Root" Opacity="0">
<GridToolTip>
<!--<ContentControl Content="{TemplateBinding FormattedDependentValue}"/>-->
<StackPanel Orientation="Horizontal">
<ContentControl Content="{TemplateBinding ActualIndependentValue}"/>
<TextBlock>,</TextBlock>
<ContentControl Content="{TemplateBinding ActualDependentValue}"/>
</StackPanel>
</GridToolTip>
<Ellipse Fill="{TemplateBinding Background}" Stroke="{TemplateBinding BorderBrush}"/>
<Ellipse RenderTransformOrigin="0661,0321">
<EllipseFill>
<RadialGradientBrush GradientOrigin="0681,0308">
<GradientStop Color="Transparent"/>
<GradientStop Color="#FF3D3A3A" Offset="1"/>
</RadialGradientBrush>
</EllipseFill>
</Ellipse>
<Ellipse x:Name="SelectionHighlight" Fill="Red" Opacity="0"/>
<Ellipse x:Name="MouseOverHighlight" Fill="White" Opacity="0"/>
</Grid>
</ControlTemplate>
</SetterValue>
</Setter>
</Style>
注释行是默认的toolitp中的内容。
1、新建一个 Window,添加一个Grid
<Window x:Class="WpfApplication1MainWindow"xmlns=";
2、添加类 FunnyBrush,这是我自己写着玩的
public class FunnyBrush{
public static void Draw(Panel panel)
{
var brush = new RadialGradientBrush();
var center = new Point(panelActualWidth / 2d, panelActualHeight / 2d);
brushCenter = center;
brushGradientOrigin = center;
brushRadiusX = centerX;
brushRadiusY = centerY;
brushMappingMode = BrushMappingModeAbsolute;
ConsoleWriteLine(center);
var stops = new GradientStopCollection();
stopsAdd(new GradientStop(ColorsYellow, 0d));
stopsAdd(new GradientStop(ColorsRed, 025d));
stopsAdd(new GradientStop(ColorsBlue, 075d));
stopsAdd(new GradientStop(ColorsLimeGreen, 1d));
brushGradientStops = stops;
panelBackground = brush;
var win = FindParent<Window>(panel) as FrameworkElement;
if (win == null) win = panel;
winMouseMove += (obj, args) =>
{
brushGradientOrigin = argsGetPosition(panel);
};
winSizeChanged += (obj, args) =>
{
var pt = new Point(panelActualWidth / 2d, panelActualHeight / 2d);
brushCenter = pt;
brushRadiusX = ptX;
brushRadiusY = ptY;
};
}
// 这个方法来自
// >}
3、在 Window_Loaded 事件中添加代码
FunnyBrushDraw(panel);除非是有精确画图的需要,否则wpf不提倡绝对坐标,实在要实现与winform类似的位置,需要用canvas,类似如下
<Grid><Canvas>
<Button CanvasLeft="20" CanvasTop="30"
Width="70" Height="20">button1</Button>
</Canvas>
</Grid>
要实现这样的效果需要知道相似位置在这两幅图中的坐标以及这两个控件在对话框上的坐标,然后通过加减运算就可以得到图像上的相似区域在对话框的坐标,直接将这两个坐标用直线连接就可以了。
为此,如何获得控件在对话框上的坐标是关键问题。编写了如下的测试小程序,目的是将两个picture控件中的点用直线连接起来,比较直观的是picture控件的四个角,所以程序中是将控件的拐角连接起来。首先在对话框上并排放置两个同样大小的picture控件,将他们的标识分别设成IDC_LEFT和IDC_RIGHT,然后添加两个编辑框用于显示picture控件的大小,给这两个编辑框添加相应的数据成员m_row和m_colume。添加一个按钮用于连接picture控件中的点,为这个按钮添加
成员函数
OnMatch()
。
void
CControlDlg::OnMatch(){//
TODO:
Add
your
control
notification
handler
code
here
CRect
rectL,rectR;
import javaawt;
import javaxswingJFrame;
import javaxswingJLabel;
import javaxswingSwingConstants;
import javaxswingWindowConstants;
import javaxswingborder;
public class jframe {
/
@param args
/
public void CreateJFrame(String title) {
JFrame jf = new JFrame(title);
Container container = jfgetContentPane();
JLabel jl = new JLabel("");
jlsetHorizontalAlignment(SwingConstantsCENTER);
containeradd(jl);
containersetBackground(Colorwhite);
jfsetVisible(true);
jfsetSize(200, 150);
jfsetDefaultCloseOperation(WindowConstantsEXIT_ON_CLOSE);
};
比如说有一个button1,那么获取X坐标就是:int x=button1LocationX;
获取y坐标就是:int y=button1LocationY;
祝你好运啊,学习顺利进步
以上就是关于不知道 WPF toolkit 控件 当鼠标移动到数值图形栏或者图像点的时候显示 X和Y的坐标值全部的内容,包括:不知道 WPF toolkit 控件 当鼠标移动到数值图形栏或者图像点的时候显示 X和Y的坐标值、WPF 获取图像像素的屏幕坐标(不要鼠标点击获得,而是知道哪个像素点得到对应的数据、WPF控件位置和绘图位置等相关内容解答,如果想了解更多相关内容,可以关注我们,你们的支持是我们更新的动力!
欢迎分享,转载请注明来源:内存溢出
微信扫一扫
支付宝扫一扫
评论列表(0条)