[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

Creating a custom grid

Posted on 2004-09-14
3
Medium Priority
?
185 Views
Last Modified: 2010-04-15
Hi,

I am quite new to C# and need a bit of help :)

I need to create a control that simulates a grid  (it doesn't have to be a grid!) with 3 fields.
Field 1: Should hold a 'custom control', for which events can be fired. (I need the click event)
Field 2: Should hold a fixed value, that can't be changed.
Field 3: Should hold a text value, that can be changed. (Renamed)

I'm a bit stuck at this stage (don't really know where to start), and any help would be appreciated.

Thanx,
AA
0
Comment
Question by:april_angel
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 6

Accepted Solution

by:
Svetlin_Panayotov earned 1500 total points
ID: 12055697
CodeProject - http://www.codeproject.com/cs/miscctrl/csharpgridcontrol.asp 
I found this really cool grid - and have been using it for some time.I'm not quiet sure if it'll help - the source is a bit complicated.
0
 

Author Comment

by:april_angel
ID: 12245885
Hi,

Apologies for not answering the question. I had a look at Svetlin comment, and it does not really solved my problem.
I have found the answer though:
All I had to do was create all my controls progammatically and place it into a container (panel). I didn't know that by creating the controls like this I would be able to enable the events, and the fact that control arrays are not available in C# didn't make it easier, either.   Below follows an excerpt of the code I've used. What the application code does it runs a loop that calls the procedure below and keeps adding the controls to the containing panel.

private void CreateGridEntry(int Index, string DisplayText)
{
      //Declare and Initialise
      Button btnLayerValueDisplayColor = new Button();
      Label lblLayerValueDisplayName = new Label();                  
      TextBox txtLayerValueEntry = new TextBox();      


      //Button
      btnLayerValueDisplayColor.Name = "btnValueDisplayName_" + Index.ToString();
      btnLayerValueDisplayColor.Click += new System.EventHandler(this.ChangeSymbolEvent);
      btnLayerValueDisplayColor.Height = 24;
      btnLayerValueDisplayColor.Top = (btnLayerValueDisplayColor.Height + 6)* Index
      btnLayerValueDisplayColor.Left = 8 ;
      btnLayerValueDisplayColor.Width = 24;                  
      btnLayerValueDisplayColor.Tag =Index.ToString();
      btnLayerValueDisplayColor.Image = Image.FromFile(Application.StartupPath + @"\Images\Painter.bmp");
      pnlSymbolSet.Controls.Add(btnLayerValueDisplayColor);
      
      //Label
      lblLayerValueDisplayName.Name = "lblValueDisplayName_" + Index.ToString();
      lblLayerValueDisplayName.Top = btnLayerValueDisplayColor.Top;
      lblLayerValueDisplayName.Left = btnLayerValueDisplayColor.Left + btnLayerValueDisplayColor.Width;
      lblLayerValueDisplayName.Text =  DisplayText;
      lblLayerValueDisplayName.Width = 190;
      lblLayerValueDisplayName.Height = btnLayerValueDisplayColor.Height;
      lblLayerValueDisplayName.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D;
      pnlSymbolSet.Controls.Add(lblLayerValueDisplayName);
}

Again, I apologise for not replying sooner.

Thanx in any case,
AA
0

Featured Post

Enroll in October's Free Course of the Month

Do you work with and analyze data? Enroll in October's Course of the Month for 7+ hours of SQL training, allowing you to quickly and efficiently store or retrieve data. It's free for Premium Members, Team Accounts, and Qualified Experts!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article introduced a TextBox that supports transparent background.   Introduction TextBox is the most widely used control component in GUI design. Most GUI controls do not support transparent background and more or less do not have the…
This article is for Object-Oriented Programming (OOP) beginners. An Interface contains declarations of events, indexers, methods and/or properties. Any class which implements the Interface should provide the concrete implementation for each Inter…
In response to a need for security and privacy, and to continue fostering an environment members can turn to for support, solutions, and education, Experts Exchange has created anonymous question capabilities. This new feature is available to our Pr…
Please read the paragraph below before following the instructions in the video — there are important caveats in the paragraph that I did not mention in the video. If your PaperPort 12 or PaperPort 14 is failing to start, or crashing, or hanging, …
Suggested Courses

656 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question