|
Most programs work like this:
Cut/Copy/Delete is what happens on the source side; the steps are:
1. if not delete: copy selection to Clipboard
2. if not copy: delete selection
THEN, on the destination side, a potential Paste pastes what is on the Clipboard to the current position, replacing/deleting whatever was selected there if anything.
Now Windows Explorer acts differently: Cut dims the selection but does not delete it until it has been copied somewhere in some Explorer window, and I don't know how they do that. I can come up with ways to achieve that, within a single program, however I don't know which way MS has chosen. I expect there must be a message going back from destination to source to confirm the pasting is done, so the cutting should now be finalized.
Luc Pattyn
Local announcement (Antwerp region): Lange Wapper? Neen!
|
|
|
|
|
I'm trying to achive the same thing as explorer does and I think that there must be something else placed in clipboard (upon cuting, which results in imediate dimming items) that tells how pasting application should tread source files (leave intact or delete) upon completing paste operation.
Thanks,
Michal
|
|
|
|
|
I guess I know now. It is a memory stream that is placed in Clipboard that tell whether to cut or copy only
const String PREFFERED_DROP_EFFECT_SHELL_CONSTANT = "Preferred DropEffect";
private bool IsItCutOperation(IDataObject dataObject)
{
Object isCutOperationMS = dataObject.GetData(PREFFERED_DROP_EFFECT_SHELL_CONSTANT) as MemoryStream;
if (isCutOperationMS == null)
return false;
MemoryStream ms = isCutOperationMS as MemoryStream;
byte[] array = new byte[ms.Length];
ms.Read(array, 0, (int)ms.Length);
if(array[0] == (byte)(2))
{
return true;
}
return false;
}
Thanks,
Michal
|
|
|
|
|
do you have any link or reference to such wisdom. You did not invent this yourself, did you?
TIA
Luc Pattyn
Local announcement (Antwerp region): Lange Wapper? Neen!
|
|
|
|
|
|
Thanks,
Luc Pattyn
Local announcement (Antwerp region): Lange Wapper? Neen!
|
|
|
|
|
I want to do this:
When I'll click at the CountryName column(England), I want redirect it to me in the new form where will be corresponding CityNames(London, Birmingem,Liverpool and etc)
in countryForms I have:
<pre> private void dataGridView1_DoubleClick(object sender, EventArgs e)
{
// here when I call Citys
new City("I want Parameter here").showdialog();
//I am trying to find this parameter like this
foreach (DataRows item in storeHouseDataSet.Countries.Rows)
{
int b = (int)item["ID"];
}
} </pre>
but it is not what I want
In CityForms:
<pre> private int CountryID;
//Form1 f;
public Cities(int countryID)
{
InitializeComponent();
CountryID = countryID;
//f = new Form1();
}
public void Cities_Load(object sender, EventArgs e)
{
this.citiesTableAdapter.Fill(storeHouseDataSet.Cities);
this.citiesTableAdapter.FillByCountry(storeHouseDataSet.Cities, CountryID);
} </pre>
C# Developer
|
|
|
|
|
West1989 wrote: //I am trying to find this parameter like this
foreach (DataRows item in storeHouseDataSet.Countries.Rows)
{
int b = (int)item["ID"];
}
}
but it is not what I want
1. What is it that you do want?
2. Assuming you want 'b' to have some usable value, then you need to define b in the outer scope, and also break out of the loop when you hit the right value.
Perhaps you could clarify your question?
|
|
|
|
|
Hi all,
i have a problem with a numeric usercontrol, the problem that i have to validate the value of the textbox to contain only numeric values and number of digits before / after decimal point(i used regular expression to do the validation ). i have the validation on textChange, keyPress and leave, when i leave the textbox i validate it if its not valid i keep the textbox focused. but when i enter a wrong value and directly click save button(which will close the form). the form is closed even i set the focus in the textbox.
any idea to prevent continue in Save_click if the textbox contains wrong value ???!!!
sorry if my description is not clear.
|
|
|
|
|
if you want to force the user to correct any problem, then your validation code should:
- tell your user what is wrong
- tell your user he should fix it
- disable everything that looks like it is accepting the data as is, including OK, Save and Close buttons
- keep a Cancel button enabled, so the user can still abandon everything
Luc Pattyn
Local announcement (Antwerp region): Lange Wapper? Neen!
|
|
|
|
|
Is there possible to change an image in a panel at particular time period in c#.net
I Have 6 Images and 2 picture box....
First on load of form 2 images i have to display.. after 30 seconds another 2 images.. and after 30 sec another 2 images..and after that again circular cycle is start..
Pls Help Me
|
|
|
|
|
Yes, it is. Where are you stuck?
|
|
|
|
|
I am just at a loss to think that i use threading and make that sleep or i use timer on which i write code on Click event..
Actually tell me how i can do this...i hav to change imag in every 30 sec.. which path is stotred in xml database file on client machine...
|
|
|
|
|
Use the timer, its easier than using a background thread which can't update the UI directly.
Sachin Dubey wrote: xml database file
Now there's an oxymoron for you
Bob
Ashfield Consultants Ltd
Proud to be a 2009 Code Project MVP
|
|
|
|
|
For periodic actions on the GUI, use a System.Windows.Forms.Timer; its Tick handler runs on the GUI thread, so you can manipulate Controls without any problem.
Luc Pattyn
Local announcement (Antwerp region): Lange Wapper? Neen!
|
|
|
|
|
|
hi all,
In Visual studio's code editor, when the intellisense window pops up, the focus always remains on the editor window (instead of jumping to the popup window, I think this could have been handled by a SetWindowPos call with SWP_NOACTIVATE), what has puzzled me so much is that if you mouse-click an item or even drag the vertical scroll bar on the popup window, the focus still remains, the cursor flashes at the last character you have typed.
How is that possibly done?
|
|
|
|
|
The trick is to set the focus back to the text control after the code completion window is shown and after scroll bar value changes.
Control _parent = null;
void Show(Control parent) {
this.Show();
_parent = parent;
_parent.Focus();
}
void ScrollValueChanged(.....) {
_parent.Focus();
}
|
|
|
|
|
thank you Shameel.
I think this is a good solution, but not a perfect one. And i don't think Microsoft Visual Studio team has done this by this means. Seems the popup window can never be activated, by that I mean either the window is of WS_EX_NOACTIVATE style or it responds WM_MOUSEACTIVATE by MA_NOACTIVATE.
I made some test code on this using Winform. The popup window was made by a Form window hosting a ListBox window, I overrided the CreateParam to append the WS_EX_NOACTIVATE style for both two windows, I also overrided WndProc to make them respond WM_MOUSEACTIVATE by MA_NOACTIVATE. But all these didn't work:^^(
Maybe I have misunderstood WS_EX_NOACTIVATE or WM_MOUSEACTIVATE?
|
|
|
|
|
I've been playing around with a DataGridView today.
One of the things I noticed is that the ScrollBars behave differently when the thumb is dragged...
The vertical ScrollBar scrolls the rows one whole row at a time.
The horizontal ScrollBar scrolls the columns smoothly (which I suppose is usually the desired behaviour).
Because all my columns are the same width (and narrow -- think of a Scrabble board implemented with a DGV) I would prefer to scroll a whole column at a time.
Has anyone here achieved this?
This isn't actually a big deal, just a "nice to have". (I expect someone at MS considered it a YAGNI.)
Solution:
In my earlier attempts, I had been trying to force the scrollbar to jump by the column width.
Altering the HorizontalScrollingOffset directly to a value that is a multiple of the column width (X below) achieves the desired effect.
private void
dgResults_Scroll
(
object sender
,
System.Windows.Forms.ScrollEventArgs e
)
{
if ( e.ScrollOrientation == System.Windows.Forms.ScrollOrientation.HorizontalScroll )
{
this.dgResults.HorizontalScrollingOffset = e.NewValue / X * X ;
}
return ;
}
modified on Thursday, September 24, 2009 5:21 PM
|
|
|
|
|
I used the Visual Basic PowerPacks OvalShape in my program.
When I clicked on the oval, there will be blue dots appearing around it.
Why?
|
|
|
|
|
I have created an On-screen-Keyboard as a WPF user control.
This WPF user control works fine (whenever i press a button,the text goes to the focused element) when used in a WPF application.
But when i use this WPF usercontrol in a Winform application using elementhost.child, the text doesnot go to any focused element in winform.
How do i route the OSK text content[when i press any key..i.e. button] to any focused element[eg: textbox] in winform?
|
|
|
|
|
Hello Friends,
I am not able to set the cell value of datagridview on cell double click.
here is the code on cell double click :
GV.Rows(e.RowIndex).Cells(e.ColumnIndex).ReadOnly = False
GV.Rows(e.RowIndex).Cells(e.ColumnIndex).value = "TEST"
It is giving System.Data.ReadOnlyException.
Thanks & Regards,
Rahul
rahul saini
|
|
|
|
|
What is the DataSource for the DataGridView ?
What is the full error message?
Henry Minute
Do not read medical books! You could die of a misprint. - Mark Twain
Girl: (staring) "Why do you need an icy cucumber?"
“I want to report a fraud. The government is lying to us all.”
|
|
|
|
|
Hello Henry,
I am using DataGridView and bind it with DataTable.
Error Description:
DataGridView column bound to a read-only field must have ReadOnly set to True.
above error comes on this statement:
GV.Columns(e.ColumnIndex).ReadOnly = False
==================other error:============
this error occur on :
GV.Rows(e.RowIndex).Cells(e.ColumnIndex).ReadOnly = False
GV.Rows(e.RowIndex).Cells(e.ColumnIndex).Value = "text"
DataGridView Default Error Dialog
The following exceptions occurred in the DataGridView
System.Data.ReadOnlyException: Column 'Status' is Read only
at System.Data.Datarow.set_Item(DataColumn column, Object value)
at System.Data.DatarowView.SetColumnValue(DataColumn Column, Object value)
at System.Data.DataColumnPropertyDescriptor.SetValue(Object Component, Object value)
at System.Windows.Forms.DataGridView.DataGridViewDataConnection.PushValue(Int32BoundColumnIndex,
Int32 columnIndex, Int32 rowIndex, Object value)
To replace this default dialog please handle the DataError event
Regards
Rahul
rahul saini
|
|
|
|