鼠标上按钮应显示背景边框
我创造了一个简单的风格
<UserControl.Resources>
<Style TargetType="Button" x:Key="TransparentButton">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="Button">
<Border Background="Transparent">
<ContentPresenter/>
</Border>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</UserControl.Resources>
Run Code Online (Sandbox Code Playgroud)
并在按钮中
<Button Height="20" Width="20" Padding="0,0,0,0" DockPanel.Dock="Top" Grid.Row="0" Grid.Column="1" Click="button_click" Style="{StaticResource TransparentButton}"
BorderBrush="Transparent" BorderThickness="0" Background="Transparent">
<Button.Content>
<Image Source="../Resources/Help_icon.png" Stretch="UniformToFill" />
</Button.Content>
</Button>
Run Code Online (Sandbox Code Playgroud)
但在这种情况下,当按下按钮时,它不会在UI中显示,用户应该感觉到按下按钮.
感谢致敬
我们有一个向防火墙添加一些规则的应用程序。我们需要检索防火墙的规则,以便检查防火墙中是否存在该规则。我正在使用 C#。
我想打开CHM文件的特定页面.我正在使用WPF应用程序.目前我已经实施了
System.Diagnostics.Process.Start(filepath)
Run Code Online (Sandbox Code Playgroud)
这无助于打开特定页面
此致,NewDev
我已经创建了sheet1并在工作表中填充了一些数据,使用来自sheet1的数据我想创建一个图表工作表并绘制数据
try
{
app = new Excel.Application();
app.Visible = true;
workbook = app.Workbooks.Add(1);
worksheet = (Excel.Worksheet)workbook.Sheets[1];
PopulateDateInExcel(pathtologsfolder, startdate, enddate);
// create a chart
Excel.Range chartRange;
object misValue = System.Reflection.Missing.Value;
Excel.ChartObjects xlCharts = (Excel.ChartObjects)worksheet.ChartObjects(Type.Missing);
Excel.ChartObject myChart = (Excel.ChartObject)workbook.Charts[2];
Excel.Chart chartPage = myChart.Chart;
chartRange = worksheet.get_Range("AN1", "AP6");
chartPage.SetSourceData(chartRange, misValue);
chartPage.ChartType = Excel.XlChartType.xl3DLine;
}
catch (Exception e)
{
//Console.Write("Error");
}
finally
{
}
Run Code Online (Sandbox Code Playgroud)
在此先感谢Excel Automation
我想在x轴上为我的标签提供自定义角度,使其达到-35度.即我想格式化在Excel ==>格式轴==>对齐==>自定义角度
newWorksheet.Select(Type.Missing);
Excel.Range chartRange;
object misValue = System.Reflection.Missing.Value;
Excel.ChartObjects xlCharts = (Excel.ChartObjects)newWorksheet.ChartObjects(Type.Missing);
Excel.ChartObject myChart = (Excel.ChartObject)xlCharts.Add(10, 80, 300, 250);
Excel.Chart chartPage = myChart.Chart;
chartRange = newWorksheet.get_Range(cell1, cell2);
chartPage.SetSourceData(chartRange, Excel.XlRowCol.xlColumns);
chartPage.ChartType = Excel.XlChartType.xlColumnClustered;
var labels = new List<string>();
string date = string.Empty;
foreach (KeyValuePair<string, List<TestDetails>> kvp in writetocsv)
{
date = kvp.Key.Substring(0, (kvp.Key.Length - kvp.Key.IndexOf('_')) + 1);
labels.Add(date);
}
var series = (Excel.Series)chartPage.SeriesCollection(1);
series.XValues = labels.ToArray();
//series.HasDataLabels = true;
Excel.Axis valueAxis = (Excel.Axis)chartPage.Axes(Excel.XlAxisType.xlValue, Microsoft.Office.Interop.Excel.XlAxisGroup.xlPrimary);
chartPage.Location(Microsoft.Office.Interop.Excel.XlChartLocation.xlLocationAsNewSheet, "Chart_" + sheetName);
Run Code Online (Sandbox Code Playgroud)