|
Peter after some experimenting, I got there, thanks to you, your equation made sense and it worked! Much appreciated!
Thank you!!
|
|
|
|
|
You're welcome.
Peter
Software rusts. Simon Stephenson, ca 1994. So does this signature. me, 2012
|
|
|
|
|
Hello. I have downloaded and used a code project sample to merge .pdf files and it's fantastic; probably saved me lots of hours of searching, testing, debugging, etc. However, I'd like to be able to put the page numbers on the bottom of a page that has landscape orientation; not portait, which is how the example is set up. Could anybody tell me how to do this? iTextSharp documentation is scant, to say the least. That's the downside of open source. Thank you.
Tom Paronis
|
|
|
|
|
|
Thank you. My VB skills have totally atrophied but I should still be able to translate this.
|
|
|
|
|
I am getting ExecutionEngineException during execution of application. This sometimes happens while closing the application. Tried with windbg tool but did not find anything useful. Application uses both managed and unmanaged code. Tried googling but i couldnt get breakthrough.
It would be greatly helpful if someone give expert idea on this investigation.
|
|
|
|
|
Look at the documentation[^] to see what extra information you can capture at the point of error. You should collect as much information as possible about what is going on and possibly send it to Microsoft for analysis.
|
|
|
|
|
How does one enumerate the z-order of mdi child windows?
If that's too much to ask, then how can I at least find out which window is currently on top?
The difficult we do right away...
...the impossible takes slightly longer.
|
|
|
|
|
Have you checked the 'ActiveMdiChild' property of the MDI Parent Form?
MSDN:Activemdichild[^]
Jibesh V P
|
|
|
|
|
Thanks!
The difficult we do right away...
...the impossible takes slightly longer.
|
|
|
|
|
never mind. it happens to every one..
may be coz its friday eve
Jibesh V P
|
|
|
|
|
Although you've managed to get the top window, I thought this was an interesting one so I've had a play around.
Windows has a function EnumChildWindows[^] which gets the windows in Z order.
Something like this in the parent will get you an IEnumerable<Form> of the children in z order.
private delegate bool EnumChildProc(IntPtr hwnd, IntPtr lParam);
[DllImport("User32.dll")]
private static extern bool EnumChildWindows(IntPtr hWndParent, EnumChildProc lpEnumFunc, IntPtr lParam);
private IEnumerable<Form> GetChildrenSortedByZOrder()
{
List<IntPtr> handles = new List<IntPtr>();
if (IsHandleCreated)
{
EnumChildWindows(Handle,
(hWnd, lparam) =>
{
handles.Add(hWnd);
return true;
}, IntPtr.Zero);
}
List<Form> children = new List<Form>(handles.Count);
foreach (IntPtr handle in handles)
{
Form form = FromHandle(handle) as Form;
if (form != null)
children.Add(form);
}
return children;
}
|
|
|
|
|
After a bit of rooting around in the undergrowth of the outer form, I've found the ordered list of MDI windows.
The Form.MdiChildren property is a list of MDI children but the order is fixed in order in which the forms were created.
Enumeration of the Form.Controls collection will reveal an unnamed Control of type System.Windows.Forms.MdiClient whose Controls collection is the dynamically ordered list of MDI child forms. The first item is the form at the top of the Z-order.
private void ShowMdiChildren() {
log.WriteLine("MdiClient control collection");
log.WriteLine("============================");
foreach (Control c in this.Controls) {
if (c is System.Windows.Forms.MdiClient) {
System.Windows.Forms.Control.ControlCollection mdiColl = c.Controls;
foreach (Control mdiChild in mdiColl) {
log.WriteLine("{0,-2} {1, -20} {2, -16} {3}", mdiColl.GetChildIndex(mdiChild), mdiChild.Text, mdiChild.Name, mdiChild.GetType());
}
}
}
log.WriteLine();
}
By manipulation of the collection you can do fun things like reorder the child forms
private void RotateZOrder() {
foreach (Control c in this.Controls) {
if (c is MdiClient) {
Control.ControlCollection mdiColl = c.Controls;
if (mdiColl.Count >= 2) {
mdiColl.SetChildIndex(mdiColl[0], mdiColl.Count - 1);
}
}
}
}
Alan.
|
|
|
|
|
Hi,
I am creating a comma separated file with data from database.
The data is pretty much customer information.
Is there a way to code for special characters, like commas with the customer data?
Thanks!
|
|
|
|
|
I'd recommend to encode it in Base64. That way you can even throw (binary) pictures in there.
|
|
|
|
|
Surprisingly there is a standard for CSV.
Text Fields are surrounding by "". " escapes ", pretty simple.
|
|
|
|
|
How to optimise code every time needs to bind the grid
|
|
|
|
|
Your best of showing what code you think need optimization and others will let you know of potential improvements.
Lobster Thermidor aux crevettes with a Mornay sauce, served in a Provençale manner with shallots and aubergines, garnished with truffle pate, brandy and a fried egg on top and Spam - Monty Python Spam Sketch
|
|
|
|
|
sujeet321 wrote: How to optimise code
You do this by appying your VAST knowledge and experience in programming.
|
|
|
|
|
Look at the query first. Make sure you only pick up what you need to display.
Your gridview will be faster automatically.
|
|
|
|
|
In a gridview, how to change the background color of a selected row, on click of a cell in datagridview. Thanks in advance
modified 1-Feb-13 4:11am.
|
|
|
|
|
Handle the CellClick event:
private void myDataGridView_CellClick(object sender, DataGridViewCellEventArgs e)
{
DataGridView dgv = sender as DataGridView;
if (dgv != null)
{
dgv.Rows[e.RowIndex].DefaultCellStyle.BackColor = Color.Red;
}
}
If you get an email telling you that you can catch Swine Flu from tinned pork then just delete it. It's Spam.
|
|
|
|
|
Thanks for your reply.
The code which you sent changing the back color of a row, wherever I click in the gridview.
So entire grid resulted in red background color
My issue is to change the selected background color. To describe more, If I click on first row, background color should change to Dark Gray color. after that, if I click on second row, first row should get reverted to previous color and second row background color should be in darkgray color.
|
|
|
|
|
Do you expect me to do everything for you?
Keep a "I changed this" row index, and change it back. Then set the new row, and save the index. It's not exactly rocket science...
If you get an email telling you that you can catch Swine Flu from tinned pork then just delete it. It's Spam.
|
|
|
|
|
Strange how we both chose Red.
|
|
|
|