/// <summary> /// Adds a <see cref="HelpIcon"/> to the task bar at the top of the control /// </summary> /// <param name="title"></param> /// <param name="body"></param> public void AddHelpStringToToolStrip(string title, string body) { var help = new HelpIcon(); help.SetHelpText(title, body); Add(new ToolStripControlHost(help)); }
/// <summary> /// Adds a <see cref="HelpIcon"/> on the right of the control with the pvorided help text /// </summary> /// <param name="c">The control you want the help to appear beside</param> /// <param name="title">The textual header you want shown</param> /// <param name="body">The text you want displayed on hover (under the title)</param> /// <param name="anchor">Explicit anchor style to apply to help icon. If you pass None (default) then anchor will /// be chosen based on the control <paramref name="c"/></param> public void AddHelpString(Control c, string title, string body, AnchorStyles anchor = AnchorStyles.None) { //don't add help to the control more than once if (_helpAdded.Contains(c)) { return; } _helpAdded.Add(c); var help = new HelpIcon(); help.SetHelpText(title, body); help.Location = new Point(c.Right + 3, c.Top); if (anchor == AnchorStyles.None) { if (c.Anchor.HasFlag(AnchorStyles.Right) && c.Anchor.HasFlag(AnchorStyles.Top)) { help.Anchor = AnchorStyles.Right | AnchorStyles.Top; } else if (c.Anchor.HasFlag(AnchorStyles.Right) && c.Anchor.HasFlag(AnchorStyles.Bottom)) { help.Anchor = AnchorStyles.Right | AnchorStyles.Bottom; } } else { help.Anchor = anchor; } c.Parent.Controls.Add(help); }
public void TestNullInputs_HelpIcon() { var hi = new HelpIcon(); hi.SetHelpText(null, null); hi.SetHelpText("", ""); Assert.IsNull(hi.HoverText); }
public void TestLongInputs_HelpIcon() { var hi = new HelpIcon(); //length is over 150 characters string testLongString = "kdsfldsfjsdafdfjsdafldsafadsfksdafjdfjdsfasdjfdsjfsdfldsjfkdsfkdsfksdafjdfsdaf;sdafsdafadsflsdafksdfjadslfjdsflsdjfldsfksadkfadkfasdfadsjfasdsdfladsfjsdjfkdflsdfksdfkadsfladsfj"; hi.SetHelpText(null, testLongString); Assert.AreEqual(HelpIcon.MaxHoverTextLength, hi.HoverText.Length); }
/// <summary> /// Method runs a loop waiting for Hello events. When on is received method probes, resolves /// and Get's device service information and calls 1way, 2way methods and subscribes to SimpleEvent /// and IntegerEvent and waits for them to fire. When they do Unsubscribe is called on the events /// and the receive hello's flag is reset. /// </summary> public void Run() { // Create Event handlers m_simpleServiceClient.ByeEvent += new ByeEventHandler(m_simpleControl_ByeEvent); m_simpleServiceClient.HelloEvent += new HelloEventHandler(m_simpleControl_HelloEvent); m_simpleServiceClient.SubscriptionEndEvent += new SubscriptionEndEventHandler(m_simpleControl_SubscriptionEndEvent); bool firstPass = true; bool twoWayAttach = false; DpwsServiceTypes typeProbes = new DpwsServiceTypes(); typeProbes.Add(new DpwsServiceType("SimpleDeviceType", "http://schemas.example.org/SimpleService")); // Continuous run loop while (true) { if (firstPass && !m_inDiscovery) { m_inDiscovery = true; DpwsServiceDescriptions descs = m_simpleServiceClient.DiscoveryClient.Probe(typeProbes, 3, 5000); for (int i = 0; i < descs.Count; i++) { DpwsServiceDescription desc = descs[i]; if (desc.XAddrs != null && desc.XAddrs.Length > 0) { if (CheckConnection(desc.ServiceTypes, desc.Endpoint.Address.AbsoluteUri)) break; } } m_inDiscovery = false; } // If hello was received and a SimpleService device was found. SeletedService will not be null. // Process until Bye is received. if (m_deviceSelected.WaitOne(5000, false)) { // If this is the first time through the loop for this device subscribe to events if (firstPass) { try { // Test service host call System.Ext.Console.Write("Testing Host service..."); DpwsSubscribeRequest subReq; subReq = new DpwsSubscribeRequest(m_eventingServiceClient.EventSources["SimpleEvent"], m_eventSubscriptionAddress, m_eventingServiceClient.TransportAddress, "PT1H", null); m_simpleEventSubscription = m_eventingServiceClient.EventingClient.Subscribe(subReq); subReq = new DpwsSubscribeRequest(m_eventingServiceClient.EventSources["IntegerEvent"], m_eventSubscriptionAddress, m_eventingServiceClient.TransportAddress, "PT1H", null); m_integerEventSubscription = m_eventingServiceClient.EventingClient.Subscribe(subReq); firstPass = false; } catch { m_deviceSelected.Reset(); } } // Make 1Way and 2Way service calls if (m_deviceSelected.WaitOne(0, false)) { try { PrintMetadataInfo(); System.Ext.Console.Write(""); System.Ext.Console.Write(">>>>>>>>>>>>> Sending 1way(10) request to: " + m_selectedService.ThisDevice.FriendlyName); m_simpleServiceClient.OneWay(new OneWayRequest()); } catch (Exception e) { firstPass = true; m_deviceSelected.Reset(); System.Ext.Console.Write(""); System.Ext.Console.Write("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! OneWay method failed. " + e.Message); } } if (m_deviceSelected.WaitOne(0, false)) { int x = System.Math.Abs(m_random.Next()) % 100; int y = System.Math.Abs(m_random.Next()) % 100; System.Ext.Console.Write(""); System.Ext.Console.Write(">>>>>>>>>>>>> Sending 2way(" + x.ToString() + ", " + y.ToString() + ") request to: " + m_selectedService.ThisDevice.FriendlyName); try { TwoWayRequest req = new TwoWayRequest(); req.X = x; req.Y = y; TwoWayResponse resp = m_simpleServiceClient.TwoWay(req); if (resp.Sum == 0) { System.Ext.Console.Write(""); System.Ext.Console.Write("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 2way method did not receive a valid response."); } else { System.Ext.Console.Write(""); System.Ext.Console.Write("<<<<<<<<<<<<< 2way response returned " + resp.Sum); } } catch (Exception e) { firstPass = true; m_deviceSelected.Reset(); System.Ext.Console.Write(""); System.Ext.Console.Write("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! TwoWay method failed. " + e.Message); } } // Make 1wayattach or a 2wayattach service calls if (m_deviceSelected.WaitOne(0, false)) { if (!twoWayAttach) { // create an instance of the help icon test object HelpIcon helpIcon = new HelpIcon(); System.Ext.Console.Write(""); System.Ext.Console.Write(">>>>>>>>>>>>> Sending 1wayattach request to: " + m_selectedService.ThisDevice.FriendlyName); try { OneWayAttachmentRequest req = new OneWayAttachmentRequest(); req.Param = helpIcon.Data.ToArray(); m_attachmentServiceClient.OneWayAttachment(req); } catch (Exception e) { firstPass = true; m_deviceSelected.Reset(); System.Ext.Console.Write(""); System.Ext.Console.Write("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 1wayattach method failed: " + e.Message); } } else { // create an instance of the help icon test object HelpIcon helpIcon = new HelpIcon(); System.Ext.Console.Write(""); System.Ext.Console.Write(">>>>>>>>>>>>> Sending 2wayattach request to: " + m_selectedService.ThisDevice.FriendlyName); try { TwoWayAttachmentRequest req = new TwoWayAttachmentRequest(); req.Param = helpIcon.Data.ToArray(); TwoWayAttachmentResponse resp = m_attachmentServiceClient.TwoWayAttachment(req); System.Ext.Console.Write(""); System.Ext.Console.Write("<<<<<<<<<<<<< Sending 2wayattach request succeeded"); } catch (Exception e) { firstPass = true; m_deviceSelected.Reset(); System.Ext.Console.Write(""); System.Ext.Console.Write("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! TwoWay method failed. " + e.Message); } } twoWayAttach = !twoWayAttach; } } else { firstPass = true; } GC.WaitForPendingFinalizers(); } }
public void LoadImageName() { // open folder, get all filenames //AppDomain.CurrentDomain.BaseDirectory string path = AppDomain.CurrentDomain.BaseDirectory + foldername; string[] filenames = Directory.GetFiles(path); // check filename to assign to variables foreach (var fullname in filenames) { string filename = Path.GetFileName(fullname); string[] tokens = StringProcess.SplitString(filename, new string[] { "_" }); if (tokens[0].ToLower() == "Application".ToLower()) { ApplicationIcon.Add ( new MyString() { Value = path + filename } ); } else if (tokens[0].ToLower() == "Option".ToLower()) { OptionIcon.Add ( new MyString() { Value = path + filename } ); } else if (tokens[0].ToLower() == "Remove".ToLower()) { RemoveIcon.Add ( new MyString() { Value = path + filename } ); } else if (tokens[0].ToLower() == "RemoveAll".ToLower()) { RemoveAllIcon.Add ( new MyString() { Value = path + filename } ); } else if (tokens[0].ToLower() == "Add".ToLower()) { AddIcon.Add ( new MyString() { Value = path + filename } ); } else if (tokens[0].ToLower() == "Preview".ToLower()) { PreviewIcon.Add ( new MyString() { Value = path + filename } ); } else if (tokens[0].ToLower() == "Start".ToLower()) { StartIcon.Add ( new MyString() { Value = path + filename } ); } else if (tokens[0].ToLower() == "Refresh".ToLower()) { RefreshIcon.Add ( new MyString() { Value = path + filename } ); } else if (tokens[0].ToLower() == "Help".ToLower()) { HelpIcon.Add ( new MyString() { Value = path + filename } ); } else if (tokens[0].ToLower() == "Open".ToLower()) { OpenIcon.Add ( new MyString() { Value = path + filename } ); } else if (tokens[0].ToLower() == "Save".ToLower()) { SaveIcon.Add ( new MyString() { Value = path + filename } ); } else if (tokens[0].ToLower() == "Information".ToLower()) { InformationIcon.Add ( new MyString() { Value = path + filename } ); } else if (tokens[0].ToLower() == "File".ToLower()) { FileIcon.Add ( new MyString() { Value = path + filename } ); } else if (tokens[0].ToLower() == "Folder".ToLower()) { FolderIcon.Add ( new MyString() { Value = path + filename } ); } else if (tokens[0].ToLower() == "Action".ToLower()) { ActionIcon.Add ( new MyString() { Value = path + filename } ); } else if (tokens[0].ToLower() == "List".ToLower()) { ListIcon.Add ( new MyString() { Value = path + filename } ); } } }
/// <summary> /// Required method for Designer support - do not modify /// the contents of this method with the code editor. /// </summary> private void InitializeComponent() { this.components = new System.ComponentModel.Container(); System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(ExtractableCohortUI)); tbID = new System.Windows.Forms.TextBox(); label5 = new System.Windows.Forms.Label(); lblDescription = new System.Windows.Forms.Label(); label1 = new System.Windows.Forms.Label(); tbOverrideReleaseIdentifierSQL = new System.Windows.Forms.TextBox(); pDescription = new System.Windows.Forms.Panel(); helpIcon1 = new HelpIcon(); tlvCohortUsage = new BrightIdeasSoftware.TreeListView(); olvUsedIn = ((BrightIdeasSoftware.OLVColumn)(new BrightIdeasSoftware.OLVColumn())); tlvPreviousVersions = new BrightIdeasSoftware.TreeListView(); olvOtherVersions = ((BrightIdeasSoftware.OLVColumn)(new BrightIdeasSoftware.OLVColumn())); olvVersion = ((BrightIdeasSoftware.OLVColumn)(new BrightIdeasSoftware.OLVColumn())); splitContainer1 = new System.Windows.Forms.SplitContainer(); label2 = new System.Windows.Forms.Label(); tbVersion = new System.Windows.Forms.TextBox(); label3 = new System.Windows.Forms.Label(); tbProjectNumber = new System.Windows.Forms.TextBox(); btnShowProject = new System.Windows.Forms.Button(); label4 = new System.Windows.Forms.Label(); tbOriginId = new System.Windows.Forms.TextBox(); panel1 = new System.Windows.Forms.Panel(); ((System.ComponentModel.ISupportInitialize)(tlvCohortUsage)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(tlvPreviousVersions)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(splitContainer1)).BeginInit(); splitContainer1.Panel1.SuspendLayout(); splitContainer1.Panel2.SuspendLayout(); splitContainer1.SuspendLayout(); panel1.SuspendLayout(); this.SuspendLayout(); // // tbID // tbID.Location = new System.Drawing.Point(157, 4); tbID.Name = "tbID"; tbID.ReadOnly = true; tbID.Size = new System.Drawing.Size(100, 20); tbID.TabIndex = 12; // // label5 // label5.AutoSize = true; label5.Location = new System.Drawing.Point(130, 7); label5.Name = "label5"; label5.Size = new System.Drawing.Size(21, 13); label5.TabIndex = 11; label5.Text = "ID:"; // // lblDescription // lblDescription.AutoSize = true; lblDescription.Location = new System.Drawing.Point(96, 108); lblDescription.Name = "lblDescription"; lblDescription.Size = new System.Drawing.Size(55, 13); lblDescription.TabIndex = 13; lblDescription.Text = "Audit Log:"; // // label1 // label1.AutoSize = true; label1.Location = new System.Drawing.Point(1, 30); label1.Name = "label1"; label1.Size = new System.Drawing.Size(150, 13); label1.TabIndex = 11; label1.Text = "OverrideReleaseIdentifierSQL:"; // // tbOverrideReleaseIdentifierSQL // tbOverrideReleaseIdentifierSQL.Location = new System.Drawing.Point(157, 30); tbOverrideReleaseIdentifierSQL.Name = "tbOverrideReleaseIdentifierSQL"; tbOverrideReleaseIdentifierSQL.Size = new System.Drawing.Size(468, 20); tbOverrideReleaseIdentifierSQL.TabIndex = 12; tbOverrideReleaseIdentifierSQL.TextChanged += new System.EventHandler(this.tbOverrideReleaseIdentifierSQL_TextChanged); // // pDescription // pDescription.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); pDescription.Location = new System.Drawing.Point(157, 108); pDescription.Name = "pDescription"; pDescription.Size = new System.Drawing.Size(888, 161); pDescription.TabIndex = 15; // // helpIcon1 // helpIcon1.Location = new System.Drawing.Point(631, 30); helpIcon1.Name = "helpIcon1"; helpIcon1.Size = new System.Drawing.Size(19, 19); helpIcon1.TabIndex = 17; // // tlvCohortUsage // tlvCohortUsage.AllColumns.Add(olvUsedIn); tlvCohortUsage.CellEditUseWholeCell = false; tlvCohortUsage.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] { olvUsedIn }); tlvCohortUsage.Cursor = System.Windows.Forms.Cursors.Default; tlvCohortUsage.Dock = System.Windows.Forms.DockStyle.Fill; tlvCohortUsage.Location = new System.Drawing.Point(0, 0); tlvCohortUsage.Name = "tlvCohortUsage"; tlvCohortUsage.ShowGroups = false; tlvCohortUsage.Size = new System.Drawing.Size(539, 276); tlvCohortUsage.TabIndex = 18; tlvCohortUsage.UseCompatibleStateImageBehavior = false; tlvCohortUsage.View = System.Windows.Forms.View.Details; tlvCohortUsage.VirtualMode = true; // // olvUsedIn // olvUsedIn.AspectName = "ToString"; olvUsedIn.FillsFreeSpace = true; olvUsedIn.Text = "Used In"; olvUsedIn.MinimumWidth = 100; // // tlvPreviousVersions // tlvPreviousVersions.AllColumns.Add(olvOtherVersions); tlvPreviousVersions.AllColumns.Add(olvVersion); tlvPreviousVersions.CellEditUseWholeCell = false; tlvPreviousVersions.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] { olvOtherVersions, olvVersion }); tlvPreviousVersions.Cursor = System.Windows.Forms.Cursors.Default; tlvPreviousVersions.Dock = System.Windows.Forms.DockStyle.Fill; tlvPreviousVersions.Location = new System.Drawing.Point(0, 0); tlvPreviousVersions.Name = "tlvPreviousVersions"; tlvPreviousVersions.ShowGroups = false; tlvPreviousVersions.Size = new System.Drawing.Size(496, 276); tlvPreviousVersions.TabIndex = 19; tlvPreviousVersions.UseCompatibleStateImageBehavior = false; tlvPreviousVersions.View = System.Windows.Forms.View.Details; tlvPreviousVersions.VirtualMode = true; // // olvOtherVersions // olvOtherVersions.AspectName = "ToString"; olvOtherVersions.FillsFreeSpace = true; olvOtherVersions.Text = "Other Versions"; olvOtherVersions.MinimumWidth = 100; // // olvVersion // olvVersion.AspectName = "ExternalVersion"; olvVersion.Text = "Version"; // // splitContainer1 // splitContainer1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); splitContainer1.Location = new System.Drawing.Point(4, 275); splitContainer1.Name = "splitContainer1"; // // splitContainer1.Panel1 // splitContainer1.Panel1.Controls.Add(tlvCohortUsage); // // splitContainer1.Panel2 // splitContainer1.Panel2.Controls.Add(tlvPreviousVersions); splitContainer1.Size = new System.Drawing.Size(1039, 276); splitContainer1.SplitterDistance = 539; splitContainer1.TabIndex = 20; // // label2 // label2.AutoSize = true; label2.Location = new System.Drawing.Point(106, 56); label2.Name = "label2"; label2.Size = new System.Drawing.Size(45, 13); label2.TabIndex = 11; label2.Text = "Version:"; // // tbVersion // tbVersion.Location = new System.Drawing.Point(157, 56); tbVersion.Name = "tbVersion"; tbVersion.ReadOnly = true; tbVersion.Size = new System.Drawing.Size(159, 20); tbVersion.TabIndex = 12; tbVersion.TextChanged += new System.EventHandler(this.tbOverrideReleaseIdentifierSQL_TextChanged); // // label3 // label3.AutoSize = true; label3.Location = new System.Drawing.Point(68, 85); label3.Name = "label3"; label3.Size = new System.Drawing.Size(83, 13); label3.TabIndex = 11; label3.Text = "Project Number:"; // // tbProjectNumber // tbProjectNumber.Location = new System.Drawing.Point(157, 82); tbProjectNumber.Name = "tbProjectNumber"; tbProjectNumber.ReadOnly = true; tbProjectNumber.Size = new System.Drawing.Size(159, 20); tbProjectNumber.TabIndex = 12; tbProjectNumber.TextChanged += new System.EventHandler(this.tbOverrideReleaseIdentifierSQL_TextChanged); // // btnShowProject // btnShowProject.Location = new System.Drawing.Point(322, 80); btnShowProject.Name = "btnShowProject"; btnShowProject.Size = new System.Drawing.Size(45, 23); btnShowProject.TabIndex = 21; btnShowProject.Text = "Show"; btnShowProject.UseVisualStyleBackColor = true; btnShowProject.Click += new System.EventHandler(this.btnShowProject_Click); // // label4 // label4.AutoSize = true; label4.Location = new System.Drawing.Point(264, 7); label4.Name = "label4"; label4.Size = new System.Drawing.Size(51, 13); label4.TabIndex = 11; label4.Text = "Origin ID:"; // // tbOriginId // tbOriginId.Location = new System.Drawing.Point(321, 4); tbOriginId.Name = "tbOriginId"; tbOriginId.ReadOnly = true; tbOriginId.Size = new System.Drawing.Size(100, 20); tbOriginId.TabIndex = 12; // // panel1 // panel1.Controls.Add(tbID); panel1.Controls.Add(splitContainer1); panel1.Controls.Add(btnShowProject); panel1.Controls.Add(label5); panel1.Controls.Add(label4); panel1.Controls.Add(helpIcon1); panel1.Controls.Add(tbOriginId); panel1.Controls.Add(pDescription); panel1.Controls.Add(label1); panel1.Controls.Add(lblDescription); panel1.Controls.Add(tbOverrideReleaseIdentifierSQL); panel1.Controls.Add(tbProjectNumber); panel1.Controls.Add(label2); panel1.Controls.Add(label3); panel1.Controls.Add(tbVersion); panel1.Dock = System.Windows.Forms.DockStyle.Fill; panel1.Location = new System.Drawing.Point(0, 0); panel1.Name = "panel1"; panel1.Size = new System.Drawing.Size(1046, 563); panel1.TabIndex = 22; // // ExtractableCohortUI // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.Controls.Add(panel1); this.Name = "ExtractableCohortUI"; this.Size = new System.Drawing.Size(1046, 563); ((System.ComponentModel.ISupportInitialize)(tlvCohortUsage)).EndInit(); ((System.ComponentModel.ISupportInitialize)(tlvPreviousVersions)).EndInit(); splitContainer1.Panel1.ResumeLayout(false); splitContainer1.Panel2.ResumeLayout(false); ((System.ComponentModel.ISupportInitialize)(splitContainer1)).EndInit(); splitContainer1.ResumeLayout(false); panel1.ResumeLayout(false); panel1.PerformLayout(); this.ResumeLayout(false); }
private void CreateLine(IArgumentHost parent, IArgument argument, RequiredPropertyInfo required) { Label name = new Label(); HelpIcon helpIcon = new HelpIcon(); helpIcon.SetHelpText(GetSystemTypeName(argument.GetSystemType()) ?? "Unrecognised Type:" + argument.Type, required.Demand.Description); helpIcon.Anchor = AnchorStyles.Top | AnchorStyles.Left; string spaceSeparatedArgumentName = UsefulStuff.PascalCaseStringToHumanReadable(argument.Name); name.Height = helpIcon.Height; name.Text = spaceSeparatedArgumentName; name.TextAlign = ContentAlignment.MiddleLeft; name.AutoSize = true; name.Anchor = AnchorStyles.Top | AnchorStyles.Left; RAGSmiley ragSmiley = new RAGSmiley(); if (required.Demand.Mandatory && string.IsNullOrWhiteSpace(argument.Value)) { ragSmiley.Fatal(new Exception("Property " + argument.Name + " is Mandatory")); } var args = new ArgumentValueUIArgs(); args.Parent = parent; args.Type = argument.GetSystemType(); try { args.InitialValue = argument.GetValueAsSystemType(); } catch (Exception e) { //add the text value value and report the error if (_valueUisFactory.CanHandleInvalidStringData(args.Type)) { args.InitialValue = argument.Value; } else { args.InitialValue = null; } ragSmiley.Fatal(e); } args.Required = required; args.CatalogueRepository = (ICatalogueRepository)argument.Repository; args.Setter = (v) => { ragSmiley.Reset(); try { argument.SetValue(v); argument.SaveToDatabase(); argument.GetValueAsSystemType(); if (required.Demand.Mandatory && (v == null || string.IsNullOrWhiteSpace(v.ToString()))) { ragSmiley.Fatal(new Exception("Property " + argument.Name + " is Mandatory")); } } catch (Exception ex) { ragSmiley.OnCheckPerformed(new CheckEventArgs("Failed to set property properly", CheckResult.Fail, ex)); } }; args.Fatal = ragSmiley.Fatal; var valueui = (Control)_valueUisFactory.Create(args); valueui.Anchor = name.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right; _valueUIs.Add(valueui); Panel p = new Panel(); p.Height = Math.Max(Math.Max(lblClassName.Height, helpIcon.Height), valueui.Height); p.Width = pArguments.ClientRectangle.Width; p.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right; p.BorderStyle = BorderStyle.FixedSingle; p.Location = new Point(0, _currentY); _currentY += p.Height; name.Location = new Point(0, 0); p.Controls.Add(name); helpIcon.Left = name.Right; p.Controls.Add(helpIcon); ragSmiley.Left = p.Width - ragSmiley.Width; ragSmiley.Anchor = AnchorStyles.Right | AnchorStyles.Top; p.Controls.Add(ragSmiley); valueui.Left = helpIcon.Right; valueui.Width = p.Width - (helpIcon.Right + ragSmiley.Left); _maxValueUILeft = Math.Max(_maxValueUILeft, valueui.Left); p.Controls.Add(valueui); p.MinimumSize = new Size(ragSmiley.Right, p.Height); name.Height = p.Height; pArguments.Controls.Add(p); }
public void LoadImageName() { // open folder, get all filenames string path = AppDomain.CurrentDomain.BaseDirectory + foldername; string[] filenames = Directory.GetFiles(path); // check filename to assign to variables foreach (var fullname in filenames) { string filename = Path.GetFileName(fullname); string[] tokens = filename.Split(new string[] { "_" }, StringSplitOptions.RemoveEmptyEntries); if (tokens[0].ToLower() == "Application".ToLower()) { ApplicationIcon.Add ( path + filename ); } else if (tokens[0].ToLower() == "Option".ToLower()) { OptionIcon.Add ( path + filename ); } else if (tokens[0].ToLower() == "Remove".ToLower()) { RemoveIcon.Add ( path + filename ); } else if (tokens[0].ToLower() == "RemoveAll".ToLower()) { RemoveAllIcon.Add ( path + filename ); } else if (tokens[0].ToLower() == "Add".ToLower()) { AddIcon.Add ( path + filename ); } else if (tokens[0].ToLower() == "Preview".ToLower()) { PreviewIcon.Add ( path + filename ); } else if (tokens[0].ToLower() == "Start".ToLower()) { StartIcon.Add ( path + filename ); } else if (tokens[0].ToLower() == "Refresh".ToLower()) { RefreshIcon.Add ( path + filename ); } else if (tokens[0].ToLower() == "Help".ToLower()) { HelpIcon.Add ( path + filename ); } else if (tokens[0].ToLower() == "Open".ToLower()) { OpenIcon.Add ( path + filename ); } else if (tokens[0].ToLower() == "Save".ToLower()) { SaveIcon.Add ( path + filename ); } else if (tokens[0].ToLower() == "Information".ToLower()) { InformationIcon.Add ( path + filename ); } else if (tokens[0].ToLower() == "File".ToLower()) { FileIcon.Add ( path + filename ); } else if (tokens[0].ToLower() == "Folder".ToLower()) { FolderIcon.Add ( path + filename ); } else if (tokens[0].ToLower() == "Action".ToLower()) { ActionIcon.Add ( path + filename ); } else if (tokens[0].ToLower() == "List".ToLower()) { ListIcon.Add ( path + filename ); } else if (tokens[0].ToLower() == "UpDirection".ToLower()) { UpDirectionIcon.Add ( path + filename ); } else if (tokens[0].ToLower() == "RightDirection".ToLower()) { RightDirectionIcon.Add ( path + filename ); } else if (tokens[0].ToLower() == "DownDirection".ToLower()) { DownDirectionIcon.Add ( path + filename ); } else if (tokens[0].ToLower() == "LeftDirection".ToLower()) { LeftDirectionIcon.Add ( path + filename ); } else { Images.Add ( path + filename ); } } }