使用Microsoft Excel 2010,我注意到可以插入到文档中的两种控件:表单控件和ActiveX控件.
他们之间有什么区别?
我正在使用ReactiveFormsModule
Angular2来创建包含表单的组件.这是我的代码:
foo.component.ts:
constructor(fb: FormBuilder) {
this.myForm = fb.group({
'fullname': ['', Validators.required],
'gender': []
});
}
Run Code Online (Sandbox Code Playgroud)
foo.component.html(with [formControl]
):
<div class="fields">
<div class="field">
<label>Fullname*</label>
<input type="text" [formControl]="myForm.controls.fullname"/>
</div>
</div>
<div class="inline fields">
<label for="gender">Gender</label>
<div class="field">
<div class="ui radio checkbox">
<input type="radio" name="gender" checked="" tabindex="0" class="hidden" [formControl]="myForm.controls.gender">
<label>Male</label>
</div>
</div>
<div class="field">
<div class="ui radio checkbox">
<input type="radio" name="gender" tabindex="0" class="hidden" [formControl]="myForm.controls.gender">
<label>Female</label>
</div>
</div>
</div>
Run Code Online (Sandbox Code Playgroud)
foo.component.html(with formControlName
):
<div class="fields">
<div class="field">
<label>Fullname*</label>
<input type="text" …
Run Code Online (Sandbox Code Playgroud) radio-button form-control angular2-forms angular2-formbuilder angular
我是angular4的新手,这是我的组件:
@Component( {
selector: 'input-extra-field',
template: `
<div class="form-group" [formGroup]="formGroup" >
<switch [attr.title]="field.etiquette"
[attr.value]="field.valeur" [(ngModel)]="field.valeur"
[formControl]="fieldControl" [attr.id]="name" [attr.disabled]="disabled">
</switch>
<error-messages [control]="name"></error-messages>
</div>
`
} )
Run Code Online (Sandbox Code Playgroud)
这是我的班级:
export class SwitchExtraField extends ExtraField {
@Input() field: ExtraFormField;
@Input() entity: { fields: Object };
@Input() formGroup: FormGroup;
constructor( formDir: NgForm ) {
super( null, null, formDir );
}
get disabled(): string {
if ( this.field && !!this.field.saisissable && !this.field.saisissable ) {
return 'disabled';
}
return null;
}
}
Run Code Online (Sandbox Code Playgroud)
这是我在编译时得到的错误:
ERROR Error: No value …
Run Code Online (Sandbox Code Playgroud) 我可以收听什么窗口消息或事件,以阻止窗口重绘其每个像素的大小?
也就是说,当用户点击窗口的边缘并开始重新调整大小时,我不想重新绘制整个内容,直到他放开为止.这是因为出于某种原因,它目前在调整大小时可能会因为一切都重新对接而不是重新对齐.
我尝试了WM_SIZING,但这只是告诉我它正在重新调整大小,我想知道大小的开始和结束,所以我可以暂停布局,直到用户停止调整大小.
我正在使用Angular2-rc5,我目前在登录页面上收到错误.我正在尝试创建一个表单,但是控制台抛出异常告诉我formcontroll
即使我在init上创建它也无法找到我的s.知道我为什么会收到这个错误吗?
登录组件
import { Component, OnInit } from '@angular/core';
import { FormGroup, FormControl, FormBuilder, Validators } from '@angular/forms';
import { LoginService } from './login.service';
import { User } from '../../models/user';
@Component({
selector: 'login',
providers: [LoginService],
templateUrl: './login.component.html',
styleUrls: ['./login.component.css']
})
export class LoginComponent implements OnInit {
private loginForm: FormGroup; // our model driven form
private submitted: boolean; // keep track on whether form is submitted
private events: any[] = []; // use later to display form changes
constructor(private …
Run Code Online (Sandbox Code Playgroud) 我想知道两个文本节点是否在视觉上连续,无论html结构如何,即两者之间没有空行或任何其他元素.
我正在使用范围来获取矩形(大小和位置),但文本节点之间有一个间距(第一个矩形的底部与第二个矩形的顶部不匹配).
我试图根据line-height
和计算这个间距,font-size
但我得不到相同的值.
这是我尝试的JsFiddle:https://jsfiddle.net/3behsxxq/5/
有没有办法计算这个间距?
编辑: 在jsFiddle代码的第一种情况下,有四行('第一个文本','块','第二','文本块')在视觉上是连续的,也就是说,它们之间的距离是相同的,但我得到的数字相差7(在第一种情况下).如果我尝试根据line-height/font-size与范围值之间的差异丢弃此空间,则它们不匹配,因此我无法抵消它.
我是初学者,我正在按照一本书做练习.下面是我的代码,我得到了这个
"Missing partial modifier on declaration of type 'Windowsform.Form1'; another partial declaration of this type exists"
.
我该怎么办?我的代码如下:
using System;
using System.Windows.Forms;
namespace Windowsform
{
public class Form1 : Form
{
private TextBox txtEnter;
private Label lblDisplay;
private Button btnOk;
public Form1()
{
this.txtEnter = new TextBox();
this.lblDisplay = new Label();
this.btnOk = new Button();
this.Text = "My Hellowin app!";
//txtEnter
this.txtEnter.Location = new System.Drawing.Point(16, 32);
this.txtEnter.Size = new System.Drawing.Size(264, 20);
//lblDisplay
this.lblDisplay.Location = new System.Drawing.Point(16, 72);
this.lblDisplay.Size = …
Run Code Online (Sandbox Code Playgroud) 我正在使用react bootstrap,这个框架提供了一些不错的FormControls.
但是我想使FormControls中生成的Input字段具有readonly ="readonly"的prop.这样,此字段看起来与我的其他FormControls相同,但不在IOS上提供键盘输入.
在我的情况下,输入将由日历选择器提供,该日历选择器将由弹出窗口触发.
有谁知道如何给FormControl参数readonly ="readonly",以便浏览器中生成的输入字段将具有read readlyly ="readonly"?
很多thnx的答案!
我正在尝试使用FormControl将值设置为Mat输入
<input name="contact" matInput [matAutocomplete]="contactAuto" [formControl]="myControl" #contact (blur)="validateInput($event, contact.value)" >
Run Code Online (Sandbox Code Playgroud)
在我的Ts
myControl = new FormControl();
this.myControl.value = 'contact';
Run Code Online (Sandbox Code Playgroud)
上面的代码工作正常,但我收到一个错误
Cannot assign to 'value' because it is a constant or a read-only property
Run Code Online (Sandbox Code Playgroud)
我在这里错过了什么吗?
我正在尝试formGroup
根据特定条件在控件中添加和删除验证器。
当我更新formGroup.updateValueAndValidity()
整个表单的验证器时,它没有更新,好像我专门申请每个控件,即formGroup.get('formControl').updateValueAndValidity()
,它正在工作,但我必须为每个控件编写,我希望这不是正确的方法。我究竟做错了什么?
if (data == 'x') {
this.myForm.get('control2').setValue(null);
this.myForm.get('control2').setValidators(Validators.nullValidator);
this.myForm.get('control1').setValidators(Validators.required);
} else if (data == 'y') {
this.myForm.get('control1').setValue(null);
this.myForm.get('control1').setValidators(Validators.nullValidator);
this.myForm.get('control2').setValidators(Validators.required);
}
this.myForm.get('control1').updateValueAndValidity();
this.myForm.get('control2').updateValueAndValidity();
Run Code Online (Sandbox Code Playgroud)
这是有效的,但是,
this.myForm.updateValueAndValidity();
Run Code Online (Sandbox Code Playgroud)
这是行不通的。
typescript form-control angular formgroups angular-validator
form-control ×10
angular ×5
c# ×2
javascript ×2
winforms ×2
activex ×1
css ×1
declaration ×1
excel ×1
excel-2010 ×1
formgroups ×1
forms ×1
partial ×1
radio-button ×1
reactjs ×1
resize ×1
typescript ×1
vba ×1