Click here to Skip to main content
15,070,511 members
Home / Discussions / C#
   

C#

 
GeneralRe: Get PropertyGrid to update? Pin
lw@zi 21-Jun-09 16:46
professional lw@zi 21-Jun-09 16:46 
GeneralRe: Get PropertyGrid to update? Pin
FocusedWolf21-Jun-09 19:08
MemberFocusedWolf21-Jun-09 19:08 
GeneralFocus losing in propertygrid Pin
VB 8.07-Jul-09 23:41
MemberVB 8.07-Jul-09 23:41 
QuestionDatagridview combobox in column header Pin
desir10220-Jun-09 13:39
Memberdesir10220-Jun-09 13:39 
AnswerRe: Datagridview combobox in column header Pin
MarkB77720-Jun-09 17:40
MemberMarkB77720-Jun-09 17:40 
AnswerRe: Datagridview combobox in column header Pin
Manas Bhardwaj20-Jun-09 21:33
professionalManas Bhardwaj20-Jun-09 21:33 
QuestionRemote desktop shown to another client? Pin
Member 465319820-Jun-09 12:38
MemberMember 465319820-Jun-09 12:38 
QuestionExcel like Selection? Pin
Megidolaon20-Jun-09 12:21
MemberMegidolaon20-Jun-09 12:21 
I might have asked this before, but I never got any good answer.

How do I implement an excel like selection?

I have a collection of many controls arranged in lines and rows, much like excel cells.
The user i supposed to select them like cells in Excel, but it just won't work.

The controls' MouseDown and MouseEnter event apparently cause the control to own the mouse and make it impossible to fire events on any other control as long as the mouse button is held down.

I also got this code on msdn, but it's utter rubbish. It will cause a single control to flicker between selected and unselected madly, it's not possible to select multiple controls and the control isn't drawn while you hold the mouse over it.
Point start;
		private void pictureBox_MouseDown(object sender, MouseEventArgs e)
		{
			start = e.Location;
		}

		private void pictureBox_MouseMove(object sender, MouseEventArgs e)
		{
			if (e.Button == MouseButtons.Left)
			{
				Size selSize=new Size(e.X - start.X, e.Y - start.Y);
				Rectangle selRect = new Rectangle(start, selSize);
				selRect.Offset(((Control)sender).Location);
				foreach (Control ctl in this.flowLayoutPanel1.Controls)
				{
					if (ctl.Bounds.IntersectsWith(selRect))
					{
						// Here goes your code for doing whatever you need to "select"
						// the picture box...

						ctl.BackColor = Color.Yellow;
					}
					else
					{
						// Here goes your code for doing whatever you need to "deselect"
						// the picture box...

						ctl.BackColor = Color.Gray;
					}
				}
			}
		}
So, does anyone have a solution or at least a hint?

Tanks a lot!
AnswerRe: Excel like Selection? Pin
Christian Graus20-Jun-09 12:47
protectorChristian Graus20-Jun-09 12:47 
Question?How add a database to my c# project? Pin
H.R(Hamid reza)20-Jun-09 11:12
MemberH.R(Hamid reza)20-Jun-09 11:12 
AnswerRe: ?How add a database to my c# project? Pin
Christian Graus20-Jun-09 11:26
protectorChristian Graus20-Jun-09 11:26 
QuestionRe: ?How add a database to my c# project? Pin
H.R(Hamid reza)21-Jun-09 2:29
MemberH.R(Hamid reza)21-Jun-09 2:29 
QuestionPassing a Graphics object Pin
Member 95042020-Jun-09 10:39
MemberMember 95042020-Jun-09 10:39 
AnswerRe: Passing a Graphics object Pin
0x3c020-Jun-09 10:49
Member0x3c020-Jun-09 10:49 
GeneralRe: Passing a Graphics object Pin
Member 95042020-Jun-09 11:56
MemberMember 95042020-Jun-09 11:56 
GeneralRe: Passing a Graphics object Pin
Luc Pattyn20-Jun-09 12:14
sitebuilderLuc Pattyn20-Jun-09 12:14 
AnswerRe: Passing a Graphics object Pin
Christian Graus20-Jun-09 11:29
protectorChristian Graus20-Jun-09 11:29 
AnswerRe: Passing a Graphics object Pin
Luc Pattyn20-Jun-09 11:29
sitebuilderLuc Pattyn20-Jun-09 11:29 
QuestionNeed a container like visual studio toolbox. Pin
hdv21220-Jun-09 10:38
Memberhdv21220-Jun-09 10:38 
AnswerRe: Need a container like visual studio toolbox. Pin
Christian Graus20-Jun-09 11:29
protectorChristian Graus20-Jun-09 11:29 
GeneralRe: Need a container like visual studio toolbox. Pin
hdv21220-Jun-09 12:01
Memberhdv21220-Jun-09 12:01 
GeneralRe: Need a container like visual studio toolbox. Pin
Christian Graus20-Jun-09 12:48
protectorChristian Graus20-Jun-09 12:48 
QuestionWindows Service Controlle in VS2008 Pin
Whitaker.Mike20-Jun-09 5:10
MemberWhitaker.Mike20-Jun-09 5:10 
AnswerRe: Windows Service Controlle in VS2008 Pin
ProtoBytes20-Jun-09 5:34
MemberProtoBytes20-Jun-09 5:34 
AnswerRe: Windows Service Controlle in VS2008 Pin
DaveyM6920-Jun-09 9:40
professionalDaveyM6920-Jun-09 9:40 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.