小编tar*_*qx3的帖子

从Chart控件中检索DateTime x轴值

我有一个图表控件,其中包含数据.x轴数据是DateTime,Y轴是整数.我试图从图表中提取数据并将其导出到excel,但DateTime值不会以我能理解它们的方式出现或者弄清楚如何解码它们.

示例值如下:

该图表从2012年4月30日开始,一直到2012年8月13日.

价值观显示:

{X=41030, Y=16991}
{X=41031, Y=34363}
{X=41032, Y=26744}
{X=41033, Y=28180}
{X=41034, Y=17478}

...intermediate values

{X=41134, Y=1785}
Run Code Online (Sandbox Code Playgroud)

我将图表x轴类型设置为日期时间

RestartBooksAttempts.Series["Attempts"].XValueType = ChartValueType.DateTime;
RestartBooksAttempts.Series["Books"].XValueType = ChartValueType.DateTime;
Run Code Online (Sandbox Code Playgroud)

而我正在抓住价值观:

Convert.ToDateTime(chart.Series[s.Name].Points[i].XValue)
double y = chart.Series[s.Name].Points[i].YValues[0];
Run Code Online (Sandbox Code Playgroud)

显然,x-points不是DateTime可转换值,有没有人知道如何解码这些值?

c# asp.net

4
推荐指数
1
解决办法
3299
查看次数

将Image控件源设置为服务器中的图像

我正在尝试在我的图像控件上显示图像,但它无法正常工作.我基本上将它用作屏幕截图预览.我将位图保存到服务器路径中的Images文件夹,然后将控件的ImageUrl设置为保存的图像位置.这是我的代码.此代码在按钮单击时执行:

img.Save(Server.MapPath("~/Images/") + "test.png", ImageFormat.Png);
Image1.ImageUrl = Server.MapPath("~/Images/") + "test.png";
Image1.DataBind();
Run Code Online (Sandbox Code Playgroud)

没有异常被捕获,并且图像在路径中正确保存.

c# asp.net

3
推荐指数
1
解决办法
1718
查看次数

命名管道挂起写

我正在制作一个多客户端命名管道服务器.客户端正确连接到服务器,但每当我尝试通过服务器或客户端写入管道时,代码都会挂起写入方法.是什么原因导致写入方法被卡住了?

服务器代码:

public void ListenForConnections()
{
    Thread startListening = new Thread(AcceptConnections);
    startListening.Start(PipeName);
}

public static void AcceptConnections(object ServerPipeName)
{
    while (true)
    {
        try
        {
            NamedPipeServerStream pipeServer = 
                 new NamedPipeServerStream(ServerPipeName.ToString(),
                                           PipeDirection.InOut, 
                                           NamedPipeServerStream.MaxAllowedServerInstances,
                                           PipeTransmissionMode.Message);

            pipeServer.WaitForConnection();
            pipeServer.ReadMode = PipeTransmissionMode.Message;
            //A client has connected
            Pipes.Add(pipeServer);
            index++;

            Thread Poll = new Thread(PollPipe);
            Poll.Start(pipeServer);
            }
            catch (Exception ex)
            {
                return;
            }
        }
    }

    public static void PollPipe(Object Pipe)
    {
        byte[] bytes = new byte[1024];
        NamedPipeServerStream PipeStream = (NamedPipeServerStream)Pipe;
        MemoryStream ms = new MemoryStream();
        do 
        {
            ms.Write(bytes, …
Run Code Online (Sandbox Code Playgroud)

c# pipe named-pipes

3
推荐指数
1
解决办法
3661
查看次数

以DataTable为源的GridView无法自动分页或排序

基本上,我将我的gridview上的数据源设置为我手动填写的数据表。有没有一种方法可以使gridview自动分页和排序?当我尝试转到gridview上的另一页时,它给了我一个异常,即未捕获到分页事件(这意味着我没有该事件的方法)。我也允许将分页设置为true。

c# asp.net

1
推荐指数
1
解决办法
2983
查看次数

标签 统计

c# ×4

asp.net ×3

named-pipes ×1

pipe ×1