 |
|
 |
When posting your question please:- Choose the correct forum for your message. Posting a VB.NET question in the C++ forum will end in tears.
- Be specific! Don't ask "can someone send me the code to create an application that does 'X'. Pinpoint exactly what it is you need help with.
- Keep the subject line brief, but descriptive. eg "File Serialization problem"
- Keep the question as brief as possible. If you have to include code, include the smallest snippet of code you can.
- Be careful when including code that you haven't made a typo. Typing mistakes can become the focal point instead of the actual question you asked.
- Do not remove or empty a message if others have replied. Keep the thread intact and available for others to search and read. If your problem was answered then edit your message and add "[Solved]" to the subject line of the original post, and cast an approval vote to the one or several answers that really helped you.
- If you are posting source code with your question, place it inside <pre></pre> tags. We advise you also check the "Encode HTML tags when pasting" checkbox before pasting anything inside the PRE block, and make sure "Ignore HTML tags in this message" check box is unchecked.
- Be courteous and DON'T SHOUT. Everyone here helps because they enjoy helping others, not because it's their job.
- Please do not post links to your question in one forum from another, unrelated forum (such as the lounge). It will be deleted.
- Do not be abusive, offensive, inappropriate or harass anyone on the boards. Doing so will get you kicked off and banned. Play nice.
- If you have a school or university assignment, assume that your teacher or lecturer is also reading these forums.
- No advertising or soliciting.
- We reserve the right to move your posts to a more appropriate forum or to delete anything deemed inappropriate or illegal.
When answering a question please:
- Read the question carefully
- Understand that English isn't everyone's first language so be lenient of bad spelling and grammar
- If a question is poorly phrased then either ask for clarification, ignore it, or mark it down. Insults are not welcome
- If the question is inappropriate then click the 'vote to remove message' button
Insults, slap-downs and sarcasm aren't welcome. Let's work to help developers, not make them feel stupid.
cheers, Chris Maunder
The Code Project Co-founder Microsoft C++ MVP
|
| Sign In·View Thread·PermaLink | 5.00/5 (4 votes) |
|
|
|
 |
|
 |
Using C# 3.5 I develop a WinForm application that should mimic a word processor, e.g. allow users to type text, insert images and tables and apply certain formatting styles to them. Then I need to parse the text, replace certain variables with data from a database. merge multiple 'documents' and create output in at least PDF and possibly either DOC, RTF or HTML.
At first I thought this shouldn't be hard: there are so many commercial and open source components available. At least one of them should fit my needs. But I seemed wrong about that: I cannot find any suitable technique that allows me to do all this without bugs or too much complexity. For instance:
I've tried RTF: .net RichTextBox control cannot adjust the table's width, nor would I like to search/replace rtf-fieldcodes to add data driven content. TX TextControl seemed like a good choice, but it is a wrapper around some native win32 dll that has it's limitations as well (conversion / resizing / drawing issues). TE Edit has buggy table-support PinEdit uses Internet Explorer (I don't like dependencies to Internet Explorer) DevExpress has no table support in their RichEdit component
That's when I thought I would like to separate content and layout and use an officially accepted standard for that. So I looked at XML-authoring components such as XMetal and Syntext Serna, but they seem offer much more than I need (such as workflow), complex to configure and embed and don't fit the skin in my application.
After all this I've seem to have hit a brick wall.
Can anyone give some advise, leads, directions or best practices?
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
 |
Hi All,
I have a problem with the FolderBrowserControl. When I use the FolderBrowserDialog in my application on a Windows Server 2008 system a strange behaviour can be recognized. If I open the dialog the first time it is displayed the way it should. When I open it a second time, the tree control looks different. The plus signs aren't displayed any longer. Instead only blank squares are displayed (Sorry for not attaching a picture. But I don't have a server where I could put it...) This behaviour can't be reproduced on Windows XP, it only occurs on Windows Server 2008 systems. The control is created in a separate class and is opend from a grid.
//as special folder the desctop is used public MyControl(Environment.SpecialFolder folder, bool createFolder) {
m_IsModified = false; m_FolderBrowser = new WinForms.FolderBrowserDialog(); m_FolderBrowser.ShowNewFolderButton = createFolder; }
//this method is executed from the grid public WinForms.DialogResult ShowDialog(WinForms.IWin32Window window) { WinForms.DialogResult ret = m_FolderBrowser.ShowDialog(window); m_IsModified = (ret == WinForms.DialogResult.OK);
return ret; }
public void Dispose() { m_FolderBrowser.Dispose(); m_FolderBrowser = null; }
I really don't have any idea why this problem occurs and how to solve it. I hope you can help me. Thanks.
Best Regards, Viola
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
 |
