小编Nat*_*izz的帖子

在xaml中调整图像大小而不会降低质量

我有这个图像(原始大小:256x256)

在此输入图像描述

我制作了这个xaml定义来在我的应用程序中显示图像

<Image Grid.Row="1" Source="/MyProject;component/Images/happy.png" Stretch="Fill" Width="64" Height="64"  VerticalAlignment="Top" Margin="0,0,0,0" HorizontalAlignment="Center" />
Run Code Online (Sandbox Code Playgroud)

我得到了这个结果

在此输入图像描述

我怎样才能更顺利地调整大小?

c# xaml image

45
推荐指数
3
解决办法
4万
查看次数

Excel中的CSV十进制点

我有一个带有以下值的cvs:

3271.96;274;272;1;1;0;1;0.071690;0;0;0;0;0;0;1.753130;1.75;0;1.75;
Run Code Online (Sandbox Code Playgroud)

但是当我用Excel打开文件时,我得到了这个:

3271.96 274 272 1   1   0   1   0.071690    0   0   0   0   0   0   1.753.130   1.75    0   1.75
Run Code Online (Sandbox Code Playgroud)

为什么"1.753130"被转换为"1.753.130"?(1.753130是十进制数)我如何"强制"excel来理解那些是十进制数?

我使用Web应用程序创建cvs文件,因此很难修改我的excel配置,因为很多人进入我的网站并将csv文件下载到他们的机器中

提前致谢

csv excel

17
推荐指数
4
解决办法
5万
查看次数

asp.net中有关gridview的大量数据

我有大量的数据(一个包含20000条记录的SQL查询),并且我的数据网格填充了大量的数据需要10分钟,这是我的gridview定义:

<asp:GridView ID="g" runat="server" Height="113px" Width="817px" 
BackColor="White" BorderColor="#999999" BorderStyle="None" BorderWidth="1px" 
CellPadding="3" GridLines="Vertical" AllowPaging="True" Font-Size="Small" 
     PageSize="30">
    <AlternatingRowStyle BackColor="#DCDCDC" />
    <FooterStyle BackColor="#CCCCCC" ForeColor="Black" />
    <HeaderStyle BackColor="#000084" Font-Bold="True" ForeColor="White" />
    <PagerStyle BackColor="#999999" ForeColor="Black" HorizontalAlign="Center" />
    <RowStyle BackColor="#EEEEEE" ForeColor="Black" />
    <SelectedRowStyle BackColor="#008A8C" Font-Bold="True" ForeColor="White" />
    <SortedAscendingCellStyle BackColor="#F1F1F1" />
    <SortedAscendingHeaderStyle BackColor="#0000A9" />
    <SortedDescendingCellStyle BackColor="#CAC9C9" />
    <SortedDescendingHeaderStyle BackColor="#000065" />
    <PagerStyle cssClass="gridpager" HorizontalAlign="Left" />  

</asp:GridView>
Run Code Online (Sandbox Code Playgroud)

如您所见,我已启用AllowPaging属性.

这是我绑定数据的方式:

DataSet dts = new DataSet();
OracleDataAdapter oad = new OracleDataAdapter(query, co.conn);

cmd.CommandText = query;
cmd.CommandType = CommandType.Text;

cmd.CommandText = query; …
Run Code Online (Sandbox Code Playgroud)

c# sql asp.net

5
推荐指数
1
解决办法
2万
查看次数

正确的方法来询问窗口是否在WPF中打开

我在主窗口中有这个点击事件来打开一个新窗口

private void Button_Click(object sender, RoutedEventArgs e)
{
    cm = new CanalesMain();

    cm.Show();

    cm.Canales.setValues();

}
Run Code Online (Sandbox Code Playgroud)

我的cm变量在我的主窗口中定义为成员类,因为我需要每5分钟加载/刷新一次setValues()方法(有一个TimeSpan和一个EventHandler)

问题是,在我的"刷新数据"方法中,我有这个if语句来询问cm变量是否已加载且不为空(我的意思是,如果窗口曾被打开或者如果打开,请询问是否未关闭)

if (cm!=null && cm.IsLoaded)
{
    cm.Canales.setValues();
}
Run Code Online (Sandbox Code Playgroud)

这是询问我的窗户是否打开的正确或最佳方式吗?

c# wpf window

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

Postgres - 基于另一列在列中设置唯一约束

我有一个这样的表:

\n\n
CREATE TABLE schema.mytable\n(\n  id serial NOT NULL,\n  number integer NOT NULL,\n  state boolean NOT NULL,\n);\n
Run Code Online (Sandbox Code Playgroud)\n\n

我需要创建一组唯一的 \xc2\xb4number\xc2\xb4 但是,状态列必须为 true;如果状态列为假,则数字可以重复,这是我需要有效的示例:

\n\n
id  number      state\n1   123         true\n2   124         true\n3   125         true\n4   123         false\n5   129         false\n
Run Code Online (Sandbox Code Playgroud)\n\n

如您所见,数字 123 被重复,但在一种情况下状态为 false,另一种情况为 true;这是不正确的:

