小编B. *_*non的帖子

有些键盘比其他键盘更加啰嗦吗?

首席开发人员表示,当他使用我的应用程序时,当他通过方向箭头键在TableLayoutPanel上的TextBoxes之间移动时,他的键盘会发出蜂鸣声.

但是,我听不到这种听觉活动.

这是我的代码:

// Had to intercept Up and Down arrows from Windows
private void textBoxPlatypi_PreviewKeyDown(object sender, PreviewKeyDownEventArgs e) {
    TextBox tb = (TextBox)sender;

    if (e.KeyCode.Equals(Keys.Up)) {
        SetFocusOneRowUp(tb.Name);
        return;
    }
    if (e.KeyCode.Equals(Keys.Down)) {
        SetFocusOneRowDown(tb.Name);
        return;
    }
}

private void textBoxPlatypi_KeyDown(object sender, KeyEventArgs e) {
    TextBox tb = (TextBox)sender;

    if (e.KeyCode.Equals(Keys.Left)) {
        SetFocusOneColumnBack(tb.Name);
        e.Handled = true;
        return;
    }
    if (e.KeyCode.Equals(Keys.Right)) {
        SetFocusOneColumnForward(tb.Name);
        e.Handled = true;
        return;
    }
}
Run Code Online (Sandbox Code Playgroud)

..他想也许我需要"e.Handled",但这在PreviewKeyDown事件中不可用.

有没有办法抑制哔哔声(这显然只发生在某些键盘或特定设置上(他使用的是Windows7,我还在使用XP))?

UPDATE

我现在有了这个代码:

private void textBoxPlatypus1_PreviewKeyDown(object sender, PreviewKeyDownEventArgs e) {
    switch (e.KeyCode) …
Run Code Online (Sandbox Code Playgroud)

c# keyeventargs beep arrow-keys winforms

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

锚标记上的边框底部填充

我在标题中有一个锚标记,我试图在锚标记上放置一个边框底部,这有效,但是底部的填充太大而负填充不起作用,我该如何解决这个问题呢?

直播现场

HTML

<div id="featureText">
        <h1>Recent Works / <a href="#">All</a></h1>
    </div>
Run Code Online (Sandbox Code Playgroud)

CSS

#featureText a {
    color: #414042;
    text-decoration: none;
    border-bottom: solid 2px #414042;
    padding-bottom: -2px; }
Run Code Online (Sandbox Code Playgroud)

css header border padding

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

为什么我的img错误函数失败了?

