我正在尝试MSDN使用PrintDocument打印的例子,但它并不是那么顺利.我已经完成了所有编译,但是当我点击打印时,会弹出"传真发送设置"窗口.这应该发生吗?我想打印,而不是发传真!
我需要更改什么才能直接打印到默认打印机?
谢谢!
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.IO;
using System.Drawing.Printing;
namespace WindowsFormsApplication1
{
public partial class Form4 : System.Windows.Forms.Form
{
private System.ComponentModel.Container components;
private System.Windows.Forms.Button printButton;
private Font printFont;
private StreamReader streamToPrint;
public Form4()
{
// The Windows Forms Designer requires the following call.
InitializeComponent();
}
// The Click event is raised when the user clicks the Print button.
private void printButton_Click(object sender, EventArgs e) …
Run Code Online (Sandbox Code Playgroud) 当我选择任何仿真器时,都会收到这个奇怪的旧红色电话。屏幕超小,我什么也看不到。我尝试搜索,但似乎没有其他人遇到过此问题。有人认识吗?我的模拟器运行正常,但由于Android Studio损坏,我不得不卸载并重新安装。重新安装后,这就是发生的事情:/
我的类型看起来像这样:
var x = function(){
this.y = function(){
}
this.z = function(){
...
this.A = function(){
CALLING POINT
}
}
}
Run Code Online (Sandbox Code Playgroud)
从呼叫点,我试图调用函数this.y. 我不需要传递任何参数,但是当我从this.A设置一些东西时,我需要调用this.y.
这可能吗?我可以将额外的参数传递给函数以使其成为可能.
我正在使用 16 位 NASM 程序集,但存在无法构建代码的问题。错误发生在此处的所有 MOV 行上:
section .bss
x_coord RESB 8 ; [x_coord] is the head, [x_coord+2] is the next cell, etc.
y_coord RESB 8 ; Same here
pixel_x RESB 2 ; Storage for calculations
pixel_y RESB 2 ; Storage for calculations
...
MOV [pixel_x], [x_coord]
MOV [pixel_y], [y_coord]
CALL DrawPixel
MOV [pixel_x], [x_coord+2]
MOV [pixel_y], [y_coord+2]
CALL DrawPixel
MOV [pixel_x], [x_coord+4]
MOV [pixel_y], [y_coord+4]
CALL DrawPixel
MOV [pixel_x], [x_coord+6]
MOV [pixel_y], [y_coord+6]
CALL DrawPixel
Run Code Online (Sandbox Code Playgroud)
我读到这是因为汇编程序不知道变量的大小。我尝试MOV [pixel_x], byte …
我希望将一些客户数据存储在内存中,我认为最好的方法是使用一组记录.我不确定这是否是它在C#中所称的,但基本上我可以调用Customer(i).Name
并将客户名称作为字符串返回.在图灵,它的完成如下:
type customers :
record
ID : string
Name, Address, Phone, Cell, Email : string
//Etc...
end record
Run Code Online (Sandbox Code Playgroud)
我已经搜索过,但我似乎无法找到C#的等价物.有人能指出我正确的方向吗?
谢谢!:)
正如我之前的问题所建议的那样,存储客户数据的最佳方式是在类实例列表中(我认为这就是所谓的:p).我已经var customers = new List<Customer>();
在一个启动方法中创建了列表,然后,当我将任何值从文本文件加载到程序中时,我这样做:
static void loadData() //Load data from Database
{
customers.Add(new Customer
{
ID = "001",
Name = "Nathan",
}
}
Run Code Online (Sandbox Code Playgroud)
我知道我没有正确地做到这一点,我无法弄清楚正确的方法.现在我没有从文件中提取,我只是想在列表中添加一些东西.显然我错过了一个右括号,但我不太确定它会去哪里.
如果有人可以帮助我在这个列表中添加一个东西,我应该能够自己弄清楚其余部分.
谢谢!:)
我可以在这样的实例上定义一个方法:
object = Object.new
def object.foo
puts "5"
end
Run Code Online (Sandbox Code Playgroud)
尝试与a类似的东西Fixnum
不起作用:
def 3.foo
puts "3"
end
def 3.foo
^
(irb):7: syntax error, unexpected keyword_end, expecting end-of-input
Run Code Online (Sandbox Code Playgroud)
这是什么原因?
我知道这是我永远不应该做的事情.我只是想知道为什么这不像我预期的那样工作.
我已经尝试过对这个主题进行一些研究,但信息量却令人惊讶.我有一个switch语句,如果其中一个条件为真,我想要触发某个块.我可以用相同的块来检查每个条件,但它看起来有点多余.
case KeyEvent.VK_NUMPAD0:
//Identical Code
break;
case KeyEvent.VK_INSERT:
//Identical Code
break;
Run Code Online (Sandbox Code Playgroud)
有没有办法结合这两个语句,以避免重复相同的代码?