i want to drag a control and drop it on some other position in the same form window. can any body please help me on that.
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
|
 |
|
 |
Hint: Use the MouseDown, MouseMove and MouseUp events and change the Location property of the control.
modified on Tuesday, November 17, 2009 10:36 AM
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
 |
I am using Visual C# Express 2008 SP1 on Windows Vista will all the updates applied. No matter what I try, I can't open some inherited forms (if I am even using that term correctly) in the Forms Designer. But my project builds just fine! I am going nuts not being able to design my forms. I am having trouble because I re-did my project's namespaces and maybe the designer is getting confused.
The form I want to open is in the 'Windows' namespace (something I made up, i.e. MyProject.Gui.Windows) and the baseform and its base are in the 'Docking' namespace as in MyProject.Gui.Docking and I think it is because my namespaces must somehow be retarded is why I am getting the error:
at System.ComponentModel.Design.Serialization.CodeDomDesignerLoader.EnsureDocument(IDesignerSerializationManager manager) at System.ComponentModel.Design.Serialization.CodeDomDesignerLoader.PerformLoad(IDesignerSerializationManager manager) at Microsoft.VisualStudio.Design.Serialization.CodeDom.VSCodeDomDesignerLoader.PerformLoad(IDesignerSerializationManager serializationManager) at System.ComponentModel.Design.Serialization.BasicDesignerLoader.BeginLoad(IDesignerLoaderHost host) I am also doubly confused becuase my code builds just fine. My code is as follows:
baseform of the baseform:
using System; using System.ComponentModel; using System.Drawing; using System.Windows.Forms; using System.Runtime.InteropServices; using System.Diagnostics.CodeAnalysis; using System.Diagnostics;
namespace MyProject.Gui.Docking { public class DockContent : Form, IDockContext { public DockContent() { InitializeComponent();
}
} }
The baseform of the baseform (above) has no .designer.cs file. It is part of the WeifenLuo.Docking library. I subsumed the library directly into my project's namespace structure so I don't have to lug around DLL's. I can view this baseform of the baseform in the designer just fine.
Now on to its first-level derived form ToolWindow. i.e., the code is
using System; using MyProject.Gui.Docking; using MyProject.Core;
namespace MyProject.Gui.Windows { public partial class ToolWindow : DockContent { public ToolWindow() { InitializeComponent(); }
... } } Notice how I derive from DockContent class which is in the Docking namespace but my child form is in the Windows namespace. I tried putting the child class also in the same namespace but the child form still would not design.
But changing the namespaces doesn't do anything! Even if all the forms in the hierarchy are still in the same namespace the Forms Designer still craps on me. I suspect I am being completely retarded about something but I can't figure out what. Any help would be appreciated.
Sincerely Yours, Brian Hart
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
 |
Hello, I'm working on Windows application c# i have form1 which contain data gridview to view the content of table from sql database. i've enabled edit, delete in the gridview, and then i've added two queries one for update and the other for delete through MyDataSet1.xsd page. now after updating and/or deleting any record i wanna click on a button to confirm user that the operation done. but i don't know how to save updating or deleting!!
any help guys?
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
 |
1. Handle the UserDeletingRow event 2. Query the user if he/she wants to delete the row 3. Set the DataGridViewRowCancelEventArgs.Cancel = true, based on the response.
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
 |
Hi,
I have a little problem with CheckedListBox control. Is there any way to disable checking control items on keyboard key press? I want to disable checking when alphabetical and numerical signs are pressed. Sorry for my bad english.
Peter.
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
|
 |
|
 |
In my Windows Forms application I have a listbox on the form. This is a multiple selection list box.
I can use SelectedIndices property to get the indices of all the selected items.
However, given an index number, is there a simple way to tell if the item is selected or not? Right now I search the SelectedIndices to see if the index is there. I wonder if there is a method call to tell me directly if an item is selected or not. I tried to find that but couldn't.
Thanks!
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
 |
Hi,
you could try listBox.Items.Contains(...)
Luc Pattyn
I only read code that is properly indented, and rendered in a non-proportional font; hint: use PRE tags in forum messages
|
| Sign In·View Thread·PermaLink | 1.00/5 (1 vote) |
|
|
|
 |
|
|
 |
|
|
 |
|
 |