我动态构建的一些img元素可能(do)失败.对于这些情况,我从这里得到了一些代码:有没有办法以编程方式确定图像链接是坏的?即:

    function getNatlBookCritics() {
        var htmlBuilder = '';

        // Doesn't do diddly-squat - wrong spot for it?
        $('img').error(function () {
            $(this).attr("src", "Content/NoImageAvailable.png");
        });

        $.getJSON('Content/NBCCJr.json', function (data) {
            $.each(data, function (i, dataPoint) {
    . . .
Run Code Online (Sandbox Code Playgroud)

......但它不起作用.Warum nicht?

UPDATE

将此代码放在$ .getJSON()调用的.each部分中:

var jObject = $('<img src=\"' + dataPoint.imghref + '\"/>');
$(jObject).error(function () {
    $(this).attr("src", "Content/NoImageAvailable.jpg");
});
Run Code Online (Sandbox Code Playgroud)

...... 所有图像都失败了.dataPoint.imghref包含以下值:

http://www.amazon.com/exec/obidos/ASIN/B00655KLOY/garrphotgall-20
Run Code Online (Sandbox Code Playgroud)

更新2

在一个坚果地狱,我正在添加"img src",如下所示:

function getNatlBookCritics() {
    var htmlBuilder = '';
    $.getJSON('Content/nbcc.json', function (data) {
        $.each(data, function (i, dataPoint) { …
Run Code Online (Sandbox Code Playgroud)

html javascript jquery razor asp.net-webpages

7
推荐指数
2
解决办法
2847
查看次数

当首选(外部/服务器/远程/云)映像无法加载时,有没有办法提供回退(本地)映像?

我有这样的锚标签:

<a href=\"http://www.duckbill.com" target=\"_blank\"><img height=\"160\" width=\"160\" src=\"http://images.duckbill.com/PlatypiOnVacation.jpg\" alt=\"Platypi playing Pinochle and eating Pizza in Panama\" /></a>
Run Code Online (Sandbox Code Playgroud)

...有时无法加载src图像; 在这种情况下,我想在经过足够的延迟(几秒钟)后,将其替换为:

<a href=\"http://www.duckbill.com" target=\"_blank\"><img height=\"160\" width=\"160\" src=\"Content/Images/PlatypiOnVacation.jpg\" alt=\"Platypi playing Pinochle and eating Pizza in Panama\" /></a>
Run Code Online (Sandbox Code Playgroud)

我知道我可以在jQuery中做到这一点,但是我怎么能够以编程方式确定远程文件没有加载,在这种情况下,使用回退图像进行响应?

UPDATE

我喜欢Brad Christie对真正不可用的图像的回答,但我想永远不要显示"不可用" - 如果目前还没有远程的那个,只需使用本地的.我喜欢这个:http://www.cirkuit.net/projects/jquery/onImagesLoad/example1.html但是如何以编程方式确定图像失败?

html jquery

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

对于这个VS 2013例外,我能做什么/应该做什么?

在加载我的ASP.NET应用程序/站点时,我得到了这个错误信息:"遇到异常.这可能是由扩展引起的."

然后它说看这个文件:

C:\ Users \用户克莱\应用程序数据\漫游\微软\ VisualStudio的\ 11.0\ActivityLog.xml

...我确实找到了可能与问题有关的三个条目,但它们是"希腊语".由于它们的大量,我只是在这里包括第一个:

  <entry>
    <record>676</record>
    <time>2013/10/22 13:52:50.109</time>
    <type>Error</type>
    <source>Editor or Editor Extension</source>
    <description>System.ComponentModel.Composition.CompositionException: The composition produced a single composition error, with 2 root causes. The root causes are provided below. Review the CompositionException.Errors property for more detailed information.&#x000D;&#x000A;&#x000D;&#x000A;1) The export &apos;Microsoft.VisualStudio.Shell.SVsServiceProvider&apos; is not assignable to type &apos;System.Void&apos;.&#x000D;&#x000A;&#x000D;&#x000A;Resulting in: Cannot set import &apos;Microsoft.VisualStudio.JavaScript.Web.Extensions.Shared.RegistryManager.VsServiceProvider (ContractName=&quot;Microsoft.VisualStudio.Shell.SVsServiceProvider&quot;)&apos; on part &apos;Microsoft.VisualStudio.JavaScript.Web.Extensions.Shared.RegistryManager&apos;.&#x000D;&#x000A;Element: Microsoft.VisualStudio.JavaScript.Web.Extensions.Shared.RegistryManager.VsServiceProvider (ContractName=&quot;Microsoft.VisualStudio.Shell.SVsServiceProvider&quot;) --&gt;  Microsoft.VisualStudio.JavaScript.Web.Extensions.Shared.RegistryManager&#x000D;&#x000A;&#x000D;&#x000A;Resulting in: Cannot get export &apos;Microsoft.VisualStudio.JavaScript.Web.Extensions.Shared.RegistryManager (ContractName=&quot;Microsoft.VisualStudio.JavaScript.Web.Extensions.Shared.IRegistryManager&quot;)&apos; from part &apos;Microsoft.VisualStudio.JavaScript.Web.Extensions.Shared.RegistryManager&apos;.&#x000D;&#x000A;Element: Microsoft.VisualStudio.JavaScript.Web.Extensions.Shared.RegistryManager (ContractName=&quot;Microsoft.VisualStudio.JavaScript.Web.Extensions.Shared.IRegistryManager&quot;) --&gt;  Microsoft.VisualStudio.JavaScript.Web.Extensions.Shared.RegistryManager&#x000D;&#x000A;&#x000D;&#x000A;Resulting in: Cannot …
Run Code Online (Sandbox Code Playgroud)

asp.net visual-studio-2013

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

为什么我的WPF应用程序中出现"无法加载DLL'sqlite3'"?

我添加了我认为必要的SQLite(和sqlite-net)包到我的应用程序.但是,在运行它时,我得到一个例外:

System.DllNotFoundException未被用户代码处理HResult = -2146233052消息=无法加载DLL的'sqlite3':找不到指定的模块.(例外

我安装了以下SQLite包:

在此输入图像描述

缺什么?

UPDATE

我尝试了ajawad987的建议,但仍然得到相同的运行时错误,即使我有这个:

在此输入图像描述

...还有这个:

在此输入图像描述

更新2

发生这个运行时异常的地方(在SQLite.cs中)对我来说似乎很奇怪:

如果SILVERLIGHT || USE_CSHARP_SQLITE

        var r = SQLite3.Open (databasePath, out handle, (int)openFlags, IntPtr.Zero);
Run Code Online (Sandbox Code Playgroud)

其他

        // open using the byte[]
        // in the case where the path may include Unicode
        // force open to using UTF-8 using sqlite3_open_v2
        var databasePathAsBytes = GetNullTerminatedUtf8 (DatabasePath);
        var r = SQLite3.Open (databasePathAsBytes, out handle, (int) openFlags, IntPtr.Zero);
Run Code Online (Sandbox Code Playgroud)

万一

但是我正在使用C#,那么为什么线路甚至无法运行呢?(它在"else"块中失败了)?

sqlite wpf runtime-packages nugetgallery visual-studio-2013

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

如何让SSRS和Chrome协同工作?

Chrome是我首选的浏览器; 但是,我需要与SQL Server Reporting Services进行交互,当我导航到使用Report Builder(*.rdl文件)创建的报表时,在Chrome中我没有上下文菜单.当鼠标悬停在报告上时,它会"亮起"(在它周围绘制一个黄色边框),并在NE角落出现一个下拉箭头,但点击它不会做任何事情.

在IE中,它工作得很好.但是,如果我不需要,我真的不想使用IE.

Sharepoint有类似的问题(在Chrome和Firefox中无法完成的事情在IE中运行良好).我是否只需要"咬紧牙关"并在与Microsoft产品接口时使用IE,或者是否有办法从Chrome使用SSRS?

google-chrome reportbuilder cross-browser rdl reporting-services

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

如何使用 Bing 地图检索邮政地址的纬度和经度?

我希望能够检索给定地址的地理坐标(纬度和经度)。如果我有完整的地址(街道地址 + 城市 + 州 + 邮政编码),我希望我能做到这一点。

如果重要的话,我正在使用 Bing 地图。我得到的骨架代码是这样的(fullAddress、AddPushpin() 和 getGeoCordsForAddress() 是最相关的部分):

private void btnSave_Click(object sender, EventArgs e)
{
    string fullAddress = string.Empty;
    if (MissingValues()) return;    

    mapName = cmbxMapName.SelectedItem.ToString();
    locationName = txtbxLocation.Text;
    address = txtbxAddress.Text;
    city = txtbxCity.Text;
    st8 = txtbxSt8.Text;
    zip = txtbxZip.Text;
    mapDetailNotes = richtxtbxMapNotes.Text;
    fullAddress = string.Format("{0} {1} {2} {3}", address, city, st8, zip);

    if (InsertIntoCartographerDetail())
    {
        MessageBox.Show("insert succeeded"); 
        AddPushpin(fullAddress);
        ClearControls();
    }
    else
    {
        MessageBox.Show("insert failed");
    }        
}

private void AddPushpin(string fullAddress)
{
    GeoCoordinate geoCoord = …
Run Code Online (Sandbox Code Playgroud)

c# wpf geo bing-maps winforms

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

升级到MVC 5和Web API 2后,如何让我的Web API应用程序再次运行?

我使用此指南将Web API应用程序升级到funkelnagelneu版本:

http://www.asp.net/mvc/tutorials/mvc-5/how-to-upgrade-an-aspnet-mvc-4-and-web-api-project-to-aspnet-mvc-5-and- Web的API-2

然而,在完成这些步骤之后(似乎所有这些都应该是自动化的,无论如何),我试图运行它并得到," 无法直接启动具有类库的输出类型的项目 "

什么Sam Hills Brothers Coffee正在这里发生什么?谁说这是一个班级图书馆?

所以我打开了Project> Properties,并对其进行了更改(由于某种原因,它标记为"类库" - 它要么不是昨天,要么工作正常)到"Windows应用程序"的输出类型("控制台应用程序")和"类库"是唯一的其他选项).

现在它不会编译,抱怨:" 程序'c:\ Platypus_Server_WebAPI\PlatypusServerWebAPI\PlatypusServerWebAPI\obj\Debug\PlatypusServerWebAPI.exe'不包含适用于入口点的静态'Main'方法...... "

鉴于这种困境,如何让我的Web API应用程序重新启动并运行?

UPDATE

查看packages.config,两个条目看起来很划伤:

<package id="Microsoft.AspNet.Providers" version="1.2" targetFramework="net40" />
<package id="Microsoft.Web.Infrastructure" version="1.0.0.0" targetFramework="net40" />
Run Code Online (Sandbox Code Playgroud)

所有其他人都以net451为目标.这可能是问题吗?我应该删除这些包吗?

更新2

我尝试通过NuGet包管理器卸载Microsoft.Web.Infrastructure包(它的描述让我相信我不需要它;而且,它没有依赖性),但它告诉我," NuGet无法安装或卸载以下项目中的选定包.[我的] "

更新3

我再次走了几步,发现我错过了一步.我不得不在Application web.config文件中更改此条目:

<dependentAssembly>
    <assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35" />
    <bindingRedirect oldVersion="1.0.0.0-5.0.0.0" newVersion="5.0.0.0" />
</dependentAssembly>
Run Code Online (Sandbox Code Playgroud)

(从"4.0.0.0"到"5.0.0.0")

...但我仍然得到相同的结果 - 它重建/编译,但不会运行," 具有类库的输出类型的项目无法直接启动 "

更新4

考虑到错误信息,它不能直接打开一个类库,我想,"当然你不能/不会 - 这是一个网络应用程序,而不是一个项目.所以我跟着预感,关闭了项目,并重新打开它作为一个网站(而不是重新开放项目).

这让我更进一步,至少; 现在我看到了一个YSOD:

无法加载文件或程序集'System.Web.WebPages.Razor,Version = 3.0.0.0,Culture = neutral,PublicKeyToken = 31bf3856ad364e35'或其依赖项之一.该系统找不到指定的文件.

更新5

注意:该项目现在(在作为网站打开后)名为"localhost_48614"

并且...不再有"引用"文件夹......?!?!?

至于那个YSOD,我正在获得官方指示(http://www.asp.net/mvc/tutorials/mvc-5/how-to-upgrade-an-aspnet-mvc-4-and-web-api -project-to-aspnet-mvc-5-and-web-api-2)说这样做,我引用:

" …

c# asp.net upgrade asp.net-web-api visual-studio-2013

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

如何以编程方式从App.xaml访问资源字符串?

我有一些我想从App.xaml中的代码访问的字符串,如:

<Application.Resources>
    <ai:TelemetryContext x:Key="ApplicationInsightsBootstrapper" xmlns:ai="using:Microsoft.ApplicationInsights"/>
    <ResourceDictionary x:Key="rd">
        <ResourceDictionary.MergedDictionaries>
            <ResourceDictionary Source="GlobalStylesResourceDictionary.xaml"/>
        </ResourceDictionary.MergedDictionaries>
        <!-- Application-specific resources. -->
        <x:String x:Key="AppName">Platypus</x:String>
        <x:String x:Key="BingMapsNamespace">http://schemas.microsoft.com/search/local/ws/rest/v1</x:String>
    </ResourceDictionary>
</Application.Resources>
Run Code Online (Sandbox Code Playgroud)

我想以编程方式获取这些值,所以我编写了这个实用程序函数:

internal static String GetResourceString(String keyStr)
{
    var resldr = new Windows.ApplicationModel.Resources.ResourceLoader();
    return resldr.GetString(keyStr);
}
Run Code Online (Sandbox Code Playgroud)

但如果失败," 在Platypus.exe WinRT信息中发生了'System.Exception'类型的第一次机会异常:找不到ResourceMap. "

我以为我在这里找到了问题的解决方案,据说这样做的方式已被弃用,我应该这样做:

internal static String GetResourceString(String keyStr)
{
    try
    {
        //var resldr = new Windows.ApplicationModel.Resources.ResourceLoader();
        //return resldr.GetString(keyStr);
        var resldr = ResourceLoader.GetForCurrentView();
        return resldr.GetString(keyStr);
    }
    catch (Exception ex)
    {
        Debug.WriteLine("Something wrong with the keyStr? Exception in GetResourceString(): {0}", ex.Message); 
    } …
Run Code Online (Sandbox Code Playgroud)

c# resourcedictionary app.xaml winrt-xaml windows-store-apps

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