我从资源日历中检索事件列表。在DisplayName两者的Organizer和Creator始终是空的。我尝试了在线Google 日历 API 参考,该示例也返回一个空值DisplayName。关于如何做到这一点的任何想法?
我正在使用 Google 日历 API v3。谢谢。
我需要显示一个PieChart,我目前正在使用Modern UI(Metro)图表.我确实复制了文档中的代码,问题是我总是在屏幕上有边框和标题但没有图表.
XAML
<UserControl x:Class="Projet.Recources0.Statistique.Ad_Aj"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mui="http://firstfloorsoftware.com/ModernUI"
xmlns:controls="http://metro.mahapps.com/winfx/xaml/controls"
xmlns:chart="clr-namespace:De.TorstenMandelkow.MetroChart;assembly=De.TorstenMandelkow.MetroChart"
mc:Ignorable="d" d:DesignWidth="1000" Height="670">
<UserControl.Resources>
<Style x:Key="MinimalChartStyle" TargetType="{x:Type chart:ChartBase}">
<Setter Property="Width" Value="500"/>
<Setter Property="Height" Value="500"/>
</Style>
</UserControl.Resources>
<Grid >
<chart:PieChart
Style="{StaticResource MinimalChartStyle}"
ChartTitle="Minimal Pie Chart"
ChartSubTitle="Chart with fixed width and height"
SelectedItem="{Binding Path=SelectedItem, Mode=TwoWay}" >
<chart:PieChart.Series>
<chart:ChartSeries
SeriesTitle="Errors"
DisplayMember="Category"
ValueMember="Number"
ItemsSource="{Binding Path=Errors}" />
</chart:PieChart.Series>
</chart:PieChart>
</Grid>
Run Code Online (Sandbox Code Playgroud)
CS
using MySql.Data.MySqlClient;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Configuration;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows; …Run Code Online (Sandbox Code Playgroud) 在我的Web应用程序中,我需要显示从数据表绑定的柱形图数据,我在我的统计图区域中的X轴上有3列,我需要在一侧显示col1,在第二列显示,并且需要为系列显示图例显示不同的颜色也来自数据表。
我需要像这样的我该怎么做,请任何人都可以帮助我该怎么做。
谢谢
我正在尝试更多地了解async/await,特别是编译器如何知道"暂停"某个async方法并且await不会产生额外的线程.
举个例子,假设我有一个async类似的方法
DoSomeStuff();
await sqlConnection.OpenAsync();
DoSomeOtherStuff();
Run Code Online (Sandbox Code Playgroud)
我知道这await sqlConnection.OpenAsync();是我的方法被"挂起"的地方,并且调用它的线程返回到线程池,一旦Task跟踪连接打开完成,就会发现可用的线程运行DoSomeOtherStuff().
| DoSomeStuff() | "start" opening connection | ------------------------------------ |
| ---------------------------------------------------------- | DoSomeOtherStuff() - |
Run Code Online (Sandbox Code Playgroud)
这是我感到困惑的地方.我查看OpenAsync(https://referencesource.microsoft.com/#System.Data/System/Data/Common/DBConnection.cs,e9166ee1c5d11996,references)的源代码,它是
public Task OpenAsync() {
return OpenAsync(CancellationToken.None);
}
public virtual Task OpenAsync(CancellationToken cancellationToken) {
TaskCompletionSource<object> taskCompletionSource = new TaskCompletionSource<object>();
if (cancellationToken.IsCancellationRequested) {
taskCompletionSource.SetCanceled();
}
else {
try {
Open();
taskCompletionSource.SetResult(null);
}
catch (Exception e) {
taskCompletionSource.SetException(e);
}
}
return …Run Code Online (Sandbox Code Playgroud) 我开发了一个应用程序,该应用程序应该将图像添加到Word文档中。它从 Word 文档中获取副本并将图片添加到副本中。我尝试添加文本,效果很好,但是通过添加图像,word 文档想要打开一个文件,并给出错误(无法打开文件“名称”,因为内容存在问题。)
我的代码如下所示:
File.Copy(file, newFile, true);
WordprocessingDocument wordFile = WordprocessingDocument.Open(newFile, true);
Body body = wordFile.MainDocumentPart.Document.Body;
var picture = new Picture();
var shape = new Shape() { Style = "width: 20px; height: 20px" };
var imageData = new ImageData() { RelationshipId = "img" };
shape.Append(imageData);
picture.Append(shape);
wordFile.MainDocumentPart.AddExternalRelationship(
"http://schemas.openxmlformats.org/officeDocument/2006/relationships/image",
new Uri(link_of_image, UriKind.Absolute),"img");
Paragraph para = body.AppendChild(new Paragraph());
Run run = para.AppendChild(new Run());
run.AppendChild(new Picture(picture));
wordFile.Close();
Run Code Online (Sandbox Code Playgroud)
可能出什么问题了?
我正在尝试创建一个从表单继承的表单。基类称为Window,它继承自MetroForm,这是我已下载并安装在项目中的 NuGet 包。此表单在设计器中加载没有问题。
public partial class Window : MetroForm
{
public WindowType windowType { get; }
public Engine engine { get; }
public Window(WindowType windowType, Engine engine)
{
InitializeComponent();
this.windowType = windowType;
this.engine = engine;
}
}
Run Code Online (Sandbox Code Playgroud)
子窗体的声明和构造如下:
public partial class GraphicsWindow : Window
{
public GraphicsWindow(WindowType windowType, Engine engine) : base(windowType, engine)
{
InitializeComponent();
}
}
Run Code Online (Sandbox Code Playgroud)
它在设计器窗口中引发以下错误:
“未找到类型 'DispatcherDesk.Windows.Window' 的构造函数。”
我发现多个线程在完全相同的情况下解决了这个错误,但没有一个解决方案对我有用。我已经尝试向父窗体和子窗体添加无参数构造函数,添加InitializeComponent();对它们的调用,并使用[Obsolete]属性和private访问修饰符。我还尝试在每一步重建解决方案并重新启动 Visual Studio。
目前我能想到的是,这些解决方案在 VS2017 中不再有效,但我不知道为什么。提前感谢您的任何答案!
我可以动态创建箱线图。我现在面临的问题是我不知道如何加粗和更改图表标题的字体大小。
我在网上研究了一段时间,但不知道如何做到这一点。
这是我的代码:
Chart Chart1 = new Chart();
Chart1.DataSource = tg;
Chart1.Width = 600;
Chart1.Height = 350;
Chart1.Series.Add(new Series());
Chart1.Series[0].ChartType = SeriesChartType.BoxPlot;
List<object> lst = tg.AsEnumerable().ToList<object>();
foreach (DataRow row in tg.Rows)
Chart1.Series[0].Points.AddXY(row["VALUE"], new object[] { row["Min"], row["Max"], row["Avg"], row["Percentile25"], row["Percentile50"], row["Percentile75"] });
Chart1.Series[0]["PixelPointWidth"] = "38";
string title = (tg.Rows[0]["TITLE"].ToString());
Chart1.Titles.Add(title);
//create chartareas
ChartArea ca = new ChartArea();
ca.AxisX = new Axis();
ca.AxisX.MajorGrid.Enabled = false;
ca.AxisY = new Axis();
ca.AxisY.MajorGrid.Enabled = false;
Chart1.ChartAreas.Add(ca);
//databind
Chart1.DataBind(); …Run Code Online (Sandbox Code Playgroud) 我正在使用 Xceed DateTimePicker 控件。问题在于它的日历大小:当您放大控件本身的字体时,其弹出日历的大小和字体不会改变。如何更改弹出窗口的大小?
将ShowInputAsync()返回一个字符串,但我想要得到的结果,我的意思是宣誓或取消,从对话框。
c# ×9
.net ×5
xaml ×4
wpf ×3
asp.net ×2
api ×1
async-await ×1
asynchronous ×1
calendar ×1
charts ×1
constructor ×1
css ×1
inheritance ×1
javascript ×1
mschart ×1
openxml ×1
oxyplot ×1
winforms ×1
xceed ×1