private void DragDropService_PreviewDragOver(object sender, RadDragOverEventArgs e) { RadTextBoxElement textBox = e.HitTarget as RadTextBoxElement; if (textBox == this.radTextBox1.TextBoxElement) { e.CanDrop = true; } }
protected override void CreateChildElements() { base.CreateChildElements(); ctlChk = new RadCheckBoxElement(); ctlChk.ToggleStateChanged += new StateChangedEventHandler(ctlChk_ToggleStateChanged); this.Children.Add(ctlChk); ctlComboBoxElement = new RadComboBoxElement(); ctlComboBoxElement.DropDownStyle = RadDropDownStyle.DropDownList; ctlComboBoxElement.ValueChanged += new EventHandler(ctlComboBoxElement_ValueChanged); this.Children.Add(ctlComboBoxElement); ctlCheckComboBoxElement = new CSCheckComboBoxElement(); ctlCheckComboBoxElement.PopupClosed += new RadPopupClosedEventHandler(ctlCheckComboBoxElement_PopupClosed); this.Children.Add(ctlCheckComboBoxElement); ctlComboBoxExxElement = new CSComboBoxExxElement(); ctlComboBoxExxElement.ValueChanged += new EventHandler(ctlComboBoxExxElement_ValueChanged); this.Children.Add(ctlComboBoxExxElement); ctlTextBox = new RadTextBoxElement(); ctlTextBox.TextChanged += new EventHandler(ctlTextBox_TextChanged); this.Children.Add(ctlTextBox); ctlDataTimePickerElement = new RadDateTimePickerElement(); ctlDataTimePickerElement.ValueChanged += new EventHandler(ctlDataTimePickerElement_ValueChanged); this.Children.Add(ctlDataTimePickerElement); ctlColorSelectorElement = new CSColorSelectorElement(); ctlColorSelectorElement.TextChanged += new EventHandler(ctlColorSelectorElement_TextChanged); this.Children.Add(ctlColorSelectorElement); ctlSpin = new RadSpinElement(); ctlSpin.MinValue = 0; ctlSpin.MaxValue = 100000; ctlSpin.TextChanged += new EventHandler(ctlSpin_TextChanged); this.Children.Add(ctlSpin); ctlNumericTextBox = new CSNumericTextBoxElement(); ctlNumericTextBox.TextChanged += new EventHandler(ctlNumericTextBox_TextChanged); this.Children.Add(ctlNumericTextBox); ctlIntTextBox = new CSIntegerTextBoxElement(); ctlIntTextBox.TextChanged += new EventHandler(ctlIntTextBox_TextChanged); this.Children.Add(ctlIntTextBox); foreach (RadElement element in this.Children) { element.Visibility = ElementVisibility.Collapsed; } }
public CntrlchkDropDown() { InitializeComponent(); m_TextBox = new RadTextBoxElement(); m_TextBox.TextBoxItem.Alignment = ContentAlignment.MiddleLeft; m_TextBox.TextBoxItem.BorderThickness = new System.Windows.Forms.Padding(0, 0, 0, 0); m_TextBox.Border.Visibility = ElementVisibility.Collapsed; m_TextBox.TextBoxItem.ReadOnly = true; m_TextBox.AutoSize = false; this.Load += new EventHandler(chkDropDown_Load); }
private void AddIconToTextBoxElement(RadTextBoxElement textElement, ImagePrimitive icon, Telerik.WinControls.Layouts.Dock dock) { RadTextBoxItem item = textElement.TextBoxItem; textElement.Children.Remove(item); icon.SetValue(DockLayoutPanel.DockProperty, dock); DockLayoutPanel dockPanel = new DockLayoutPanel(); dockPanel.LastChildFill = true; dockPanel.Children.Add(icon); dockPanel.Children.Add(item); textElement.Children.Add(dockPanel); }
public Form1() { InitializeComponent(); ImagePrimitive icon = new ImagePrimitive(); icon.Image = global::Telerik.Examples.WinControls.CommandBar.FirstLook.Resource1.telerik_icon; icon.Padding = new Padding(0, 4, 0, 0); RadTextBoxElement addressBox = radCommandBarDropDownListItem1.DropDownListElement.EditableElement.TextBox; radCommandBarDropDownListItem1.DropDownListElement.EditableElement.DrawText = false; this.AddIconToTextBoxElement(addressBox, icon, Telerik.WinControls.Layouts.Dock.Left); ImagePrimitive searchIcon = new ImagePrimitive(); searchIcon.Image = global::Telerik.Examples.WinControls.CommandBar.FirstLook.Resource1.search3; searchIcon.Alignment = ContentAlignment.MiddleRight; searchIcon.MouseDown += new MouseEventHandler(searchIcon_MouseDown); searchIcon.ShouldHandleMouseInput = true; this.AddIconToTextBoxElement(this.radCommandBarTextBoxItem1.TextBoxElement, searchIcon, Telerik.WinControls.Layouts.Dock.Right); this.radCommandBarTextBoxItem1.TextBoxElement.Alignment = System.Drawing.ContentAlignment.TopLeft; this.radCommandBarTextBoxItem1.TextBoxElement.TextBoxItem.Alignment = System.Drawing.ContentAlignment.TopLeft; this.radCommandBarTextBoxItem1.TextBoxElement.TextBoxItem.KeyDown += new KeyEventHandler(radCommandBarTextBoxItem1_KeyDown); radCommandBarDropDownListItem1.PropertyChanged += new PropertyChangedEventHandler(radCommandBarDropDownListItem1_PropertyChanged); radCommandBarTextBoxItem1.PropertyChanged += new PropertyChangedEventHandler(radCommandBarTextBoxItem1_PropertyChanged); radCommandBarDropDownListItem1.DropDownListElement.EditableElement.TextBox.TextBoxItem.KeyDown += new KeyEventHandler(radCommandBarDropDownListItem1_KeyDown); (radPageView1.ViewElement as RadPageViewStripElement).NewItemVisibility = StripViewNewItemVisibility.End; radPageView1.NewPageRequested += new EventHandler(radPageView1_NewPageRequested); radPageView1.PageAdded += new EventHandler <RadPageViewEventArgs>(radPageView1_PageAdded); webBrowser1.ScriptErrorsSuppressed = true; webBrowser1.Navigate("www.telerik.com"); }
/// <summary> /// Creates the stack layouts for the textbox and the button on the same /// horizontal. /// </summary> protected override void CreateChildElements() { base.CreateChildElements(); StackLayoutElement stack = new StackLayoutElement(); stack.Orientation = Orientation.Vertical; stack.StretchVertically = true; stack.StretchHorizontally = true; StackLayoutElement first = new StackLayoutElement(); first.Orientation = Orientation.Horizontal; first.StretchHorizontally = true; first.StretchVertically = true; RadTextBoxElement textBox = new RadTextBoxElement(); textBox.Text = TextboxText; textBox.MinSize = new Size(75, 0); textBox.KeyDown += textBox_KeyDown; RadButtonElement button = new RadButtonElement(); button.Text = "OK"; button.MaxSize = new Size(50, 20); button.Click += button_Click; first.Children.Add(textBox); first.Children.Add(button); stack.Children.Add(first); stack.Margin = new Padding(5, 0, 0, 0); stack.MinSize = new Size(120, 0); this.Children.Add(stack); }
private void InitializeComponent() { this.components = new Container(); this.radStatusBar1 = new RadStatusStrip(); this.textBox1 = new RadTextBoxElement(); this.radToolStripSeparatorItem1 = new RadToolStripSeparatorItem(); this.radLabelElement0 = new RadLabelElement(); this.radProgressBarElement1 = new RadProgressBarElement(); this.radToolStripSeparatorItem2 = new RadToolStripSeparatorItem(); this.radLabelElement1 = new RadLabelElement(); this.radToolStripSeparatorItem3 = new RadToolStripSeparatorItem(); this.radButtonElementL = new RadButtonElement(); this.radButtonElementR = new RadButtonElement(); this.radLabelElement2 = new RadLabelElement(); this.radToolStripSeparatorItem5 = new RadToolStripSeparatorItem(); this.radLabelElement3 = new RadLabelElement(); this.radToolStripSeparatorItem6 = new RadToolStripSeparatorItem(); this.radLabelElement4 = new RadLabelElement(); this.radToolStripSeparatorItem4 = new RadToolStripSeparatorItem(); this.timer1 = new Timer(this.components); ((ISupportInitialize)this.radStatusBar1).BeginInit(); base.SuspendLayout(); this.radStatusBar1.AutoSize = true; this.radStatusBar1.BackColor = SystemColors.ControlLightLight; this.radStatusBar1.Items.AddRange(new RadItem[] { this.textBox1, this.radToolStripSeparatorItem1, this.radLabelElement0, this.radProgressBarElement1, this.radToolStripSeparatorItem2, this.radLabelElement1, this.radToolStripSeparatorItem3, this.radButtonElementL, this.radButtonElementR, this.radToolStripSeparatorItem3, this.radLabelElement2, this.radToolStripSeparatorItem5, this.radLabelElement3, this.radToolStripSeparatorItem6, this.radLabelElement4 }); this.radStatusBar1.LayoutStyle = RadStatusBarLayoutStyle.Stack; this.radStatusBar1.Location = new Point(0, 1); this.radStatusBar1.Margin = new Padding(5, 4, 5, 4); this.radStatusBar1.Name = "radStatusBar1"; this.radStatusBar1.RootElement.ControlBounds = new Rectangle(0, 1, 300, 24); this.radStatusBar1.RootElement.StretchVertically = true; this.radStatusBar1.Size = new Size(1155, 23); this.radStatusBar1.SizingGrip = true; this.radStatusBar1.TabIndex = 0; this.radStatusBar1.Text = "radStatusBar1"; this.textBox1.CanFocus = true; this.textBox1.Margin = new Padding(1); this.textBox1.Name = "radButtonElement1"; this.radStatusBar1.SetSpring(this.textBox1, true); this.textBox1.StretchVertically = false; this.textBox1.Text = ""; this.radToolStripSeparatorItem1.Margin = new Padding(1); this.radToolStripSeparatorItem1.MinSize = new Size(2, 17); this.radToolStripSeparatorItem1.Name = "radToolStripSeparatorItem1"; this.radStatusBar1.SetSpring(this.radToolStripSeparatorItem1, false); this.radToolStripSeparatorItem1.Text = "radToolStripSeparatorItem1"; this.radLabelElement0.Margin = new Padding(1); this.radLabelElement0.MinSize = new Size(2, 17); this.radLabelElement0.Name = "radLabelElement0"; this.radStatusBar1.SetSpring(this.radLabelElement0, false); this.radLabelElement0.Text = "任务进度"; this.radLabelElement0.TextWrap = true; this.radProgressBarElement1.AutoSize = false; this.radProgressBarElement1.AutoSizeMode = RadAutoSizeMode.FitToAvailableSize; this.radProgressBarElement1.Bounds = new Rectangle(0, 0, 133, 16); this.radProgressBarElement1.ClipDrawing = true; this.radProgressBarElement1.DefaultSize = new Size(130, 16); this.radProgressBarElement1.Margin = new Padding(1); this.radProgressBarElement1.Name = "radProgressBarElement1"; this.radStatusBar1.SetSpring(this.radProgressBarElement1, false); this.radProgressBarElement1.Text = ""; this.radProgressBarElement1.TextAlignment = ContentAlignment.MiddleCenter; this.radToolStripSeparatorItem2.Margin = new Padding(1); this.radToolStripSeparatorItem2.MinSize = new Size(2, 17); this.radToolStripSeparatorItem2.Name = "radToolStripSeparatorItem2"; this.radStatusBar1.SetSpring(this.radToolStripSeparatorItem2, false); this.radToolStripSeparatorItem2.Text = "radToolStripSeparatorItem2"; this.radLabelElement1.Margin = new Padding(1); this.radLabelElement1.MinSize = new Size(2, 17); this.radLabelElement1.Name = "radLabelElement1"; this.radStatusBar1.SetSpring(this.radLabelElement1, false); this.radLabelElement1.Text = ""; this.radLabelElement1.TextWrap = true; this.radToolStripSeparatorItem3.Margin = new Padding(1); this.radToolStripSeparatorItem3.MinSize = new Size(2, 17); this.radToolStripSeparatorItem3.Name = "radToolStripSeparatorItem3"; this.radStatusBar1.SetSpring(this.radToolStripSeparatorItem3, false); this.radToolStripSeparatorItem3.Text = "radToolStripSeparatorItem3"; this.radButtonElementL.Margin = new Padding(1); this.radButtonElementL.MinSize = new Size(2, 17); this.radButtonElementL.Name = "radLabelElementL"; this.radStatusBar1.SetSpring(this.radButtonElementL, false); this.radButtonElementL.Text = "<"; this.radButtonElementR.Margin = new Padding(1); this.radButtonElementR.MinSize = new Size(2, 17); this.radButtonElementR.Name = "radLabelElementR"; this.radStatusBar1.SetSpring(this.radButtonElementR, false); this.radButtonElementR.Text = ">"; this.radLabelElement2.Margin = new Padding(1); this.radLabelElement2.MinSize = new Size(2, 17); this.radLabelElement2.Name = "radLabelElement1"; this.radStatusBar1.SetSpring(this.radLabelElement2, false); this.radLabelElement2.Text = ""; this.radLabelElement2.TextWrap = true; this.radToolStripSeparatorItem5.Margin = new Padding(1); this.radToolStripSeparatorItem5.MinSize = new Size(2, 17); this.radToolStripSeparatorItem5.Name = "radToolStripSeparatorItem5"; this.radStatusBar1.SetSpring(this.radToolStripSeparatorItem5, false); this.radToolStripSeparatorItem5.Text = "radToolStripSeparatorItem5"; this.radLabelElement3.Margin = new Padding(1); this.radLabelElement3.Name = "radLabelElement2"; this.radStatusBar1.SetSpring(this.radLabelElement3, false); this.radLabelElement3.Text = ""; this.radLabelElement3.TextWrap = true; this.radToolStripSeparatorItem6.Margin = new Padding(1); this.radToolStripSeparatorItem6.MinSize = new Size(2, 17); this.radToolStripSeparatorItem6.Name = "radToolStripSeparatorItem4"; this.radStatusBar1.SetSpring(this.radToolStripSeparatorItem6, false); this.radToolStripSeparatorItem6.Text = "radToolStripSeparatorItem4"; this.radLabelElement4.Margin = new Padding(1); this.radLabelElement4.Name = "radLabelElement3"; this.radStatusBar1.SetSpring(this.radLabelElement4, false); this.radLabelElement4.Text = ""; this.radLabelElement4.TextWrap = true; this.radToolStripSeparatorItem4.Margin = new Padding(1); this.radToolStripSeparatorItem4.MinSize = new Size(2, 17); this.radToolStripSeparatorItem4.Name = "radToolStripSeparatorItem4"; this.radToolStripSeparatorItem4.Text = "radToolStripSeparatorItem4"; this.timer1.Interval = 1000; this.timer1.Tick += new EventHandler(this.timer1_Tick); base.AutoScaleDimensions = new SizeF(6f, 12f); base.AutoScaleMode = AutoScaleMode.Font; this.BackColor = Color.White; base.Controls.Add(this.radStatusBar1); base.Name = "UCStatusBar"; base.Size = new Size(1155, 24); ((ISupportInitialize)this.radStatusBar1).EndInit(); base.ResumeLayout(false); base.PerformLayout(); }