小编Hel*_*der的帖子

如何禁止编辑文本框?

我想用一个文本框来显示一些文字.我无法禁用它,因为滚动条将无法正常工作.

如何防止在多行文本框中进行编辑,但是使其看起来好像已启用,以便滚动条正常工作?

c# textbox winforms

60
推荐指数
4
解决办法
14万
查看次数

htaccess不起作用 - 总是密码错误

我正在尝试密码保护目录,并在目录中有两个文件应该密码保护它:

  • 的.htaccess
  • htpasswd的

.htaccess中:

###Contents of .htaccess:
AuthUserFile /var/www/html/path/to/my/directory/.htpasswd
AuthName "Protected Files"
AuthType Basic
Require user admin
Run Code Online (Sandbox Code Playgroud)

HTPASSWD:

###Contents of .htpasswd
admin:oxRHPuqwKiANY
Run Code Online (Sandbox Code Playgroud)

密码也是管理员,但无论我尝试什么密码,总是错误的.它立即再次要求输入密码!

这个配置有什么问题?

.htaccess login password-protection .htpasswd

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

如果选中/取消选中复选框,则启用/禁用提交按钮?

如何在我的HTML表单中启用提交按钮,如果未选中复选框则禁用?

这段代码有什么问题?

EnableSubmit = function(val)
{
    var sbmt = document.getElementById("Accept");

    if (val.checked == true)
    {
        sbmt.disabled = false;
    }
    else
    {
        sbmt.disabled = true;
    }
}                       
Run Code Online (Sandbox Code Playgroud)

复选框

<td width="30%">Do you accept Terms of Service agreement?</td>
<td width="10px" style="min-width: 10px"></td>
<td width="70%">
    <input type="checkbox" name="TOS" value="Accept" onClick="EnableSubmit"> I agree to Terms of Service agreement.
</td>
Run Code Online (Sandbox Code Playgroud)

html javascript forms validation

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

StatusStrip涵盖了停靠的多行文本框

我有一个表单,其中我有多个行文本框和状态条都停靠在窗体的底部.

文本框必须停靠,以便在整个表单可调整大小时可以调整大小.

问题是状态条覆盖了从覆盖滚动条向下箭头底部的文本框.

有没有办法让文本框停靠在底部,同时仍然显示在状态栏上方?

问候.

c# textbox statusstrip winforms

12
推荐指数
3
解决办法
6823
查看次数

为什么要写一个std :: string给cout导致一个未知的运算符<<错误?

我尝试从我的一个方法输出返回值时收到错误:

Error: No operator "<<" matches these operands. Operand types are: std::ostream << std::string
Run Code Online (Sandbox Code Playgroud)

Main.cpp的

#include <iostream>
using namespace std;

#include "Book.h"

int main()
{
    book.setTitle("Advanced C++ Programming");
    book.setAuthorName("Linda", "Smith");
    book.setPublisher("Microsoft Press", "One Microsoft Way", "Redmond");
    book.setPrice(49.99);

    cout << book.getBookInfo(); // <-= this won't compile because of the error above.

    int i;
    cin >> i;

    return 0;
};
Run Code Online (Sandbox Code Playgroud)

应该返回字符串的方法:

string Book::getBookInfo()
{
    stringstream ss;
    ss << title << endl << convertDoubleToString(price) << endl;

    return ss.str();
}
Run Code Online (Sandbox Code Playgroud)

c++ cout

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

如何在多行文本框中不断滚动到文本末尾?

我正在使用计时器更新文本框.每次计时器滴答我都被重定向到我的多行文本框中键入的文本的开头.

这该怎么做?

c# textbox winforms

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

当我到达无法访问的IP时如何更快地ping通?

我有一个ping IP或IP范围的应用程序.问题是当主机关闭时,ping它比打开它需要更长的时间.当主机关闭时,ping的时间约为1-2秒.

主机关闭后如何让它更快?

这是我的代码:

using System;
using System.Text;
using System.Windows.Forms;
using System.Net.NetworkInformation;

namespace Range_Pinger
{
    public partial class PingIPRange : Form
    {
        uint startIP, endIP, currentIP;
        int count = 0;
        int open = 0;
        int closed = 0;

        public PingIPRange()
        {
            InitializeComponent();

            tmrPingInterval.Tick += new EventHandler(tmrPingInterval_Tick);
        }

        void tmrPingInterval_Tick(object sender, EventArgs e)
        {
            if (txtTo.Text == string.Empty) Ping(ip2str(startIP));
            else
            {
                if (currentIP >= endIP) tmrPingInterval.Stop();
                Ping(ip2str(currentIP));
                currentIP++;
            }

            count++;

            tsslPingCount.Text = "Total number of pings: " + count.ToString() + 
                " …
Run Code Online (Sandbox Code Playgroud)

c# ping winforms

8
推荐指数
2
解决办法
9103
查看次数

什么时候应该使用Using语句?

很多人在SO上指出我应该using更频繁地使用陈述.所以我在练习.

问题是我无法决定何时使用它以及何时不使用它.当我认为我应该使用它时,我会收到错误,例如在这个例子中(PS.HashPhrase是我创建的类):

        using (HashPhrase hash = new HashPhrase())
        {
            connection.ConnectionString =
                "Provider=Microsoft.ACE.OLEDB.12.0;" +
                "Data Source=" + filePath + ";" +
                "Persist Security Info=False;" +
                "Jet OLEDB:Database Password=" + hash.ShortHash(pass) + ";";
        }
Run Code Online (Sandbox Code Playgroud)

但它给了我一个错误: 'Password_Manager.HashPhrase': type used in a using statement must be implicitly convertible to 'System.IDisposable'

但在这个例子中它工作正常:

    using (OleDbConnection connection = new OleDbConnection())
    {
        connection.ConnectionString =
            "Provider=Microsoft.ACE.OLEDB.12.0;" +
            "Data Source=" + filePath + ";" +
            "Persist Security Info=False;" +
            "Jet OLEDB:Database Password=" + hash.ShortHash(pass) + ";";

        using (OleDbCommand …
Run Code Online (Sandbox Code Playgroud)

c# using-statement

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

如果图片与侧面对齐,请在图片下方移动文字

我有图像和文字.图像向左对齐,因为我希望文本在图像旁边.图像和文字都在<p></p>.

现在.我想插入在前面的文字和图片下显示的其他文字.

这该怎么做?

一些代码:

<p><img src="image.gif" align="left" width="300" height="200"> Good paragraph of text</p>
<p>Text that I want to appear below the text and the image above</p>
Run Code Online (Sandbox Code Playgroud)

html css alignment

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

如何在图片旁边放置文字?

我想放置2张图片,一张放在页面顶部,另一张放在页面下面.然后,我想写一些关于每张图片的内容,我希望文本位于每张图片的右侧.

如何才能做到这一点?

我正在格式化我的图片如下,但问题是图片就像他们想象的那样,但文本看起来只是第一张图片.

<p style="float: left; clear: left"><img src="image.jpg" height="200px" width="200px" border="1px"></p>
<p>Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text</p>
<p style="float: left; clear: left"><img src="image.jpg" height="200" width="200" border="1px"></p>
<p>Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text</p>
Run Code Online (Sandbox Code Playgroud)

html css text image paragraph

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