void InitCtrol () { ReadOnly = true; //this.AllowAddRows = false; AllowUserToAddRows = false; AllowUserToDeleteRows = false; AllowUserToResizeRows = false; ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize; MultiSelect = false; RowHeadersVisible = false; SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect; ScrollBars = System.Windows.Forms.ScrollBars.Both; BackgroundColor = System.Drawing.Color.White; BorderStyle = System.Windows.Forms.BorderStyle.None; Scroll += new System.Windows.Forms.ScrollEventHandler(OnScroll); CellDoubleClick += new System.Windows.Forms.DataGridViewCellEventHandler(this.OnCellDoubleClick); txtBox.KeyDown += new KeyEventHandler ( OnKeyDown ); RowTemplate.Height = _nLineH; SetStyle(ControlStyles.DoubleBuffer | ControlStyles.OptimizedDoubleBuffer | ControlStyles.AllPaintingInWmPaint, true); UpdateStyles(); // Columns.Clear(); DataGridViewColumn col1 = new DataGridViewTextBoxColumn (); col1.HeaderText = "Caption"; col1.Name = "Caption"; col1.DataPropertyName = "Caption"; col1.ReadOnly = true; Columns.Add ( col1 ); DataGridViewColumn col2 = new DataGridViewTextBoxColumn (); col2.HeaderText = "Value"; col2.Name = "Value"; col2.DataPropertyName = "Value"; col2.ReadOnly = false; Columns.Add ( col2 ); DataGridViewColumn col3 = new DataGridViewTextBoxColumn (); col3.HeaderText = "Def"; col3.Name = "Def"; col3.DataPropertyName = "Def"; col3.ReadOnly = true; col3.Visible = false; Columns.Add ( col3 ); Columns[0].DefaultCellStyle.ForeColor = clrCaptionFore; Columns[0].DefaultCellStyle.BackColor = clrCaptionBK; // txtBox.Parent = this; txtBox.AcceptsReturn = true; txtBox.WordWrap = false; txtBox.KeyPress += new System.Windows.Forms.KeyPressEventHandler ( textBoxKeyPress ); txtBox.Hide(); cmb.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; cmb.SelectedIndexChanged += new System.EventHandler ( cmb_SelectedIndexChanged ); cmb.Parent = this; cmb.Hide(); datPicker.Parent = this; datPicker.bShowTime = true; datPicker.Finish += dateTimePicker_ValueChanged ; datPicker.Hide(); }
public ScrollViewRenderer() { var h = Platform.BlockReenter <WForms.ScrollEventArgs>((s, e) => OnNativeScroll(s, e)); _onScrollEventHandler = (s, e) => h(s, e); }