form-control

How to dock a windows form in C#?

落爺英雄遲暮 提交于 2019-12-05 07:25:01
I just would like to know if it is possible to dock a windows form on top of the user screen? I have been trying to do this by manually setting the position of my form to the coordinates I want. But using this method, however, allows the user to change the position of the form just by dragging it. I want to make the form docked to the upper portion of the screen since this window form will server as a menu for the project I am making. Thanks a lot. :) I would consider using the Control.Dock property along with one of the DockStyle enumeration values. You might need to play with the Layout too,

Activate a form and process button click at the same time?

邮差的信 提交于 2019-12-04 21:33:33
问题 I'm using Windows Forms in C#. I have a main form with a couple of toolbars that contain toolStripButtons. After working with another form that contains data, the main form loses focus and clicking on a toolStripButton does not trigger OnClick event: the first click activates the main form, and only the second click actually pushes the button. I need the user to click a button only once to trigger a Click event, any ideas on how to do that? Thanks. Notes: I was using MDI and there were no

Missing partial modifier on declaration ..another partial declaration of this type exists". I'm a beginner and just following the book

依然范特西╮ 提交于 2019-12-03 23:53:15
问题 I'm a beginner and I'm doing an exercise following a book. Below is my code and i got this "Missing partial modifier on declaration of type 'Windowsform.Form1'; another partial declaration of this type exists" . What should i do? My code is as follows: 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(

Activate a form and process button click at the same time?

给你一囗甜甜゛ 提交于 2019-12-03 14:00:36
I'm using Windows Forms in C#. I have a main form with a couple of toolbars that contain toolStripButtons. After working with another form that contains data, the main form loses focus and clicking on a toolStripButton does not trigger OnClick event: the first click activates the main form, and only the second click actually pushes the button. I need the user to click a button only once to trigger a Click event, any ideas on how to do that? Thanks. Notes: I was using MDI and there were no problems clicking on the parent's form buttons. But now the paramount is to have forms freely floating

Missing partial modifier on declaration ..another partial declaration of this type exists\". I'm a beginner and just following the book

 ̄綄美尐妖づ 提交于 2019-12-01 15:14:20
I'm a beginner and I'm doing an exercise following a book. Below is my code and i got this "Missing partial modifier on declaration of type 'Windowsform.Form1'; another partial declaration of this type exists" . What should i do? My code is as follows: 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

How to check if form is open, if open close form?

限于喜欢 提交于 2019-12-01 03:46:50
问题 How do I check if a form is open, and if it is open to close the form? I tried the following, testing out some code but it keep saying the form is not open even when I know it is: foreach(Form a in Application.OpenForms) { if (a is YouLikeHits_Settings) { // About form is open MessageBox.Show("form open"); break; } // About form is not open... MessageBox.Show("form not open"); break; } 回答1: Application.OpenForms contains opened forms. If form in this collection, then it is opened. Otherwise

No value accessor for form control

佐手、 提交于 2019-11-30 11:28:00
I'm using Angular2-rc5, and I'm currently getting an error on my login page. I'm trying to make a form but the console throws exceptions telling me that it can't find my formcontroll s even though I create it on init. Any idea why I'm getting this error? login component 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',

Prevent window redraw when resizing c# windows forms

青春壹個敷衍的年華 提交于 2019-11-30 00:15:10
What windows message or event can i listen to in order to stop a window from being redrawing every pixel of it's resize? That is, when a user clicks on the edge of the window and starts to re-size it, i don't want to re-draw the entire contents until he lets go. This is because for some reason it's currently choppy at resizing probably because everything is re-docking and what not. I tried WM_SIZING but that only tells me it's being re-sized, i wish to know the start and end of the sizing so i can suspend the layout until the user stops resizing. Nevermind, just found these two events. this

No value accessor for form control

安稳与你 提交于 2019-11-29 16:51:59
问题 I'm using Angular2-rc5, and I'm currently getting an error on my login page. I'm trying to make a form but the console throws exceptions telling me that it can't find my formcontroll s even though I create it on init. Any idea why I'm getting this error? login component import { Component, OnInit } from '@angular/core'; import { FormGroup, FormControl, FormBuilder, Validators } from '@angular/forms'; import { LoginService } from './login.service'; import { User } from '../../models/user';

Angular 6 Material <mat-select> multiple set default value using form control

半腔热情 提交于 2019-11-28 08:10:27
问题 I am using form control here is code for my html component <mat-form-field> <mat-select placeholder="Toppings" [formControl]="toppings" multiple> <mat-option *ngFor="let topping of toppingList" [value]="topping">{{topping.value}}</mat-option> </mat-select> </mat-form-field> And my ts file is export class SelectMultipleExample { toppings = new FormControl(); toppingList: any[] = [ { id:1,value:"test 1"}, { id:2,value:"test 2"}, { id:3,value:"test 4"}, { id:4,value:"test 5"}, { id:5,value:"test