小编jac*_*nad的帖子

C#Winforms:如何使返回按发送?

如何保持焦点textBox但键盘返回键按下发送按钮? 在此输入图像描述

c# winforms

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

有没有办法使用2-3 mbps的串口?

我需要以2-3 mbps的速度向C#Windows PC应用程序传输串行数据.C#winforms似乎对此并不满意.

openFileDialog.Filter =
    @"Image Files(*.bmp;*.jpg;*.jpeg;*.gif)|*.bmp;*.jpg;*.jpeg;*.gif|All files (*.*)|*.*";
if (openFileDialog.ShowDialog() != DialogResult.OK) return;
var image = Image.FromFile(openFileDialog.FileName);
serialPort1.Open();
// Now send the image at 2-3 mbps
...
Run Code Online (Sandbox Code Playgroud)

BaudRate = 115200有效.BaudRate = 230400导致System.IO.IOException.

在此输入图像描述

c# serial-port

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

Android蓝牙java.io.IOException:连接被拒绝了?

我需要使用SPP 将KwikBlue-2模块开发套件连接到Nexus One上的Android BluetoothChat示例.在将BluetoothChat示例示例中的UUID更改为SPP设备的00001101-0000-1000-8000-00805F9B34FB 之后,我能够使用tera术语连接和交换串行数据(一次).然后我循环使用KwikBlue-2模块开发套件来验证连接是否可重复,但java.io.IOException: Connection refused在我尝试连接时不断获得 .有任何想法吗?

43.200: ERROR/BluetoothEventLoop.cpp(96): event_filter: Received signal org.bluez.Adapter:PropertyChanged from /org/bluez/219/hci0
52.200: ERROR/BluetoothChat(707): - ON PAUSE -
54.470: ERROR/BluetoothService.cpp(96): stopDiscoveryNative: D-Bus error in StopDiscovery: org.bluez.Error.Failed (Invalid discovery session)
54.520: ERROR/BluetoothChat(707): + ON RESUME +
54.530: ERROR/BluetoothService.cpp(96): stopDiscoveryNative: D-Bus error in StopDiscovery: org.bluez.Error.Failed (Invalid discovery session)
54.620: ERROR/BluetoothService.cpp(96): stopDiscoveryNative: D-Bus error in StopDiscovery: org.bluez.Error.Failed (Invalid discovery session)
55.520: ERROR/BluetoothEventLoop.cpp(96): event_filter: Received signal org.bluez.Device:PropertyChanged from /org/bluez/219/hci0/dev_00_60_57_FD_42_18
56.010: ERROR/BluetoothChatService(707): …
Run Code Online (Sandbox Code Playgroud)

java android bluetooth

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

提升deadline_timer不等

我尝试在这个简单的测试应用程序中使用boost deadline_timer,但遇到了一些麻烦.目标是定时器使用expires_at()成员函数每45毫秒触发一次deadline_timer.(我需要一个绝对的时间,所以我不考虑expires_from_now().我现在也不关心漂移).当我运行程序时,wait()不等待45毫秒!然而,没有报告错误.我是否以某种方式错误地使用了库?

示例程序:

#include <boost/asio.hpp>
#include <boost/thread.hpp>
#include <boost/bind.hpp>
#include <boost/date_time/posix_time/posix_time.hpp>
#include <iostream>
using namespace std;

