Search Results

Search found 210 results on 9 pages for 'backcolor'.

Page 4/9 | < Previous Page | 1 2 3 4 5 6 7 8 9  | Next Page >

  • How to find the one Label in DataList that is set to True

    - by Doug
    In my .aspx page I have my DataList: <asp:DataList ID="DataList1" runat="server" DataKeyField="ProductSID" DataSourceID="SqlDataSource1" onitemcreated="DataList1_ItemCreated" RepeatColumns="3" RepeatDirection="Horizontal" Width="1112px"> <ItemTemplate> ProductSID: <asp:Label ID="ProductSIDLabel" runat="server" Text='<%# Eval("ProductSID") %>' /> <br /> ProductSKU: <asp:Label ID="ProductSKULabel" runat="server" Text='<%# Eval("ProductSKU") %>' /> <br /> ProductImage1: <asp:Label ID="ProductImage1Label" runat="server" Text='<%# Eval("ProductImage1") %>' /> <br /> ShowLive: <asp:Label ID="ShowLiveLabel" runat="server" Text='<%# Eval("ShowLive") %>' /> <br /> CollectionTypeID: <asp:Label ID="CollectionTypeIDLabel" runat="server" Text='<%# Eval("CollectionTypeID") %>' /> <br /> CollectionHomePage: <asp:Label ID="CollectionHomePageLabel" runat="server" Text='<%# Eval("CollectionHomePage") %>' /> <br /> <br /> </ItemTemplate> </asp:DataList> And in my code behind using the ItemCreated event to find and set the label.backcolor property. (Note:I'm using a recursive findControl class) protected void DataList1_ItemCreated(object sender, DataListItemEventArgs e) { foreach (DataListItem item in DataList1.Items) { if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem) { Label itemLabel = form1.FindControlR("CollectionHomePageLabel") as Label; if (itemLabel !=null || itemLabel.Text == "True") { itemLabel.BackColor = System.Drawing.Color.Yellow; } } When I run the page, the itemLabel is found, and the color shows. But it sets the itemLabel color to the first instance of the itemLabel found in the DataList. Of all the itemLabels in the DataList, only one will have it's text = True - and that should be the label picking up the backcolor. Also: The itemLabel is picking up a column in the DB called "CollectionHomePage" which is True/False bit data type. I must be missing something simple... Thanks for your ideas.

    Read the article

  • How can I easily keep consistent UI settings in C# Winform application?

    - by Lukas
    I have a lot of different UserControls and would like to maintain consistent UI settings (mainly colors and fonts). My first try was this: public class UISettings { //... public void SetupUserControl(ref UserControl ctrl) { ctrl.BackColor = this.BackColor; } } to be called in every control like this: settings.SetupUserControl(ref this); As this is read-only it cannot be passed by ref argument so this does not work. What are other options to keep consistent UI without manually changing properties for every item?

    Read the article

  • GDI (2 replies)

    Hallo, I have a small (hopefully) problem... I defined an user control that in the Paint overriden method does the following things: protected override void OnPaint( PaintEventArgs e ) { e.Graphics.Clear( BackColor ); e.Graphics.SmoothingMode SmoothingMode; e.Graphics.CompositingQuality CompositingQuality; e.Graphics.InterpolationMode InterpolationMode; e.Graphics.TextRenderingHint TextRenderingHi...

    Read the article

  • Drawing a transparent button in C# winforms

    - by SAMIR BHOGAYTA
    public class ImageButton : ButtonBase, IButtonControl { public ImageButton() { this.SetStyle( ControlStyles.SupportsTransparentBackColor | ControlStyles.OptimizedDoubleBuffer | ControlStyles.AllPaintingInWmPaint | ControlStyles.ResizeRedraw | ControlStyles.UserPaint, true); this.BackColor = Color.Transparent; } protected override void OnPaint(PaintEventArgs pevent) { Graphics g = pevent.Graphics; g.FillRectangle(Brushes.Transparent, this.ClientRectangle); g.DrawRectangle(Pens.Black, this.ClientRectangle); } // rest of class here... }

    Read the article

  • GDI (2 replies)

    Hallo, I have a small (hopefully) problem... I defined an user control that in the Paint overriden method does the following things: protected override void OnPaint( PaintEventArgs e ) { e.Graphics.Clear( BackColor ); e.Graphics.SmoothingMode SmoothingMode; e.Graphics.CompositingQuality CompositingQuality; e.Graphics.InterpolationMode InterpolationMode; e.Graphics.TextRenderingHint TextRenderingHi...

    Read the article

  • SharpGL: Can't draw all lines from List

    - by Miko Kronn
    I have: float[,] nodesN = null; //indexes: //number of node; //value index 0->x, 1->y, 2->temperature int[,] elements = null; //indexes: //indexof element (triangle) //1, 2, 3 - vertexes (from nodesN) List<Pair> edges = null; //Pair is a class containing two int values which are //indexes of nodesN And function which is supposed do all elements and edges on SharpGL.OpenGLCtrl private void openGLCtrl1_Load(object sender, EventArgs e) { gl = this.glCtrl.OpenGL; gl.ClearColor(this.BackColor.R / 255.0f, this.BackColor.G / 255.0f, this.BackColor.B / 255.0f, 1.0f); gl.Clear(OpenGL.COLOR_BUFFER_BIT | OpenGL.DEPTH_BUFFER_BIT); } float glMinX = -2f; float glMaxX = 2f; float glMinY = -2f; float glMaxY = 2f; private void openGLControl1_OpenGLDraw(object sender, PaintEventArgs e) { gl.Clear(OpenGL.COLOR_BUFFER_BIT | OpenGL.DEPTH_BUFFER_BIT); gl.LoadIdentity(); gl.Translate(0.0f, 0.0f, -6.0f); if (!draw) return; bool drawElements = false; if (drawElements) { gl.Begin(OpenGL.TRIANGLES); for (int i = 0; i < elementNo; i++) { for (int j = 0; j < 3; j++) { float x, y, t; x = nodesN[elements[i, j], 0]; y = nodesN[elements[i, j], 1]; t = nodesN[elements[i, j], 2]; gl.Color(t, 0.0f, 1.0f - t); gl.Vertex(x, y, 0.0f); } } gl.End(); } gl.Color(0f, 0f, 0f); gl.Begin(OpenGL.LINES); //for(int i=edges.Count-1; i>=0; i--) for(int i=0; i<edges.Count; i++) { float x1, y1, x2, y2; x1 = nodesN[edges[i].First, 0]; y1 = nodesN[edges[i].First, 1]; x2 = nodesN[edges[i].Second, 0]; y2 = nodesN[edges[i].Second, 1]; gl.Vertex(x1, y1, 0.0f); gl.Vertex(x2, y2, 0.0f); } gl.End(); } But it doesn't draw all the edges. If i change drawElements it draws different number of edges. Changing for(int i=0; i<edges.Count; i++) to for(int i=edges.Count-1; i>=0; i--) shows that esges are generated correctly, but they are not drawn. Images: for(int i=0; i<edges.Count; i++) drawElements=false for(int i=edges.Count-1; i>=0; i--) drawElements=false for(int i=0; i<edges.Count; i++) drawElements=true for(int i=edges.Count-1; i>=0; i--) drawElements=true What is wrong with this? How can I draw all edges?

    Read the article

  • Improved appointment rendering in RadScheduler for ASP.NET AJAX, Q1 2010

    Now that Q1 2010 release is out in the wild, we can sit down and discuss some of the changes we decided to make in the new release. One of them is the new appointment rendering of RadScheduler - a potentially breaking change, but a much needed one. If you have problems with your old custom skins, include the old base stylesheet along with your RadScheduler and set EnableEmbeddedBaseStylesheet=false in your RadScheduler. You can find the said base stylesheet attached to this post.   While trying to improve the performance of RadScheduler, I noticed that the number of resources slows down the rendering and overall performance considerably. This had to be expected - the images to support the appointment rounded corners (and the predefined resources) were quite large. However, I didnt take into account that all browsers keep for performance reasons their images uncompressed in memory and with the color depth of the current desktop. A simple calculation later I discovered that the appointment sprite itself is taking 25MB memory when loaded. Add 5 resources to the fray and you have 150MB memory down with a single blow. As it turns out - a sprite image is not a panacea, if it gets too big - dont be afraid to break it in two. The loading time may suffer, but your browser suffers more while rendering a 25MB monster. First I thought of undertaking the aforementioned solution - breaking the appointment sprite in two and thus reducing the two appointment sprites to mere 2MB uncompressed. Then I thought - the rounded corners are small - I can use borders and backgrounds to simulate rounded appointment borders while still keeping the same HTML structure. The gradients can be done with a single 10x50px image plus we have a gain - border colors and backgrounds can be changed on the fly.  I started with five rendering elements at first, then tried with four and finally I settled on only three elements.  Behold the new appointment rendering (quite simple really):       On the left you can see that the first container has only top and bottom borders and a background. In fact, the background isnt even needed since it will be obscured by the elements on top of it. The whole first container is only needed for the four dots that reside in the four corners of the appointment. On top of this container is another one that holds the left and right borders and slightly lighter background to create the illusion of a second lighter border beside the other two. At last on top of all others is placed the text container that also holds the top and bottom borders and the gradient background. On the right you can see the final result - Im quite happy with it and I hope you will be too. After creating the new rendering we took another step further - we decided to use alpha gradients for the resource rendering, thus supporting any color appointments with rounded corners and gradients. You can see some examples below:We plan on adding BorderColor and BackColor properties  to the ResourceStyles definitions for Q1 SP1. However with the new rendering in Q1 2010 we do support BackColor and BorderColor appointment properties - you only need to set AppointmentStyleMode=Default to keep RadScheduler from switching to Simple appointment rendering. Here is one screenshot of RadScheduler with appointments set to different colors: I hope that you will enjoy working with the new appointments in RadScheduler. RadScheduler base stylesheet Did you know that DotNetSlackers also publishes .net articles written by top known .net Authors? We already have over 80 articles in several categories including Silverlight. Take a look: here.

    Read the article

  • Improved appointment rendering in RadScheduler for ASP.NET AJAX, Q1 2010

    Now that Q1 2010 release is out in the wild, we can sit down and discuss some of the changes we decided to make in the new release. One of them is the new appointment rendering of RadScheduler - a potentially breaking change, but a much needed one. If you have problems with your old custom skins, include the old base stylesheet along with your RadScheduler and set EnableEmbeddedBaseStylesheet=false in your RadScheduler. You can find the said base stylesheet attached to this post.   While trying to improve the performance of RadScheduler, I noticed that the number of resources slows down the rendering and overall performance considerably. This had to be expected - the images to support the appointment rounded corners (and the predefined resources) were quite large. However, I didnt take into account that all browsers keep for performance reasons their images uncompressed in memory and with the color depth of the current desktop. A simple calculation later I discovered that the appointment sprite itself is taking 25MB memory when loaded. Add 5 resources to the fray and you have 150MB memory down with a single blow. As it turns out - a sprite image is not a panacea, if it gets too big - dont be afraid to break it in two. The loading time may suffer, but your browser suffers more while rendering a 25MB monster. First I thought of undertaking the aforementioned solution - breaking the appointment sprite in two and thus reducing the two appointment sprites to mere 2MB uncompressed. Then I thought - the rounded corners are small - I can use borders and backgrounds to simulate rounded appointment borders while still keeping the same HTML structure. The gradients can be done with a single 10x50px image plus we have a gain - border colors and backgrounds can be changed on the fly.  I started with five rendering elements at first, then tried with four and finally I settled on only three elements.  Behold the new appointment rendering (quite simple really):       On the left you can see that the first container has only top and bottom borders and a background. In fact, the background isnt even needed since it will be obscured by the elements on top of it. The whole first container is only needed for the four dots that reside in the four corners of the appointment. On top of this container is another one that holds the left and right borders and slightly lighter background to create the illusion of a second lighter border beside the other two. At last on top of all others is placed the text container that also holds the top and bottom borders and the gradient background. On the right you can see the final result - Im quite happy with it and I hope you will be too. After creating the new rendering we took another step further - we decided to use alpha gradients for the resource rendering, thus supporting any color appointments with rounded corners and gradients. You can see some examples below:We plan on adding BorderColor and BackColor properties  to the ResourceStyles definitions for Q1 SP1. However with the new rendering in Q1 2010 we do support BackColor and BorderColor appointment properties - you only need to set AppointmentStyleMode=Default to keep RadScheduler from switching to Simple appointment rendering. Here is one screenshot of RadScheduler with appointments set to different colors: I hope that you will enjoy working with the new appointments in RadScheduler. RadScheduler base stylesheet Did you know that DotNetSlackers also publishes .net articles written by top known .net Authors? We already have over 80 articles in several categories including Silverlight. Take a look: here.

    Read the article

  • Long labels appear to be hidden with "..." - MS Chart Pie Graph control

    - by Mike
    I would like the labels to be completely visible, and if necessary, just spin the pie chart so that the text will fit without being hidden with "...". Here is an example Anyone know how to fix this so it is not shortened? This is the control on my asp page. <asp:CHART ID="Chart1" runat="server" BorderColor="181, 64, 1" BorderDashStyle="Solid" BorderWidth="2" Height="371px" ImageLocation="~/TempImages/ChartPic_#SEQ(300,3)" ImageType="Png" Palette="None" Width="693px" BorderlineColor=""> <legends> <asp:Legend BackColor="Transparent" Enabled="False" Font="Trebuchet MS, 8.25pt, style=Bold" IsTextAutoFit="True" Name="Default"> </asp:Legend> </legends> <series> <asp:Series ChartArea="ChartArea1" ChartType="Pie" Legend="Default" Name="Series1" CustomProperties="PieLabelStyle=Outside, PieDrawingStyle=Concave" YValuesPerPoint="6" Font="Trebuchet MS, 8.25pt, style=Bold"> <SmartLabelStyle AllowOutsidePlotArea="No" MaxMovingDistance="100" /> </asp:Series> </series> <chartareas> <asp:ChartArea BackColor="#DEEDF7" BackGradientStyle="TopBottom" BackSecondaryColor="White" BorderColor="64, 64, 64, 64" BorderDashStyle="Solid" Name="ChartArea1" ShadowColor="Transparent"> <Area3DStyle Enable3D="True" IsRightAngleAxes="False" /> </asp:ChartArea> </chartareas> </asp:CHART> Thanks.

    Read the article

  • Winform/Program and how to write array information to linklabels?!!?

    - by JB
    So my program works like this: using winforms, user enters ID number, using an array, based on the right id number, that student information and class schedule outputs in a message box! My question is how to take the 4 classes in the message box/array and write them to the linklabel text in form 2???? My Getschedule class contains the array and is listed below: namespace Eagle_Eye_Class_Finder { public class GetSchedule { IDnumber[] IDnumbers = new IDnumber[3]; public string GetDataFromNumber(string ID) { foreach (IDnumber IDCandidateMatch in IDnumbers) { if (IDCandidateMatch.ID == ID) { StringBuilder myData = new StringBuilder(); myData.AppendLine(IDCandidateMatch.Name); myData.AppendLine(": "); myData.AppendLine(IDCandidateMatch.ID); myData.AppendLine(IDCandidateMatch.year); myData.AppendLine(IDCandidateMatch.class1); myData.AppendLine(IDCandidateMatch.class2); myData.AppendLine(IDCandidateMatch.class3); myData.AppendLine(IDCandidateMatch.class4); //return myData; return myData.ToString(); } } return ""; } public GetSchedule() { IDnumbers[0] = new IDnumber() { Name = "Joshua Banks", ID = "900456317", year = "Senior", class1 = "TEET 4090", class2 = "TEET 3020", class3 = "TEET 3090", class4 = "TEET 4290" }; IDnumbers[1] = new IDnumber() { Name = "Sean Ward", ID = "900456318", year = "Junior", class1 = "ENGNR 4090", class2 = "ENGNR 3020", class3 = "ENGNR 3090", class4 = "ENGNR 4290" }; IDnumbers[2] = new IDnumber() { Name = "Terrell Johnson", ID = "900456319", year = "Sophomore", class1 = "BUS 4090", class2 = "BUS 3020", class3 = "BUS 3090", class4 = "BUS 4290" }; } public class IDnumber { public string Name { get; set; } public string ID { get; set; } public string year { get; set; } public string class1 { get; set; } public string class2 { get; set; } public string class3 { get; set; } public string class4 { get; set; } public static void ProcessNumber(IDnumber myNum) { StringBuilder myData = new StringBuilder(); myData.AppendLine(myNum.Name); myData.AppendLine(": "); myData.AppendLine(myNum.ID); myData.AppendLine(myNum.year); myData.AppendLine(myNum.class1); myData.AppendLine(myNum.class2); myData.AppendLine(myNum.class3); myData.AppendLine(myNum.class4); MessageBox.Show(myData.ToString()); } } } } My form 2 which will contain the linklabels is listed below: public class YOURCLASSSCHEDULE : System.Windows.Forms.Form { public System.Windows.Forms.LinkLabel linkLabel1; public System.Windows.Forms.LinkLabel linkLabel2; public System.Windows.Forms.LinkLabel linkLabel3; public System.Windows.Forms.LinkLabel linkLabel4; private Button button1; /// Required designer variable. public System.ComponentModel.Container components = null; public YOURCLASSSCHEDULE() { // InitializeComponent(); // TODO: Add any constructor code after InitializeComponent call } /// Clean up any resources being used. protected override void Dispose(bool disposing) { if (disposing) { if (components != null) { components.Dispose(); } } base.Dispose(disposing); } #region Windows Form Designer generated code /// <summary> /// Required method for Designer support - do not modify /// the contents of this method with the code editor. /// </summary> private void InitializeComponent() { System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(YOURCLASSSCHEDULE)); this.linkLabel1 = new System.Windows.Forms.LinkLabel(); this.linkLabel2 = new System.Windows.Forms.LinkLabel(); this.linkLabel3 = new System.Windows.Forms.LinkLabel(); this.linkLabel4 = new System.Windows.Forms.LinkLabel(); this.button1 = new System.Windows.Forms.Button(); this.SuspendLayout(); // // linkLabel1 // this.linkLabel1.BackColor = System.Drawing.SystemColors.ActiveCaption; this.linkLabel1.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D; this.linkLabel1.Font = new System.Drawing.Font("Times New Roman", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.linkLabel1.LinkArea = new System.Windows.Forms.LinkArea(0, 7); this.linkLabel1.LinkBehavior = System.Windows.Forms.LinkBehavior.HoverUnderline; this.linkLabel1.Location = new System.Drawing.Point(41, 123); this.linkLabel1.Name = "linkLabel1"; this.linkLabel1.Size = new System.Drawing.Size(288, 32); this.linkLabel1.TabIndex = 1; this.linkLabel1.TabStop = true; this.linkLabel1.Text = "Class 1"; this.linkLabel1.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; this.linkLabel1.LinkClicked += new System.Windows.Forms.LinkLabelLinkClickedEventHandler(this.linkLabel1_LinkClicked); // // linkLabel2 // this.linkLabel2.BackColor = System.Drawing.SystemColors.ActiveCaption; this.linkLabel2.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D; this.linkLabel2.Font = new System.Drawing.Font("Times New Roman", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.linkLabel2.LinkBehavior = System.Windows.Forms.LinkBehavior.HoverUnderline; this.linkLabel2.Location = new System.Drawing.Point(467, 123); this.linkLabel2.Name = "linkLabel2"; this.linkLabel2.Size = new System.Drawing.Size(288, 32); this.linkLabel2.TabIndex = 2; this.linkLabel2.TabStop = true; this.linkLabel2.Text = "Class 2"; this.linkLabel2.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; this.linkLabel2.VisitedLinkColor = System.Drawing.Color.Navy; this.linkLabel2.LinkClicked += new System.Windows.Forms.LinkLabelLinkClickedEventHandler(this.linkLabel2_LinkClicked); // // linkLabel3 // this.linkLabel3.BackColor = System.Drawing.SystemColors.ActiveCaption; this.linkLabel3.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D; this.linkLabel3.Font = new System.Drawing.Font("Times New Roman", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.linkLabel3.LinkBehavior = System.Windows.Forms.LinkBehavior.HoverUnderline; this.linkLabel3.Location = new System.Drawing.Point(41, 311); this.linkLabel3.Name = "linkLabel3"; this.linkLabel3.Size = new System.Drawing.Size(288, 32); this.linkLabel3.TabIndex = 3; this.linkLabel3.TabStop = true; this.linkLabel3.Text = "Class 3"; this.linkLabel3.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; this.linkLabel3.LinkClicked += new System.Windows.Forms.LinkLabelLinkClickedEventHandler(this.linkLabel3_LinkClicked); // // linkLabel4 // this.linkLabel4.BackColor = System.Drawing.SystemColors.ActiveCaption; this.linkLabel4.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D; this.linkLabel4.Font = new System.Drawing.Font("Times New Roman", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.linkLabel4.LinkBehavior = System.Windows.Forms.LinkBehavior.HoverUnderline; this.linkLabel4.Location = new System.Drawing.Point(467, 311); this.linkLabel4.Name = "linkLabel4"; this.linkLabel4.Size = new System.Drawing.Size(288, 32); this.linkLabel4.TabIndex = 4; this.linkLabel4.TabStop = true; this.linkLabel4.Text = "Class 4"; this.linkLabel4.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; this.linkLabel4.LinkClicked += new System.Windows.Forms.LinkLabelLinkClickedEventHandler(this.linkLabel4_LinkClicked); // // this.AutoScaleBaseSize = new System.Drawing.Size(6, 15); this.BackgroundImage = ((System.Drawing.Image)(resources.GetObject("$this.BackgroundImage"))); this.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch; this.ClientSize = new System.Drawing.Size(790, 482); this.Controls.Add(this.button1); this.Controls.Add(this.linkLabel4); this.Controls.Add(this.linkLabel3); this.Controls.Add(this.linkLabel2); this.Controls.Add(this.linkLabel1); this.Font = new System.Drawing.Font("OldDreadfulNo7 BT", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.Name = "YOURCLASSSCHEDULE"; this.Text = "Your Classes"; this.Load += new System.EventHandler(this.Form2_Load); this.ResumeLayout(false); } #endregion public void Form2_Load(object sender, System.EventArgs e) { // if (text == "900456317") // { //} } public void linkLabel1_LinkClicked(object sender, System.Windows.Forms.LinkLabelLinkClickedEventArgs e) { System.Diagnostics.Process.Start("http://www.georgiasouthern.edu/map/"); } private void linkLabel2_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e) { } private void linkLabel3_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e) { } private void linkLabel4_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e) { } private void button1_Click(object sender, EventArgs e) { Form1 form1 = new Form1(); form1.Show(); this.Hide(); } } }

    Read the article

  • Winform/Program and how to write class 1, class 2, class 3, class 4 in array to linklabels?!!?

    - by JB
    So my program works like this: using winforms, user enters ID number, using an array, based on the right id number, that student information and class schedule outputs in a message box! My question is how to take the 4 classes in the message box/array and write them to the linklabel text in form 2???? My Getschedule class contains the array and is listed below: namespace Eagle_Eye_Class_Finder { public class GetSchedule { IDnumber[] IDnumbers = new IDnumber[3]; public string GetDataFromNumber(string ID) { foreach (IDnumber IDCandidateMatch in IDnumbers) { if (IDCandidateMatch.ID == ID) { StringBuilder myData = new StringBuilder(); myData.AppendLine(IDCandidateMatch.Name); myData.AppendLine(": "); myData.AppendLine(IDCandidateMatch.ID); myData.AppendLine(IDCandidateMatch.year); myData.AppendLine(IDCandidateMatch.class1); myData.AppendLine(IDCandidateMatch.class2); myData.AppendLine(IDCandidateMatch.class3); myData.AppendLine(IDCandidateMatch.class4); //return myData; return myData.ToString(); } } return ""; } public GetSchedule() { IDnumbers[0] = new IDnumber() { Name = "Joshua Banks", ID = "900456317", year = "Senior", class1 = "TEET 4090", class2 = "TEET 3020", class3 = "TEET 3090", class4 = "TEET 4290" }; IDnumbers[1] = new IDnumber() { Name = "Sean Ward", ID = "900456318", year = "Junior", class1 = "ENGNR 4090", class2 = "ENGNR 3020", class3 = "ENGNR 3090", class4 = "ENGNR 4290" }; IDnumbers[2] = new IDnumber() { Name = "Terrell Johnson", ID = "900456319", year = "Sophomore", class1 = "BUS 4090", class2 = "BUS 3020", class3 = "BUS 3090", class4 = "BUS 4290" }; } public class IDnumber { public string Name { get; set; } public string ID { get; set; } public string year { get; set; } public string class1 { get; set; } public string class2 { get; set; } public string class3 { get; set; } public string class4 { get; set; } public static void ProcessNumber(IDnumber myNum) { StringBuilder myData = new StringBuilder(); myData.AppendLine(myNum.Name); myData.AppendLine(": "); myData.AppendLine(myNum.ID); myData.AppendLine(myNum.year); myData.AppendLine(myNum.class1); myData.AppendLine(myNum.class2); myData.AppendLine(myNum.class3); myData.AppendLine(myNum.class4); MessageBox.Show(myData.ToString()); } } } } My form 2 which will contain the linklabels is listed below: public class YOURCLASSSCHEDULE : System.Windows.Forms.Form { public System.Windows.Forms.LinkLabel linkLabel1; public System.Windows.Forms.LinkLabel linkLabel2; public System.Windows.Forms.LinkLabel linkLabel3; public System.Windows.Forms.LinkLabel linkLabel4; private Button button1; /// Required designer variable. public System.ComponentModel.Container components = null; public YOURCLASSSCHEDULE() { // InitializeComponent(); // TODO: Add any constructor code after InitializeComponent call } /// Clean up any resources being used. protected override void Dispose(bool disposing) { if (disposing) { if (components != null) { components.Dispose(); } } base.Dispose(disposing); } #region Windows Form Designer generated code /// <summary> /// Required method for Designer support - do not modify /// the contents of this method with the code editor. /// </summary> private void InitializeComponent() { System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(YOURCLASSSCHEDULE)); this.linkLabel1 = new System.Windows.Forms.LinkLabel(); this.linkLabel2 = new System.Windows.Forms.LinkLabel(); this.linkLabel3 = new System.Windows.Forms.LinkLabel(); this.linkLabel4 = new System.Windows.Forms.LinkLabel(); this.button1 = new System.Windows.Forms.Button(); this.SuspendLayout(); // // linkLabel1 // this.linkLabel1.BackColor = System.Drawing.SystemColors.ActiveCaption; this.linkLabel1.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D; this.linkLabel1.Font = new System.Drawing.Font("Times New Roman", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.linkLabel1.LinkArea = new System.Windows.Forms.LinkArea(0, 7); this.linkLabel1.LinkBehavior = System.Windows.Forms.LinkBehavior.HoverUnderline; this.linkLabel1.Location = new System.Drawing.Point(41, 123); this.linkLabel1.Name = "linkLabel1"; this.linkLabel1.Size = new System.Drawing.Size(288, 32); this.linkLabel1.TabIndex = 1; this.linkLabel1.TabStop = true; this.linkLabel1.Text = "Class 1"; this.linkLabel1.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; this.linkLabel1.LinkClicked += new System.Windows.Forms.LinkLabelLinkClickedEventHandler(this.linkLabel1_LinkClicked); // // linkLabel2 // this.linkLabel2.BackColor = System.Drawing.SystemColors.ActiveCaption; this.linkLabel2.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D; this.linkLabel2.Font = new System.Drawing.Font("Times New Roman", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.linkLabel2.LinkBehavior = System.Windows.Forms.LinkBehavior.HoverUnderline; this.linkLabel2.Location = new System.Drawing.Point(467, 123); this.linkLabel2.Name = "linkLabel2"; this.linkLabel2.Size = new System.Drawing.Size(288, 32); this.linkLabel2.TabIndex = 2; this.linkLabel2.TabStop = true; this.linkLabel2.Text = "Class 2"; this.linkLabel2.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; this.linkLabel2.VisitedLinkColor = System.Drawing.Color.Navy; this.linkLabel2.LinkClicked += new System.Windows.Forms.LinkLabelLinkClickedEventHandler(this.linkLabel2_LinkClicked); // // linkLabel3 // this.linkLabel3.BackColor = System.Drawing.SystemColors.ActiveCaption; this.linkLabel3.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D; this.linkLabel3.Font = new System.Drawing.Font("Times New Roman", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.linkLabel3.LinkBehavior = System.Windows.Forms.LinkBehavior.HoverUnderline; this.linkLabel3.Location = new System.Drawing.Point(41, 311); this.linkLabel3.Name = "linkLabel3"; this.linkLabel3.Size = new System.Drawing.Size(288, 32); this.linkLabel3.TabIndex = 3; this.linkLabel3.TabStop = true; this.linkLabel3.Text = "Class 3"; this.linkLabel3.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; this.linkLabel3.LinkClicked += new System.Windows.Forms.LinkLabelLinkClickedEventHandler(this.linkLabel3_LinkClicked); // // linkLabel4 // this.linkLabel4.BackColor = System.Drawing.SystemColors.ActiveCaption; this.linkLabel4.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D; this.linkLabel4.Font = new System.Drawing.Font("Times New Roman", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.linkLabel4.LinkBehavior = System.Windows.Forms.LinkBehavior.HoverUnderline; this.linkLabel4.Location = new System.Drawing.Point(467, 311); this.linkLabel4.Name = "linkLabel4"; this.linkLabel4.Size = new System.Drawing.Size(288, 32); this.linkLabel4.TabIndex = 4; this.linkLabel4.TabStop = true; this.linkLabel4.Text = "Class 4"; this.linkLabel4.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; this.linkLabel4.LinkClicked += new System.Windows.Forms.LinkLabelLinkClickedEventHandler(this.linkLabel4_LinkClicked); // // this.AutoScaleBaseSize = new System.Drawing.Size(6, 15); this.BackgroundImage = ((System.Drawing.Image)(resources.GetObject("$this.BackgroundImage"))); this.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch; this.ClientSize = new System.Drawing.Size(790, 482); this.Controls.Add(this.button1); this.Controls.Add(this.linkLabel4); this.Controls.Add(this.linkLabel3); this.Controls.Add(this.linkLabel2); this.Controls.Add(this.linkLabel1); this.Font = new System.Drawing.Font("OldDreadfulNo7 BT", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.Name = "YOURCLASSSCHEDULE"; this.Text = "Your Classes"; this.Load += new System.EventHandler(this.Form2_Load); this.ResumeLayout(false); } #endregion public void Form2_Load(object sender, System.EventArgs e) { // if (text == "900456317") // { //} } public void linkLabel1_LinkClicked(object sender, System.Windows.Forms.LinkLabelLinkClickedEventArgs e) { System.Diagnostics.Process.Start("http://www.georgiasouthern.edu/map/"); } private void linkLabel2_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e) { } private void linkLabel3_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e) { } private void linkLabel4_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e) { } private void button1_Click(object sender, EventArgs e) { Form1 form1 = new Form1(); form1.Show(); this.Hide(); } } }

    Read the article

  • tree view; show lines property is not working properly

    - by Jibu P C
    Hii, I am a bigginer in using tree view control. I am using tree view control to make a simple tree like structure. But when i use show lines property it is not connecting to the root node. The code which i have written is as follows. <asp:TreeView ID="treeSettings" runat="server" ImageSet="Simple2" NodeIndent="15" ShowLines="True"> <ParentNodeStyle Font-Bold="False" /> <HoverNodeStyle BackColor="#CCCCCC" BorderColor="#888888" BorderStyle="None" Font-Underline="True" /> <SelectedNodeStyle BackColor="#FFCCCC" Font-Underline="False" HorizontalPadding="0px" VerticalPadding="1px" Height="0px" /> <Nodes> <asp:TreeNode Text="Settings" Value="Settings"> <asp:TreeNode Text="Edit Task" Value="Edit Task"></asp:TreeNode> <asp:TreeNode Text="Assign" Value="Assign a Resource"></asp:TreeNode> <asp:TreeNode Text="Task Status" Value="Task Status"></asp:TreeNode> </asp:TreeNode> </Nodes> <NodeStyle Font-Names="Verdana" Font-Size="8pt" ForeColor="Black" HorizontalPadding="0px" NodeSpacing="1px" VerticalPadding="0px" Width="100px" ChildNodesPadding="0px" /> <LeafNodeStyle NodeSpacing="0px" /> </asp:TreeView>enter code here`

    Read the article

  • For each <item> in CheckedListBox. <item> returns as Object and not as Control

    - by Tivie
    Hello there. I have a CheckedListBox previously populated. I want to loop with a "for each / next" through all items in the CheckedListBox and do a lot of "stuff" with each iteration element of the checkedlistbox. example code: For Each item In CheckedListBox1.Items If item.Checked = True Then 'do stuff like item.BackColor = Color.Blue Else 'do other stuff item.BackColor = Color.Brown End If Next the problem is that is an 'Object' type and not a 'Control' type. If I force the iteration var As CheckBox, it throws an InvalidCastException saying that type 'System.String' can't be associated with type 'System.Windows.Forms.CheckBox' I know I can easily work around using for i=0 to CheckedListBox.Items.Count - 1 but I want to use a for each /next loop since I have a lot of code in that loop (and With can't be used) and always poiting directly to the object is something I wish to avoid and I really need the code to be as simple as possible. I actually spent one afternoon looking for this but couldn't find any answer. If someone could be kind enough to enlight me in this, it would be extremely appreciated. Best regards

    Read the article

  • I'm having trouble spacing a menu control in an ASP.NET page. Is my solution the correct way to do t

    - by pkiyan
    Hey, I added a menu control to my page that is displayed vertically. I couldn't find a way to add spaces (I'd like about 5px.) between the menu items, so I just did something similar to this: <asp:Menu ID="Menu1" runat="server" BackColor="ActiveBorder"> <Items> <asp:MenuItem NavigateUrl="~/About.aspx" Text="One" /> </Items> </asp:Menu> <p></p> <asp:Menu ID="Menu2" runat="server" BackColor="ActiveBorder"> <Items> <asp:MenuItem NavigateUrl="~/Default.aspx" Text="Two" /> </Items> </asp:Menu> I just created multiple menu controls with a single menu item control in them, and placed a break between the menu controls. This seems very wrong to me, but I could not figure out another way. Also, this is a bit off subject, but is it okay to use empty paragraph tags as line breaks?(sometimes a br tag is too much) Thanks..

    Read the article

  • What Color is the Windows' System.Control? (Visual Studio Design View)

    - by jp2code
    In Visual Studio Design View, the selection of Form Colors in the Properties Pane are selectable from the "Custom", "Web", and "System" tabs. Of course, the color number can be used, too. When the "System" Tab is selected, the colors in the list depend on what type of Theme the Computer User has set on the PC. I'd like to stick with this, but I need to know how to "read in" the colors. I have controls that I create "on-the-fly" or often need to change a color back after getting the person's attention using a blink/flicker technique. How do I get the list of System Theme colors? Most forms have a BackColor that defaults to "Control", which looks like a very light gray under Windows 7, running the default Windows 7 Theme. I've managed to grab a color by physically reading the ARGB value in code, but I'd rather have a way to access the colors by their Theme Name, if that can be done. public Form1() { Color cControl = this.BackColor; Console.WriteLine(cControl.Name); // there is not always a name! } Does anyone know what I'm talking about?

    Read the article

  • how to create paging in a dynamic gridview

    - by bharathi
    I am using C# ,here i attach my partial code for dynamic grid view its working fine . I need to set paging on the dynamic grid view how can i call the OnPageIndexChanging GridView gv = new GridView(); gv.AllowPaging = false; gv.AlternatingRowStyle.BackColor = System.Drawing.Color.WhiteSmoke; gv.GridLines = GridLines.Horizontal; gv.CellPadding = 2; gv.CellSpacing = 5; gv.HeaderStyle.BackColor=System.Drawing.Color.Black; gv.HeaderStyle.ForeColor = System.Drawing.Color.White; gv.AutoGenerateColumns = false; BoundField nameColumn = new BoundField(); nameColumn.DataField = "fld_id"; nameColumn.HeaderText = "First Name"; gv.Columns.Add(nameColumn); nameColumn = new BoundField(); nameColumn.DataField = "fld_name"; nameColumn.HeaderText = "Last Name"; gv.Columns.Add(nameColumn); nameColumn = new BoundField(); nameColumn.DataField = "fld_state"; nameColumn.HeaderText = "Age"; gv.Columns.Add(nameColumn); gv.DataSource = ds; gv.DataBind(); plangrid.Controls.Add(gv);

    Read the article

  • Omit Properties from WebControl Serialization

    - by Laramie
    I have to serialize several objects inheriting from WebControl for database storage. These include several unecessary (to me) properties that I would prefer to omit from serialization. For example BackColor, BorderColor, etc. Here is an example of an XML serialization of one of my controls inheriting from WebControl. <Control xsi:type="SerializePanel"> <ID>grCont</ID> <Controls /> <BackColor /> <BorderColor /> <BorderWidth /> <CssClass>grActVid bwText</CssClass> <ForeColor /> <Height /> <Width /> ... </Control> I have been trying to create a common base class for my controls that inherits from WebControl and uses the "xxxSpecified" trick to selectively choose not to serialize certain properties. For example to ignore an empty BorderColor property, I'd expect [XmlIgnore] public bool BorderColorSpecified() { return !base.BorderColor.IsEmpty; } to work, but it's never called during serialization. I've also tried it in the class to be serialized as well as the base class. Since the classes themselves might change, I'd prefer not to have to create a custom serializer. Any ideas?

    Read the article

  • Null Ref when adding TabPages at runtimes

    - by BDotA
    This is a sample code I wrote to add some tab pages with the controls in them at run time. but when I run it , I get a Null Ref exception error. what part I am doing wrong? TabPage[] tabPages = new TabPage[2]; CheckBox ck  = new CheckBox();       tabPages[0].BackColor = Color.Firebrick;     tabPages[0].Controls.Add(ck);       tabPages[1].BackColor = Color.Firebrick;     tabPages[1].Controls.Add(ck);   tabGuy.SuspendLayout();     tabGuy.TabPages.Add(tabPages[0]);     tabGuy.TabPages.Add(tabPages[1]); tabGuy.ResumeLayout();

    Read the article

  • Give Gridview cell font colour according to condition

    - by vim
    How can I give colour to gridview's cell text according to condition. I have a below gridview and I am taking data in gridview by code behind. <asp:GridView ID="GridView3" runat="server" AllowPaging="true" PageSize="5" AutoGenerateColumns="false" Width="100%" OnPageIndexChanging="GridView3_PageIndexChanging" CssClass="Grid"> <RowStyle CssClass="GridRow"/> <Columns> <asp:BoundField HeaderText="No" DataField="id" Visible="false"/> <asp:BoundField HeaderText="Scenario" DataField="Scenario"/> <asp:BoundField HeaderText="Type" DataField="Type"/> <asp:BoundField HeaderText="Station Name" DataField="StationName"/> <asp:BoundField HeaderText="Parameter" DataField="PARAM"/> <asp:BoundField HeaderText="Value" DataField="Value" SortExpression="Value" DataFormatString="{0:F2}"/> </Columns> <PagerStyle BackColor="White" Height="40px" Font-Bold="true" Font- Size="Medium" ForeColor="Green" HorizontalAlign="Center"/> <PagerSettings FirstPageText="First" LastPageText="Last" Mode="NumericFirstLast" PageButtonCount="3" /> <HeaderStyle BackColor="#ABDB78" ForeColor="Black" Height="35px" Font- Size="13px" Font-Names="verdana"/> </asp:GridView> I am binding data with this grid by code behind. protected void ReservGridBind() { string name = Request.QueryString[1].ToString(); string query = "SELECT SD.id,SD.Scenario,SD.Value,PR.Type,PR.StationName,PR.PARAM from sgwebdb.param_reference as PR Inner join sgwebdb.scenario_data as SD ON PR.Param_Id=SD.Param_Id INNER JOIN sgwebdb.qualicision_detail as Q ON SD.SCENARIO=Q.Alternative where PR.Type='Reservoirs' and Q.Alternative='" + name +"'"; this.GridView1.DataSource = PSI.DataAccess.Database.DatabaseManager .GetConnection().GetData(query); GridView1.DataBind(); condition : if text < 0 then blue colour , text > 0 && text < 4 then green colour, text > 4 then red colour. Please help me for this gridview's cell text colour.

    Read the article

  • Add Custom Control to DataGridViewCell

    - by Kovscer
    Hello, I create a custom control inherited from Windows.System.Forms.Controls. This is my code of this control: public partial class MonthEventComponent : Control { private Color couleur; private Label labelEvenement; public MonthEventComponent(Color couleur_c, String labelEvenement_c ) { InitializeComponent(); this.couleur = couleur_c; this.labelEvenement.Text = labelEvenement_c; this.labelEvenement.ForeColor = couleur; this.labelEvenement.BackColor = Color.White; this.labelEvenement.TextAlign = ContentAlignment.MiddleLeft; this.labelEvenement.Dock = DockStyle.Fill; this.Controls.Add(labelEvenement); } public MonthEventComponent() { InitializeComponent(); this.couleur = Color.Black; this.labelEvenement = new Label(); this.labelEvenement.ForeColor = couleur; this.labelEvenement.BackColor = Color.White; this.labelEvenement.Text = "Evénement Initialiser"; this.labelEvenement.TextAlign = ContentAlignment.MiddleLeft; this.labelEvenement.Dock = DockStyle.Fill; this.Controls.Add(labelEvenement); } protected override void OnClick(EventArgs e) { base.OnClick(e); MessageBox.Show("Click"); } } I would like to insert this control or multiple of this control on a DataGridViewCell but i don't know how to do this. Thank you in advance for your answer, Best Regards, PS: I'm french, i'm apologize for any can of language errors.

    Read the article

  • How can I keep a graphics object centered (like a circle) when zooming in or out on it?

    - by sonny5
    using System; using System.Drawing; using System.Collections; using System.ComponentModel; using System.Windows.Forms; using System.Data; using System.Drawing.Drawing2D; using System.Drawing.Imaging; namespace testgrfx { public class Form1 : System.Windows.Forms.Form { float m_Scalef; float m_Scalefout; Rectangle m_r1; private System.Windows.Forms.Button button2; private System.Windows.Forms.Button button3; private System.ComponentModel.Container components = null; private void InitializeComponent() { m_Scalef = 1.0f; // for zooming purposes Console.WriteLine("opening m_Scalef= {0}",m_Scalef); m_Scalefout = 1.0f; Console.WriteLine("opening m_Scalefout= {0}",m_Scalefout); m_r1 = new Rectangle(50,50,100,100); this.AutoScrollMinSize = new Size(600,700); this.components = new System.ComponentModel.Container(); this.button2 = new System.Windows.Forms.Button(); this.button2.BackColor = System.Drawing.Color.LightGray; this.button2.Location = new System.Drawing.Point(120, 30); this.button2.Name = "button2"; this.button2.Size = new System.Drawing.Size(72, 24); this.button2.TabIndex = 1; this.button2.Text = "Zoom In"; this.button2.Click += new System.EventHandler(this.mnuZoomin_Click); this.Controls.Add(button2); this.button3 = new System.Windows.Forms.Button(); this.button3.BackColor = System.Drawing.Color.LightGray; this.button3.Location = new System.Drawing.Point(200, 30); this.button3.Name = "button3"; this.button3.Size = new System.Drawing.Size(72, 24); this.button3.TabIndex = 2; this.button3.Text = "Zoom Out"; this.button3.Click += new System.EventHandler(this.mnuZoomout_Click); this.Controls.Add(button3); //InitMyForm(); } public Form1() { InitializeComponent(); Text = " DrawLine"; BackColor = SystemColors.Window; // Gotta load these kind at start-up ... not with button assignments this.Paint+=new PaintEventHandler(this.Form1_Paint); } static void Main() { Application.Run(new Form1()); } /// Clean up any resources being used. protected override void Dispose( bool disposing ) { if( disposing ) { if (components != null) { components.Dispose(); } } base.Dispose( disposing ); } // autoscroll2.cs does work private void Form1_Paint(object sender, System.Windows.Forms.PaintEventArgs e) { Graphics dc = e.Graphics; dc.PageUnit = GraphicsUnit.Pixel; dc.PageScale = m_Scalef; Console.WriteLine("opening dc.PageScale= {0}",dc.PageScale); dc.TranslateTransform(this.AutoScrollPosition.X/m_Scalef, this.AutoScrollPosition.Y/m_Scalef); Pen pn = new Pen(Color.Blue,2); dc.DrawEllipse(pn,m_r1); Console.WriteLine("form_paint_dc.PageUnit= {0}",dc.PageUnit); Console.WriteLine("form_paint_dc.PageScale= {0}",dc.PageScale); //Console.Out.NewLine = "\r\n\r\n"; // makes all double spaces } private void mnuZoomin_Click(object sender, System.EventArgs e) { m_Scalef = m_Scalef * 2.0f; Console.WriteLine("in mnuZoomin_Click m_Scalef= {0}",m_Scalef); Invalidate(); // to trigger Paint of entire client area } // try: System.Drawing.Rectangle resolution = Screen.GetWorkingArea(someForm); private void Form1_MouseDown(object sender, System.Windows.Forms.MouseEventArgs e) { // Uses the mouse wheel to scroll Graphics dc = CreateGraphics(); dc.TranslateTransform(this.AutoScrollPosition.X/m_Scalef, this.AutoScrollPosition.Y/m_Scalef); Console.WriteLine("opening Form1_MouseDown dc.PageScale= {0}", dc.PageScale); Console.WriteLine("Y wheel= {0}", this.AutoScrollPosition.Y/m_Scalef); dc.PageUnit = GraphicsUnit.Pixel; dc.PageScale = m_Scalef; Console.WriteLine("frm1_moudwn_dc.PageScale= {0}",dc.PageScale); Point [] mousep = new Point[1]; Console.WriteLine("mousep= {0}", mousep); // make sure to adjust mouse pos.for scroll position Size scrollOffset = new Size(this.AutoScrollPosition); mousep[0] = new Point(e.X-scrollOffset.Width, e.Y-scrollOffset.Height); dc.TransformPoints(CoordinateSpace.Page, CoordinateSpace.Device,mousep); Pen pen = new Pen(Color.Green,1); dc.DrawRectangle(pen,m_r1); Console.WriteLine("m_r1= {0}", m_r1); Console.WriteLine("mousep[0].X= {0}", mousep[0].X); Console.WriteLine("mousep[0].Y= {0}", mousep[0].Y); if (m_r1.Contains(new Rectangle(mousep[0].X, mousep[0].Y,1,1))) MessageBox.Show("click inside rectangle"); } private void Form1_Load(object sender, System.EventArgs e) { } private void mnuZoomout_Click(object sender, System.EventArgs e) { Console.WriteLine("first line--mnuZoomout_Click m_Scalef={0}",m_Scalef); if(m_Scalef > 9 ) { m_Scalef = m_Scalef / 2.0f; Console.WriteLine("in >9 mnuZoomout_Click m_Scalef= {0}",m_Scalef); Console.WriteLine("in >9 mnuZoomout_Click__m_Scalefout= {0}",m_Scalefout); } else { Console.WriteLine("<= 9_Zoom-out B-4 redefining={0}",m_Scalef); m_Scalef = m_Scalef * 0.5f; // make it same as previous Zoom In Console.WriteLine("<= 9_Zoom-out after m_Scalef= {0}",m_Scalef); } Invalidate(); } } // public class Form1 }

    Read the article

  • A Look at the GridView&apos;s New Sorting Styles in ASP.NET 4.0

    Like every Web control in the ASP.NET toolbox, the GridView includes a variety of style-related properties, including <code>CssClass</code>, <code>Font</code>, <code>ForeColor</code>, <code>BackColor</code>, <code>Width</code>, <code>Height</code>, and so on. The GridView also includes style properties that apply to certain classes of rows in the grid, such as <code>RowStyle</code>, <code>AlternatingRowStyle</code>, <code>HeaderStyle</code>, and <code>PagerStyle</code>. Each of these meta-style properties offer the standard style properties (<code>CssClass</code>, <code>Font</code>, etc.) as subproperties.In ASP.NET 4.0, Microsoft added four new

    Read the article

  • Drawing a TextBox in an extended Glass Frame (C# w/o WPF)

    - by Lazlo
    I am trying to draw a TextBox on the extended glass frame of my form. I won't describe this technique, it's well-known. Here's an example for those who haven't heard of it: http://www.danielmoth.com/Blog/Vista-Glass-In-C.aspx The thing is, it is complex to draw over this glass frame. Since black is considered to be the 0-alpha color, anything black disappears. There are apparently ways of countering this problem: drawing complex GDI+ shapes are not affected by this alpha-ness. For example, this code can be used to draw a Label on glass (note: GraphicsPath is used instead of DrawString in order to get around the horrible ClearType problem): public class GlassLabel : Control { public GlassLabel() { this.BackColor = Color.Black; } protected override void OnPaint(PaintEventArgs e) { GraphicsPath font = new GraphicsPath(); font.AddString( this.Text, this.Font.FontFamily, (int)this.Font.Style, this.Font.Size, Point.Empty, StringFormat.GenericDefault); e.Graphics.SmoothingMode = SmoothingMode.HighQuality; e.Graphics.FillPath(new SolidBrush(this.ForeColor), font); } } Similarly, such an approach can be used to create a container on the glass area. Note the use of the polygons instead of the rectangle - when using the rectangle, its black parts are considered as alpha. public class GlassPanel : Panel { public GlassPanel() { this.BackColor = Color.Black; } protected override void OnPaint(PaintEventArgs e) { Point[] area = new Point[] { new Point(0, 1), new Point(1, 0), new Point(this.Width - 2, 0), new Point(this.Width - 1, 1), new Point(this.Width -1, this.Height - 2), new Point(this.Width -2, this.Height-1), new Point(1, this.Height -1), new Point(0, this.Height - 2) }; Point[] inArea = new Point[] { new Point(1, 1), new Point(this.Width - 1, 1), new Point(this.Width - 1, this.Height - 1), new Point(this.Width - 1, this.Height - 1), new Point(1, this.Height - 1) }; e.Graphics.FillPolygon(new SolidBrush(Color.FromArgb(240, 240, 240)), inArea); e.Graphics.DrawPolygon(new Pen(Color.FromArgb(55, 0, 0, 0)), area); base.OnPaint(e); } } Now my problem is: How can I draw a TextBox? After lots of Googling, I came up with the following solutions: Subclassing the TextBox's OnPaint method. This is possible, although I could not get it to work properly. It should involve painting some magic things I don't know how to do yet. Making my own custom TextBox, perhaps on a TextBoxBase. If anyone has good, valid and working examples, and thinks this could be a good overall solution, please tell me. Using BufferedPaintSetAlpha. (http://msdn.microsoft.com/en-us/library/ms649805.aspx). The downsides of this method may be that the corners of the textbox might look odd, but I can live with that. If anyone knows how to implement that method properly from a Graphics object, please tell me. I personally don't, but this seems the best solution so far. Thanks!

    Read the article

  • MS Chart Control Scale - Line graph show 12 months

    - by Mike
    Hi, On my X Axis, I have months. The chart shows up to 11 points, i.e. Jan - Nov of the same year, but when I add 12 points (Jan - Dec), it will do an auto label thing and change the interval for every 4 months. How can I change the graph so that it shows 12 months before it does the auto labels? Here is the server control code I am currently using. <asp:CHART ID="Chart1" runat="server" BorderColor="181, 64, 1" BorderDashStyle="Solid" BorderWidth="2" Height="296px" ImageLocation="~/TempImages/ChartPic_#SEQ(300,3)" ImageType="Png" Palette="None" Width="700px" BorderlineColor=""> <legends> <asp:Legend BackColor="Transparent" Font="Trebuchet MS, 8pt, style=Bold" IsTextAutoFit="False" Name="Default" Alignment="Center" DockedToChartArea="ChartArea1" Docking="Top" IsDockedInsideChartArea="False" Title="Legend"> </asp:Legend> </legends> <series> <asp:Series BorderColor="180, 26, 59, 105" BorderWidth="2" ChartType="Line" Color="220, 65, 140, 240" MarkerSize="6" Name="Series1" ShadowColor="Black" ShadowOffset="2" XValueType="DateTime" YValueType="Double" LabelFormat="c0" LegendText="Actual" MarkerStyle="Circle"> </asp:Series> <asp:Series BorderColor="180, 26, 59, 105" BorderWidth="2" ChartType="Line" Color="220, 224, 64, 10" MarkerSize="6" Name="Series2" ShadowColor="Black" ShadowOffset="2" XValueType="DateTime" YValueType="Double" LabelFormat="c0" LegendText="Projected" MarkerStyle="Circle"> </asp:Series> <asp:Series BorderColor="180, 26, 59, 105" BorderWidth="2" ChartArea="ChartArea1" ChartType="Line" Legend="Default" Name="Series3" LabelFormat="c0" XValueType="DateTime" YValueType="Double" Color="0, 192, 192" MarkerSize="6" ShadowColor="Black" ShadowOffset="2" LegendText="Actual Credit Limit" MarkerStyle="Circle"> </asp:Series> </series> <chartareas> <asp:ChartArea BackColor="#DEEDF7" BackGradientStyle="TopBottom" BackSecondaryColor="White" BorderColor="64, 64, 64, 64" BorderDashStyle="Solid" Name="ChartArea1" ShadowColor="Transparent"> <area3dstyle inclination="40" isclustered="False" isrightangleaxes="False" lightstyle="Realistic" perspective="9" rotation="25" wallwidth="3" /> <axisy linecolor="64, 64, 64, 64" islabelautofit="False" isstartedfromzero="False"> <LabelStyle Font="Trebuchet MS, 8.25pt, style=Bold" Format="c0" /> <majorgrid linecolor="64, 64, 64, 64" /> </axisy> <axisx linecolor="64, 64, 64, 64" intervaloffsettype="Months" intervaltype="Months" islabelautofit="False" isstartedfromzero="False"> <LabelStyle Font="Trebuchet MS, 8.25pt, style=Bold" Angle="-60" Format="MMM yy" /> <majorgrid linecolor="64, 64, 64, 64" /> </axisx> </asp:ChartArea> </chartareas> </asp:CHART> Thanks.

    Read the article

< Previous Page | 1 2 3 4 5 6 7 8 9  | Next Page >