\n\n
id  number      state\n1   123         true\n2   124         true\n3   125         true\n4   123         true (*incorrect)\n5   129         false\n
Run Code Online (Sandbox Code Playgroud)\n\n

另外,123也有可能以错误状态重复两次或更多次;我怎样才能实现这个目标?

\n

sql postgresql database-design unique-constraint sql-insert

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

使用asp.net和iis在geoserver中进行身份验证

我不知道这是否是一个愚蠢的问题,但我如何将asp.net身份验证与openlayers"结合"?

我创建了一个登录页面,在openlayers中进行身份验证(在c#,服务器端),这是我的代码

Uri uri = new Uri("http://"+username+":"+password+"@localhost:1979/geoserver/wms");
        if (uri.Scheme == Uri.UriSchemeHttp)
        {
            HttpWebRequest request = (HttpWebRequest)HttpWebRequest.Create(uri);
            request.Method = WebRequestMethods.Http.Post;

            HttpWebResponse response = (HttpWebResponse)request.GetResponse();
            StreamReader reader = new StreamReader(response.GetResponseStream()); string tmp = reader.ReadToEnd();
            response.Close();
            Response.Write(tmp);
        }
Run Code Online (Sandbox Code Playgroud)

我不知道这是否是解决问题的正确方法,无论如何,如果我达到目标(在地理服务器中使用用户名和密码进行身份验证),我该如何将此身份验证与openlayers结合使用,这是在用户端(javascript)

提前致谢

javascript asp.net geoserver openlayers

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

使用 StringFormat 隐藏零值

几个月前我提出了类似的问题

在这种情况下,我有一个像这样的文本块

<TextBlock FontSize="28" Text="{Binding DataPoint.Y, StringFormat=\{0:0\\%\}}" Foreground="Black">
Run Code Online (Sandbox Code Playgroud)

正如你所看到的,我的 StringFormat 在数字后面放置了一个“%”符号,如果我的数据是 0.0(我在后面的代码中填充了组件,我的变量是双精度)我得到“0%”

但现在如果我的文本是 0.0 我想得到“”

到目前为止我有这个:

 Text="{Binding DataPoint.Y, StringFormat=\{0:#.#\\%\}}"
Run Code Online (Sandbox Code Playgroud)

但这检索到“%”,我怎样才能得到“”?

c# wpf textblock string-formatting

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

在oracle中查找重复值

我正在使用此查询在表中查找重复值:

select col1, 
       count(col1) 
  from table1 
 group by col1 
having count (col1) > 1 
 order by 2 desc;
Run Code Online (Sandbox Code Playgroud)

但是我想在同一个表中添加另一个列,如下所示:

select col1, 
       col2, 
       count(col1) 
  from table1 
 group by col1 
having count (col1) > 1 
 order by 2 desc;
Run Code Online (Sandbox Code Playgroud)

我的ORA-00979第二个查询出错了

如何在搜索中添加其他列?

sql oracle

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

在c#中将默认值设置为成员类

我需要为成员类设置一个默认值,这个值可以变化,并在执行开始时设置; 到目前为止我有这个,minScore是我的默认值

public class Zones : GeneralIndicator
{
   public int IndicatorType { get; set; } 
   public string Code { get; set; }
   public string Score { get; set; } //TODO: calcular desde aca el score usando el indicatortype
   public double Latitude { get; set; }
   public double Longitude { get; set; }

   private int minScore = 0;

   public void setMinScore(int value)
   {
      minScore = value;
   }
}
Run Code Online (Sandbox Code Playgroud)

我在调用应用程序时将minScore值作为参数.为运行时生成的每个对象设置minScore的最佳方法是什么?

c# class

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

openlayers中的预测和OpenLayers.Geometry.Point

我正在尝试显示三层地图(谷歌地图图层,wms图层和点图层)这是我的代码:

     var map = new OpenLayers.Map({
         div: "map",
         maxExtent: new OpenLayers.Bounds(-20037508, -20037508, 20037508, 20037508.34)
     });


     var capaGoogle = new OpenLayers.Layer.Google(
                "Google Satellite",
                { type: G_SATELLITE_MAP, sphericalMercator: true, transparent: true }
            );

     var wmsOverlay = new OpenLayers.Layer.WMS("OpenLayers WMS",
         "http://localhost:1979/geoserver/wms",
         { layers: 'world:PYCIUDADES', transparent: true }, { isBaseLayer: false });


     var vectorLayer = new OpenLayers.Layer.Vector("vector");

     vectorLayer.addFeatures([
        new OpenLayers.Feature.Vector(
            new OpenLayers.Geometry.Point(-57.635021, -25.276987)

        ),
        new OpenLayers.Feature.Vector(
            new OpenLayers.Geometry.Point(-56.759034, -22.71539)
        )

        ]

    );

     map.addLayers([wmsOverlay, vectorLayer, capaGoogle]);

     map.addControl(new OpenLayers.Control.LayerSwitcher());
     var center = new OpenLayers.LonLat(-57.58, -25.27).transform(
     new …
Run Code Online (Sandbox Code Playgroud)

javascript openlayers

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