it should be listBox.SelectedIndices.Contains(...)
listBox.Items.Contains(...) will be true for all items.
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
 |
Hello, I am using propertyGrid window to display name and its value. I allow the user to enter value and if he enters a wrong value (there is a seperate code to validate), then I am supposed to display the user entered text value in red color (text in red color) or the back ground color of that particular cell alone (not the entire propertyGrid window) in red color. Is this posssible using PropertyGrid?
I can understand that the color of entire propertyGrid can be changed, but I am looking for changing single cell's either the text color or the background color of the particular cell to red.
Thanks in advance
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
 |
The ProeprtyGrid cannot change the color of individual cells. How each cell is rendered, including color, is left up to the UITypeEditor for each property. You'd have to create a new UITypeEditor for each of the properties that you want to be able to render in a different color.
Documentation on User Interface Type Editors[^].
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
 |
I tried using UITypeEditor which allows me to paint the cell, but it also displays a small recangular box in the cell, which makes my display look ugly. Can you tell me how to get rid of this small rectangle?
The rectangular box appears as soon as I override the following function of UIEditorType
public override bool GetPaintValueSupported(ITypeDescriptorContext context) { //Set to true to implement the PaintValue method return true; }
I tried clearing the cell in PaintValue method but that did not work
public override void PaintValue(PaintValueEventArgs e) { base.PaintValue(e); Region reg = new Region(new Rectangle(e.Bounds.X , e.Bounds.Y, e.Bounds.Width+10 , e.Bounds.Height)); Region tempReg = e.Graphics.Clip; e.Graphics.Clip = reg;
// Tried to clear the entire cell with white color but still the small rectangle appears e.Graphics.Clear(Color.White); e.Graphics.Clip = tempReg; // Fill region also did not work //e.Graphics.FillRegion(Brushes.Red, reg); } }
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
 |
Since I can't see the "small rectangle" you're talking about, no I can't tell you how to get rid of it.
Perhaps a screen shot would help??
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
 |
I m trying to click mouse automatically using code in some specific location for this i m using following code but its not working
[System.Runtime.InteropServices.DllImport("user32.dll")] public static extern void mouse_event(int dwFlags, int dx, int dy, int cButtons, int dwExtraInfo);
public const int MOUSEEVENTF_LEFTDOWN = 0x02; public const int MOUSEEVENTF_LEFTUP = 0x04; public const int MOUSEEVENTF_RIGHTDOWN = 0x08; public const int MOUSEEVENTF_RIGHTUP = 0x10;
public void MouseClick() { int x = 100; int y = 100;
mouse_event(MOUSEEVENTF_LEFTDOWN, x, y, 0, 0); mouse_event(MOUSEEVENTF_LEFTUP, x, y, 0, 0); }
Plz Help me To move cursor i m using Cursor.Position = new Point((int)10, (int)10); thats working fine
Plz help
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
|
 |
|
 |
Hi,
I'm using the following user32 functions: - SetCursorPos() to move the mouse - SendInput() to give a MOUSEEVENTF_LEFTDOWN and MOUSEEVENTF_LEFTUP
IIRC the x,y parameters of mouse_event describe a relative mouse movement, so I keep them at zero.
Here are my P/Invoke prototypes:
[DllImport("user32.dll", CallingConvention=CallingConvention.StdCall, SetLastError=true)] public static extern IntPtr SendInput(int count, ref INPUT2 input, int size);
[DllImport("user32.dll", CallingConvention = CallingConvention.StdCall, SetLastError = true)] public static extern IntPtr SetCursorPos(int x, int y);
public struct MOUSEINPUT { public int dx; public int dy; public int mouseData; public int dwFlags; public int time; public IntPtr dwExtraInfo; }
public struct INPUT2 { public uint type1; public MOUSEINPUT mi1; public uint type2; public MOUSEINPUT mi2; }
Luc Pattyn
I only read code that is properly indented, and rendered in a non-proportional font; hint: use PRE tags in forum messages
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
 |
Hi,
Kindly help me, i took textbox from one of my other project into my current project but whenevr i click on Form Design its showing me this errors:
The variable TextBox1 is either undeclared or was never assigned Plzzz help me...
Thank you
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
 |
mirzamujib wrote: The variable TextBox1 is either undeclared or was never assigned
That's a fairly clear error message. Somewher in your copying you have omitted an allocation or reference so the main form does not have a variable called TextBox1. Take a look at the form and also the code behind to see which parts are missing. You would probably have found it simpler to add a new text box from scratch rather than doing it this way.
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |