public void setControlObject(MyUserControl value) { Location = value.Location; if ("LogicScheme.XorElement".Equals(value.GetType().ToString())) { } element = value.element; try { Input1 = value.Input1.Checked; Input2 = value.Input2.Checked; Output = value.Output.Checked; } catch (NullReferenceException e) { Input1 = false; Input2 = false; Output = false; } try { label1 = value.label1.Text; } catch (NullReferenceException e) { label1 = ""; } type = value.GetType().ToString(); }
protected void Page_Load() { HiddenField info = (HiddenField)myHiddenField; MyUserControl control = (MyUserControl )myusercontrol; control.MyProperty = info.Value; }
public Screen(string Name, MyUserControl Control, bool Persistent = false) { this.Name = Name; this.Control = Control; this.Type = Control.GetType(); this.Persistent = Persistent; }
public void btnfeedback_Click1(Office.IRibbonControl rib) { PowerPoint.Application ppApp = Globals.ThisAddIn.Application; Microsoft.Office.Tools.CustomTaskPane myCustomTaskPane; MyUserControl ctrlObj = new MyUserControl(); //myCustomTaskPane = CustomTaskPanes.Add(ctrlObj, "New Task Pane"); }
void Application_DocumentBeforeSave(Word.Document Doc, ref bool SaveAsUI, ref bool Cancel) { //Doc.Paragraphs[1].Range.InsertParagraphBefore(); //Doc.Paragraphs[1].Range.Text = "This text was added by using code."; myUserControl1 = new MyUserControl(); myCustomTaskPane = this.CustomTaskPanes.Add(myUserControl1, "My Task Pane"); myCustomTaskPane.Visible = true; }
public static void disconnect(MyUserControl control) { control.element.disconnect(); control.Input1.Checked = false; control.Input2.Checked = false; control.Output.Checked = false; control.label1.Text = "X"; }
void addNewUserControl() { MyUserControl userControl = new MyUserControl(); userControl.Click += userControl_Click; myUserControls.Add(userControl); tableLayoutPanel1.Controls.Add(userControl); }
private static bool isNeedDelete(Point check, MyUserControl temp) { Point TempEnd = new Point(temp.Location.X + temp.Size.Width, temp.Location.Y + temp.Size.Height); return(InDiapason.isInDiapason(temp.Location, TempEnd, check)); }
private static void recoverFields(Form1 form1, MyUserControl ControlElement, SerializableUserControl control) { ControlElement.label1.Text = control.label1; ControlElement.element = control.element; ControlElement.Output.Checked = control.Output; ControlElement.Input1.Checked = control.Input1; ControlElement.Input2.Checked = control.Input2; СreateElement.create (form1, ControlElement, form1.userControls, control.Location.X, control.Location.Y); }
private void buttonDelete_Click(object sender, EventArgs e) { for (int i = 0; i < myUserControls.Count; i++) { if (myUserControls[i].IsClicked) { MyUserControl userControl = myUserControls[i]; tableLayoutPanel1.Controls.Remove(userControl); myUserControls.RemoveAt(i); userControl.Dispose(); } } }
/// <summary> /// start of paint connection line /// </summary> /// <param name="sender">logic element</param> /// <param name="e">parameters of mouse event</param> public void element_MouseDown(object sender, MouseEventArgs e) { drawLine = new DrawLine(); if (e.Button == MouseButtons.Left) { drawLine.setStartPoint(e.X + (sender as UserControl).Location.X, e.Y + (sender as UserControl).Location.Y); isClicked = true; } else if (e.Button == MouseButtons.Right) { MyUserControl temp = sender as MyUserControl; Disconect.disconnect(temp); DeleteLine.delete(userControls, drawedLines, temp); Invalidate(); } }
public static void create(Form1 form, MyUserControl el, List <UserControl> userControls, int positionX, int positionY) { el.Size = new Size(108, 48); el.Location = new Point(positionX, positionY); el.MouseDown += new MouseEventHandler(form.element_MouseDown); el.MouseUp += new MouseEventHandler(form.element_MouseUp); el.MouseMove += new MouseEventHandler(form.element_MouseMove); el.Visible = true; userControls.Add(el); form.Controls.Add(el); }
protected override void OnAfterSelect(System.Windows.Forms.TreeViewEventArgs e) { CustomTreeNode selectedNode = (CustomTreeNode)e.Node; CustomTreeView treeView = (CustomTreeView)e.Node.TreeView; control = (MyUserControl)treeView.Parent.Parent.Parent.Parent; // get the wits WitsDao witsDao = new WitsDao(); List<Wits> wits = witsDao.getWits(selectedNode.fieldId); if (wits.Count > 0) { control.witsPanel.Controls.Clear(); control.pnlMenu.Visible = false; control.witsPanel.Visible = true; control.witsPanelContainer.Visible = true; foreach (var wit in wits) { CustomWitButton witButton = new CustomWitButton(); witButton.Text = " "+wit.name; witButton.fieldType = wit.type; witButton.fieldId = wit.id; witButton.Click += witHandler; CustomWitPanel childWitPanel = new CustomWitPanel(); childWitPanel.Name = "childWitPanel"; childWitPanel.Controls.Add(witButton); // add to the clicked panel childWitPanel.Parent = control.witsPanel; control.witsPanel.ResumeLayout(); } control.witsPanelContainer.Controls.Add(control.witsPanel); control.witsPanelContainer.Controls.Add(control.mainTabPanel); } }
[Test] // bug #81199 public void NestedControls() { Form f = new Form(); f.ShowInTaskbar = false; MyUserControl c = new MyUserControl(); c.Dock = DockStyle.Fill; c.Size = new Size(500, 500); f.SuspendLayout(); f.Controls.Add(c); f.ClientSize = new Size(500, 500); f.ResumeLayout(false); f.Show(); Assert.AreEqual(new Size(600, 600), c.lv.Size, "I1"); f.Close(); }
private void Ticks(object Sender, EventArgs e) { if (START) { //long tick = DateTime.Now.Ticks - Date.Ticks; //Console.WriteLine(tick); Tick += 1000000 / 6; DateTime Watch = new DateTime(); Watch = Watch.AddTicks(Tick); TimeLable.Text = String.Format("{0:HH:mm:ss:ff}", Watch); if (Refr) { #region Создание элементов интерфейса pointsPanel = new MyUserControl() { Dock = DockStyle.Fill }; pointsPanel.Paint += DrawPoints; networkPanel = new MyUserControl() { Dock = DockStyle.Fill }; networkPanel.Paint += DrawNetwork; networkGraphControl = new MyUserControl { Dock = DockStyle.Fill }; networkGraphControl.Paint += DrawGraph; table.Controls.Add(pointsPanel, 0, 0); table.Controls.Add(networkPanel, 0, 1); table.Controls.Add(networkGraphControl, 0, 2); #endregion Refr = false; Timer.Start(); } } }
public static void delete(List <UserControl> userControls, List <DrawLine> drawedLines, MyUserControl temp) { Point start; for (int i = 0; i < drawedLines.Count; i++) { start = drawedLines[i].twoPoints[0].pointStart; if (isNeedDelete(drawedLines[i].getPointEnd(), temp)) { foreach (MyUserControl control in userControls) { if (isNeedDelete(start, control)) { Disconect.disconnect(control); } } drawedLines.Remove(drawedLines[i]); i = -1; continue; } else if (isNeedDelete(start, temp)) { foreach (MyUserControl control in userControls) { if (isNeedDelete(drawedLines[i].getPointEnd(), control)) { Disconect.disconnect(control); } } drawedLines.Remove(drawedLines[i]); i = -1; continue; } } }
public void changeCurrentContent(IContentPage content) { IContentPage lastContent = currentContent as IContentPage; if (lastContent != null) lastContent.finalizePage(); if (content is MyUserControl) { currentContent = content as MyUserControl; currentContent.appear(DockStyle.Fill, mainPanel); ContentArgs e = new ContentArgs(content); OnContentChange(e); } content.initializePage(); }
public async Task UserControl() { var userControl = new MyUserControl(); await Verify(userControl); }
public MyDataTemplateSelector(MyUserControl parent) { this.parent = parent; }
static void Main() { network = new DistanceNetwork(2, task.NetworkWidth * task.NetworkHeight); for (int x = 0; x < task.NetworkWidth; x++) { for (int y = 0; y < task.NetworkHeight; y++) { var n = network.Layers[0].Neurons[x * task.NetworkHeight + y]; n.Weights[0] = rnd.NextDouble() * 0.2 + 0.4; n.Weights[1] = rnd.NextDouble() * 0.2 + 0.4; } } learning = new SOMLearning(network, task.NetworkWidth, task.NetworkHeight); learning.LearningRadius = task.LearningRadius; learning.LearningRate = task.LearningRate; Inputs = task.GenerateInputs().ToArray(); pointsPanel = new MyUserControl() { Dock = DockStyle.Fill }; pointsPanel.Paint += DrawPoints; networkPanel = new MyUserControl() { Dock = DockStyle.Fill }; networkPanel.Paint += DrawNetwork; networkGraphControl = new MyUserControl { Dock = DockStyle.Fill }; networkGraphControl.Paint += DrawGraph; var pauseButton = new Button { Text = "Pause/Resume" }; pauseButton.Click += PauseResume; var table = new TableLayoutPanel() { Dock = DockStyle.Fill, RowCount = 2, ColumnCount = 2 }; table.Controls.Add(pointsPanel, 0, 0); table.Controls.Add(networkPanel, 0, 1); table.Controls.Add(networkGraphControl, 1, 0); table.Controls.Add(pauseButton, 1, 1); // table.Controls.Add(pause, 1, 1); table.RowStyles.Add(new RowStyle(SizeType.Percent, 50f)); table.RowStyles.Add(new RowStyle(SizeType.Percent, 50f)); table.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 50f)); table.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 50f)); form = new Form() { ClientSize = new Size(600, 600), Controls = { table } }; timer = new System.Windows.Forms.Timer(); timer.Tick += (sender, args) => { Learning(); form.Invalidate(true); }; timer.Interval = 100; timer.Start(); Application.Run(form); }
private void witHandler(object sender, EventArgs e) { CustomWitButton clickedWitButton = new CustomWitButton(); Panel clcikedPanel = (Panel)((Button)sender).Parent; clickedWitButton = (CustomWitButton)sender; clickedWitButton.BackColor = System.Drawing.Color.FromArgb(26, 26, 26); // change the color to selected color control = (MyUserControl)clickedWitButton.Parent.Parent.Parent.Parent; var type = clickedWitButton.fieldType; if (clickedWitButton.Parent.Controls.Count > 1) { clcikedPanel.Controls.Clear(); clcikedPanel.Controls.Add(clickedWitButton); clickedWitButton.BackColor = System.Drawing.Color.FromArgb(070, 070, 070); // back to previous color } else if (clickedWitButton.Parent.Controls.Count == 1) { WitsDao witDao = new WitsDao(); Wits wit = witDao.getWit(clickedWitButton.fieldId); // try to add buttons in the richtextbox top CustomWitIconButton textMailButton = new CustomWitIconButton(Resource.mail_24px1, AnchorStyles.Left, System.Drawing.Color.FromArgb(64, 64, 64),"new mail"); textMailButton.Click += textMailButtonHandler; textMailButton.Location = new System.Drawing.Point(280, 0); CustomWitIconButton forwardMailButton = new CustomWitIconButton(Resource.forward, AnchorStyles.Left, System.Drawing.Color.FromArgb(64, 64, 64), "forward"); forwardMailButton.Click += forwardMailButtonHandler; forwardMailButton.Location = new System.Drawing.Point(310, 0); CustomWitIconButton textReplyButton = new CustomWitIconButton(Resource.post_24px1, AnchorStyles.Left, System.Drawing.Color.FromArgb(64, 64, 64),"reply"); textReplyButton.Click += textReplyButtonHandler; textReplyButton.Location = new System.Drawing.Point(340, 0); CustomWitIconButton textReplyAllButton = new CustomWitIconButton(Resource.reply_all, AnchorStyles.Left, System.Drawing.Color.FromArgb(64, 64, 64), "reply All"); textReplyAllButton.Click += textReplyAllButtonHandler; textReplyAllButton.Location = new System.Drawing.Point(370, 0); CustomWitIconButton meetingButton = new CustomWitIconButton(Resource.meeting, AnchorStyles.Left, System.Drawing.Color.FromArgb(64, 64, 64),"meeting"); meetingButton.Click += meetingButtonHandler; meetingButton.Location = new System.Drawing.Point(400, 0); WebBrowser wb = new WebBrowser(); wb.DocumentText = " <br></br> " + wit.content == null ? "" : wit.content; wb.Name = wit.id; wb.Size = new System.Drawing.Size(435, 450); Panel panel1 = new Panel(); panel1.Size = new System.Drawing.Size(500, 30); panel1.BackColor = System.Drawing.Color.FromArgb(64, 64, 64); // gray color for mail panel panel1.Location = new System.Drawing.Point(0, 0); Panel panel2 = new Panel(); panel2.Size = new System.Drawing.Size(500, 20); panel2.BackColor = System.Drawing.Color.Silver; // silver for rating stars panel2.Location = new System.Drawing.Point(0,30); panel1.Controls.Add(meetingButton); panel1.Controls.Add(textReplyAllButton); panel1.Controls.Add(textReplyButton); panel1.Controls.Add(forwardMailButton); panel1.Controls.Add(textMailButton); // create richTextboxPanel Panel WebBrowserPanel = new Panel(); WebBrowserPanel.SuspendLayout(); WebBrowserPanel.AutoSize = true; WebBrowserPanel.Dock = System.Windows.Forms.DockStyle.Top; WebBrowserPanel.Location = new System.Drawing.Point(0, 0); WebBrowserPanel.Name = "webBrowser"; WebBrowserPanel.Size = new System.Drawing.Size(300, 600); WebBrowserPanel.TabIndex = 1; WebBrowserPanel.Controls.Add(panel1); // gray WebBrowserPanel.Controls.Add(panel2); // silver // below is the acronym code block List<string> matches = StringUtils.searchAcronyms(wit.content == null ? "" : wit.content); var height = 20; foreach (String m in matches) { var acro = m.Replace("]","").Replace("[",""); height += 30; Panel acronymPanel = new FlowLayoutPanel(); acronymPanel.Size = new System.Drawing.Size(500, 30); acronymPanel.BackColor = System.Drawing.Color.FromArgb(235, 235, 235); // gray color for mail panel acronymPanel.Location = new System.Drawing.Point(0, height); acronymPanel.AutoSize = true; acronymPanel.AutoSizeMode = AutoSizeMode.GrowAndShrink; Label acroLabel = new Label(); acroLabel.Size = new System.Drawing.Size(150, 30); acroLabel.Text = acro; acroLabel.Name = acro; acroLabel.AutoSize = false; // make it false to provide particular size TextBox acroText = new TextBox(); acroText.Size = new System.Drawing.Size(260, 30); acroText.Name = acro; acroText.LostFocus += acronymHandler; acroText.Font = new System.Drawing.Font("Arial", 10F); acroText.ForeColor = System.Drawing.Color.Gray; acronymPanel.Controls.Add(acroLabel); acronymPanel.Controls.Add(acroText); WebBrowserPanel.Controls.Add(acronymPanel); } wb.Location = new System.Drawing.Point(0, height + 30); WebBrowserPanel.Controls.Add(wb); WebBrowserPanel.ResumeLayout(); clcikedPanel.Controls.Add(WebBrowserPanel); clcikedPanel.Controls.Add(clickedWitButton); } }
private void ThisAddIn_Startup(object sender, System.EventArgs e) { myUserControl1 = new MyUserControl(); myCustomTaskPane = this.CustomTaskPanes.Add(myUserControl1, "My Task Pane"); myCustomTaskPane.Visible = true; }
public MyClass(MyUserControl uc) { myUC = uc; }
public MyControlProvider() { _ctrl = new MyUserControl(); }
static void Main() { network = new DistanceNetwork(2, task.NetworkWidth * task.NetworkHeight); for (int x=0;x<task.NetworkWidth;x++) for (int y = 0; y < task.NetworkHeight; y++) { var n = network.Layers[0].Neurons[x * task.NetworkHeight + y]; n.Weights[0] = rnd.NextDouble() * 0.2 + 0.4; n.Weights[1] = rnd.NextDouble() * 0.2 + 0.4; } learning = new SOMLearning(network, task.NetworkWidth, task.NetworkHeight); learning.LearningRadius = task.LearningRadius; learning.LearningRate = task.LearningRate; Inputs = task.GenerateInputs().ToArray(); pointsPanel = new MyUserControl() { Dock= DockStyle.Fill}; pointsPanel.Paint += DrawPoints; networkPanel = new MyUserControl() { Dock = DockStyle.Fill }; networkPanel.Paint += DrawNetwork; networkGraphControl = new MyUserControl { Dock = DockStyle.Fill }; networkGraphControl.Paint += DrawGraph; var pauseButton = new Button { Text = "Pause/Resume" }; pauseButton.Click+=PauseResume; var table = new TableLayoutPanel() { Dock = DockStyle.Fill, RowCount=2, ColumnCount=2 }; table.Controls.Add(pointsPanel, 0, 0); table.Controls.Add(networkPanel, 0, 1); table.Controls.Add(networkGraphControl, 1, 0); table.Controls.Add(pauseButton,1,1); // table.Controls.Add(pause, 1, 1); table.RowStyles.Add(new RowStyle(SizeType.Percent, 50f)); table.RowStyles.Add(new RowStyle(SizeType.Percent, 50f)); table.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 50f)); table.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 50f)); form = new Form() { ClientSize = new Size(600, 600), Controls = { table } }; timer = new System.Windows.Forms.Timer(); timer.Tick += (sender, args) => { Learning(); form.Invalidate(true); }; timer.Interval = 100; timer.Start(); Application.Run(form); }
public SomeClient() { MyUserControl control = new MyUserControl(); control.TheEvent = TheListenerProcedure; }