|
Not quite.
My problem isn't that things don't get selected, this seems to work.
My problem is that multiple PictureBox es can be selected while the mousebutton is held down (all are fine, if you let go of one it's MouseUp event shoul fire and stop the selecting).
While the mousebutton is held down, (during the MouseDown event), you practically can only select neighboring TextBox es, to select one that isn't next to a previously selected one, you'd have to let go of the button and thus the slection would be stopped (and started from new).
Now the problem is that if you exit the area where the PictureBox es are displayed, while still holding the mousebutton down and then move to a far away PictureBox and it would get added to the selection, making it inconsistent.
I somehow want force the user to be able to only select up to 25 neighboring PictureBox es, preferrably with a limit of 5 boxes horizontally and 5 boxes vertically.
|
|
|
|
|
As Musefan said u need to write your own collision detection logic or u can use the following...
1.Use a toggle flag to set the status of each picture box selected.
like
public void PictureBox1_Click(<arguments>)
{
if(pictureBox1.IsSelected!=true)
pictureBox1.IsSelected = true;
else
pictureBox1.IsSelected = false;
}</arguments>
((Note: IsSelected is a custom built property what you need to code...))
then check the IsSelected property while adding the selected pictureboxes....
Have a Happy Coding.....
|
|
|
|
|
I thought I had it by making the FlowLayoutPanel slightly larger then the PictureBox es covering it
But if you hold the mouse button down none of the events get fired, they only fire when you don't press the mouse button.
That's is useless to me.
Colision detection is kinda out of the question, the mouse coordinates are different from the control sizes (events get fired at the wrong time) and I can't debug it because during debug the mouse coordinates still change every time I move the mouse.
An IsChecked property wouldn't really help me.
I need to detect if the user moves away from the PictureBoxes while holding the mouse button down
modified on Monday, April 6, 2009 3:06 AM
|
|
|
|
|
to run my application i need to install .net but when i try to install it telling invalid Win32...may i know y??? and solution?
A S E L A
|
|
|
|
|
- What version of .NET?
- What OS-version?
- Have you run a virus-checker on your installation-package?
Download .NET 2.0 here[^].
I are troll
|
|
|
|
|
hi
Here is my code in this i use a file dialog box from which i open the excel file but here is one problem i read only one sheet in datagride view when i select some another file then it shows the error PLZ CHECK THE FILE NAME OR FILE IS NOT EXIT NEED A Help
private void button1_Click(object sender, EventArgs e)
{
OpenFileDialog FD = new OpenFileDialog();
FD.Filter = "Excel|*.xls";
if (FD.ShowDialog() == DialogResult.OK)
{
textBox1.Text = " " + FD.FileName;
}
string filename = textBox1.Text;
String connectionString =
"Provider=Microsoft.Jet.OLEDB.4.0;" +
"Data Source=" + filename + ";" +
"Extended Properties=Excel 8.0;";
OleDbConnection connection = new OleDbConnection(connectionString);
connection.Open();
OleDbCommand selectCommand = new OleDbCommand("SELECT * FROM [xyz$]", connection);
OleDbDataAdapter dataAdapter = new OleDbDataAdapter();
dataAdapter.SelectCommand = selectCommand;
DataSet dataSet = new DataSet();
dataAdapter.Fill(dataSet);
System.Data.DataTable dataTable = dataSet.Tables[0];
dataGridView1.DataSource = dataSet.Tables[0];
// textBox1.Text = "";
MessageBox.Show(dataGridView1.RowCount.ToString());
connection.Close();
}
|
|
|
|
|
<repbot engaged=true>
1) Please use punctation, it helps make sense of gibberish.
2) DO NOT SHOUT UNLESS YOU WANT TO BE FLAMED!
3) Spelling helps. It helps a lot.
4) Format your code, see the buttons on this page for <code></code> in line or
<pre>blocks of code</pre>
Compare:
if (FD.ShowDialog() == DialogResult.OK)
{
textBox1.Text = " " + FD.FileName;
}
and
if (FD.ShowDialog() == DialogResult.OK)
{
textBox1.Text = " " + FD.FileName;
}
</repbot>
Panic, Chaos, Destruction.
My work here is done.
|
|
|
|
|
Welcome to the community of PersiaDevelopers.com fans. A centralized learning environment specifically targeted to Persian software developers and designers.
PersiaDevelopers.com is the largest community of Microsoft .NET Development Platform enthusiasts in Iran.
Keeping up to date with the latest technologies through articles and news, taking advantage of PersiaDevelopers forums which allow you to search a growing archive of technical questions and answers, achieving to a large library of ebooks and many other parts are the reasons which help it growing faster and faster.
On this group you will find links to help you stay connected with the PersiaDevelopers.com. Read what people are saying about new technologies and see what people are doing with Microsoft development technologies.
www.persiadevelopers.com
|
|
|
|
|
Stop crossposting the ads, please.
I are troll
|
|
|
|
|
Hi all,
I've added value pair, int and string, in a Dictionary. Now I want to take pairs from the last. int value represent the index of a string and string value represent the value to insert into the original string.
I've try this.
<br />
foreach (KeyValuePair<int,> pair in diction)<br />
{<br />
str = str.Insert(pair.Key, pair.Value);
}
This insert items in wrong index once the first item index is added in the correct place. So I want to added them from the last item. But I'm messup with that how to access the last element. Can someone help me to do this.
Thanks
I appreciate your help all the time...
CodingLover
|
|
|
|
|
Dictionary<TKey, TValue>.Last Method
8.Kelvin()
{
while (!(the machine can program itself))
Wont_stop_coding = true;
}
|
|
|
|
|
Thanks for the replay.
Can you explain it bit more with my example, please?
I appreciate your help all the time...
CodingLover
|
|
|
|
|
Dictionary<int, string> diction = new Dictionary<int, string>();<br />
<br />
diction.Add(1, "first");<br />
diction.Add(2, "second");<br />
diction.Add(3, "last");<br />
<br />
Dictionary<int,string>.KeyCollection keys = diction.Keys;<br />
int lastKey = keys.Last();<br />
<br />
Dictionary<int,string>.ValueCollection values = diction.Values;<br />
string lastValue = values.Last(); <br />
<br />
MessageBox.Show("lastKey = " +lastKey + " lastValue = " + lastValue);
8.Kelvin()
{
while (!(the machine can program itself))
Wont_stop_coding = true;
}
|
|
|
|
|
But now I've a little mess here. I want to iterate whole dictionary, from the last to first pair. In this way, I've to take the last value and to find the next need to remove it, right?
I appreciate your help all the time...
CodingLover
|
|
|
|
|
string allstr = "";
for (int count = diction.Count; count > 0; count--)
{
allstr += diction.ElementAt(count-1).Value;
}
MessageBox.Show("allstr = " + allstr);
8.Kelvin()
{
while (!(the machine can program itself))
Wont_stop_coding = true;
}
|
|
|
|
|
I got this error message.
'System.Collections.Generic.Dictionary<int,string>' does not contain a definition for 'ElementAt'
I appreciate your help all the time...
CodingLover
|
|
|
|
|
CodingLover wrote: I got this error message.
'System.Collections.Generic.Dictionary<int,string>' does not contain a definition for 'ElementAt'
Add
using System.Linq;
will do.
8.Kelvin()
{
while (!(the machine can program itself))
Wont_stop_coding = true;
}
|
|
|
|
|
or just use
diction.Last().Key
and
diction.Last().Value
will do.
8.Kelvin()
{
while (!(the machine can program itself))
Wont_stop_coding = true;
}
|
|
|
|
|
Hi,
I am using rich text box to display data from database but i want to display data from from a an other world which is on the middle or some where in database like i have data,
Please remember to search our articles, the forums, MSDN and Google before posting your question.
Now i want to start the first letter in rich text box like MSDN not from Please
Kindly tell me what i should do please do replay.
Thanx.
|
|
|
|
|
I don't really understand the question, you would like to get some random words which will be placed inside your rich textbox?
I'd do that something like this:
String s = "Please remember to search our articles, the forums, MSDN and Google before posting your question.";
String[] words = s.split(' ');
String endString = String.Format("{0} not from {2}", random.Next(words.length),random.Next(words.length));
If this isn't what you want, then you should recapulate your question.
|
|
|
|
|
Dear,
Thanks for your replay but it is not what i am saying i am just saying that if i have some data like A to Z but when data fill in rich text box the starting letter must be
F in database of A to Z not started from word A.
I think you will understand my question now.
waiting for your replay.
|
|
|
|
|
I really don't get your question.
What is the text in the database? And what is the expected output?
Like you have this in the database: 'a b c d e f g h' and the output is 'f g h' or something.
And where do you have the problem? Splitting the data to whichever you want or getting data out of the database?
|
|
|
|
|
|
|
Hi, I want to change the url displaying on browser when a file is opened through it. For example,
file:///s3413.pdf/ to http://NewWebapplication.pdf
how it is possible using c#?
|
|
|
|