int main()
{
        boost::asio::io_service Service;
        boost::shared_ptr<boost::thread> Thread;
        boost::asio::io_service::work RunForever(Service);
        Thread = boost::shared_ptr<boost::thread>(new boost::thread(boost::bind(&boost::asio::io_service::run, &Service)));
        boost::shared_ptr<boost::asio::deadline_timer> Timer(new boost::asio::deadline_timer(Service));

        while(1)
        {
                boost::posix_time::time_duration Duration;
                Duration = boost::posix_time::microseconds(45000);
                boost::posix_time::ptime Start = boost::posix_time::microsec_clock::local_time();
                boost::posix_time::ptime Deadline = Start + Duration;
                boost::system::error_code Error;
                size_t Result = Timer->expires_at(Deadline, Error);
                cout << Result << ' ' << Error << ' ';
                Timer->wait(Error);
                cout << Error …
Run Code Online (Sandbox Code Playgroud)

c++ boost boost-asio deadline-timer

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

如何拉伸位图以填充PictureBox

我需要拉伸各种大小的位图来填充PictureBox. PictureBoxSizeMode.StretchImage有点做我需要的但却无法想到使用这种方法正确地向图像添加文本或线条的方法.下图是一个5x5像素的位图,延伸到380x150 PictureBox.

使用pictureBox.SizeMode = PictureBoxSizeMode.StretchImage

pictureBox.SizeMode = PictureBoxSizeMode.StretchImage;
pictureBox.Image = bmp;
Run Code Online (Sandbox Code Playgroud)

我尝试用这种方式调整这个例子这个例子

using (var bmp2 = new Bitmap(pictureBox.Width, pictureBox.Height))
using (var g = Graphics.FromImage(bmp2))
{
    g.InterpolationMode = InterpolationMode.NearestNeighbor;
    g.DrawImage(bmp, new Rectangle(Point.Empty, bmp2.Size));
    pictureBox.Image = bmp2;
}
Run Code Online (Sandbox Code Playgroud)

但得到这个

使用g.DrawImage(bmp,new Rectangle(Point.Empty,bmp2.Size))

我错过了什么?

c# bitmap picturebox winforms

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

如何配置RabbitVCS?

我在Ubuntu 11.10上安装了rabbitvcs-core和rabbitvcs-nautilus.我有我们的SVN服务器的IP地址,并且从Windows 7 PC使用TortiseSVN没有问题.如何配置RabbitVCS以创建工作目录并使用我们的SVN服务器?我在RabbitVCS FAQ或docs中找不到任何内容.

svn ubuntu rabbitvcs

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

如何将FreeImage.dll添加到C#项目

我已经成功地将其他.dll文件添加到其他C#项目中:

Right click Reference > Add Reference > Browse > Double click the .dll file

但Microsoft Visual Studio 2008发出以下投诉:

A reference to ...\dll\FreeImage.dll could not be added. Please make sure that the file is accessible, and that it is a valid assembly or COM component.

我正在使用.NET Framework 3.5.我相信这是一个32位的dll(它是用FreeImage3151Win32下载的)所以我把项目的配置更改为x86.

将FreeImage.dll添加到C#项目的正确方法是什么?

c# visual-studio-2008

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

如何设置按键按键绑定?

此应用程序的箭头键需要使独立于焦点的按下和释放事件.设置onKeyRelease true会导致预期的释放事件,但设置onKeyRelease false(下面的代码)似乎不会停止自动重复.当按住箭头键时,有没有办法实现键绑定触发一次?

Action right = new AbstractAction() {
    public void actionPerformed(ActionEvent e) {
        ...
    }
};
mainPanel.getInputMap(JPanel.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT)
        .put(KeyStroke.getKeyStroke(KeyEvent.VK_RIGHT, 0, false), "right");
mainPanel.getActionMap().put("right", right);
Run Code Online (Sandbox Code Playgroud)

java swing keystroke keyevent key-bindings

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

如何设置gdb调试器连接?

这里的说明显示了如何创建调试配置,但似乎是基于不同版本的eclipse.如何在eclipse-indigo中配置gdb调试器连接(TCP/IP地址和端口号)?我看到Network ConnectionsEdit Configuration -> Configure Workspace Settings -> General...,但没有办法添加TCP/IP地址和端口号.

eclipse debugging gdb eclipse-indigo

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

有没有办法锁定GIT标签?

我希望能够锁定GIT标记,以便无法移动或删除它以进行产品发布控制.我认为我可以使用基于文档的轻量级标记执行此操作,但通过实验发现轻量级标记也可以移动.

git git-tag

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