|
I'm trying to disply a picturebox on top of an existing picturebox and the second one is showing up underneath the first and isn't visible. Is their a simple solution to remedy this , I really hope so because I don't want to rewrite a bunch of code. The picturebox that is underneath has a bitmap of a poker table and the picturebox on top is a bitmap of the cards that are going to lay on the table. If anyone can help I would really appreciate it. Thanks.
|
|
|
|
|
See if these two methods help you:
BringToFront()
SendToBack()
Why do we close our eyes, when we dream?, When we cry?, When we imagine?, When we kiss?, Its because the most beautiful things in the world are unseen
|
|
|
|
|
I tried these but it doesn't work. I tried to SendToBack the image that was supposed to be on the bottom and SendToFront on the image that was supposed to be on top but the SendToFront image was still underneath. Thanks any way though.
|
|
|
|
|
Well you have to make a class and inherit pictureBox.
then inside the class
protected override CreateParams CreateParams
{
get
{
CreateParams cp=base.CreateParams;
cp.ExStyle|=0x00000020;
return cp;
}
Protected override void OnPaintBackground(PaintEventArgs e)
{
}
Win32newb
"Programming is like sex, make one mistake and you have to support it for a long time"
|
|
|
|
|
This is a pretty bad way of trying to comp an image. While not either extend PictureBox or even just some other control and override OnPaint . Paint the pictures in the order you want them to appear. So, you'd paint the bottom image first, then paint the top image second. Overriding OnPaint will pass you a PaintEventArgs , from which you can use the Graphics property to call DrawImage or DrawImageUnscaled . It's really quite easy.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
When the mouse is moved over PrintPreviewControl, how to change the cursor when it is on the document that is displayed in the control. It should remain at default state outside the document.
regards
|
|
|
|
|
change the cursor property of printPreviewcontrol.
Sreejith S S Nair
|
|
|
|
|
if i change it, the cursor will change as soon as mouse enters in the PrintPreviewControl, thats not solving my problem, i want it to change only on the document that is displayed inside the control. meaning, there exist some vacant area inside the control that is not been occupied by the displayed document, in that area cursor should have default value. It should change on the area occupied by the document.
regards
|
|
|
|
|
THe PrintPreview Control doesn't expose this kind of functionality. You'd have to extend the control and add this functionality yourself. Calculating the screen coordinates of the page 'image' is going to be the hard part. Since the underlying control does all the painting, your going to have a ruff time doing this. You could at least use the OnEnter and OnLeave events of the control to know when the mouse is actually in the control. From there, you'd have to figure out the coordinates relative to the page image rectangle(s).
No, I haven't done it before, and don't know exactly how. I have no source code or sample to give you...
RageInTheMachine9532
"...a pungent, gastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
More over can we decide the layout of the document to be displayed, meaning can we decide like A4 or Letter size layout for the document?
|
|
|
|
|
Yes. See the PageSettings property, which sets the default page size, though you can change it if desired while printing each page. It's all documented in the .NET Framework SDK.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
I think I did't get your answer, there is no such property in the property list of PrintPreviewControl.
Please elaborate more, also guide me about the first question
regards
|
|
|
|
|
The PageSettings doesn't belong to PrintPreview... It belongs to the PrintDocument that the PrintPreview control is using as a source.
A simple search in the documentation would have told you this. All you had to do is type 'PageSettings' into the Index...
RageInTheMachine9532
"...a pungent, gastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
How to sence click even on the document when two pages are displayed in PrintPreviewControl.
How to identify which page is clicked?
|
|
|
|
|
The PrintPreviewControl doesn't expose this functionality. You'd have to extend the PrintPreviewControl class and write the functionality in yourself. Getting the screen coordinates of the page 'images' will be the ruff part (Good Luck!). Once you have that, it's not too hard to figure out if the mouse cursor is inside those rectangles to determine which page is clicked.
A better bet would be to look into a 3rd party PrintPreviewControl.
RageInTheMachine9532
"...a pungent, gastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Hi All
I have a problem where i am reading in a csv file but within the file each field within a line has double quotes surrounding the data, and occassionally the data will have commas in it eg: "01","test","this,is the,problem","test"
What i want to do is remove the commas within the quotes, and leave everything else.
If any one has an idear please help.
regards Odyssey
|
|
|
|
|
Actually, the real problem is how you're parsing the file. Instead of simply using String.Split to split using commas, enumerate the characters in the line and keep track of when you come across a double quote. Increment a counter or set a boolean. When you run into another quote, decrement your counter or reset a boolean. When the counter is 0 or your boolean is false, then you can parse a comma-dilimited field. The typical CSV (there really isn't a standard) uses double quotes to signify that a delimited field may contain the actual delimiters. Simply removing the delimiters within those quotes would be corrupting the data.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
You can either use regular expression or odbc connection using microsoft text driver to parse csv files.
//Start of joke
Never comment ur code. If it was hard to write, it should be hard to understand !!!
//End of joke
|
|
|
|
|
|
Uwe Keim wrote:
How would such a RX look like?
A nice article[^] on 4GuysFromRolla for parsing csv files.
Uwe Keim wrote:
you have to use something similar to YACC or LEXX
Any pointers would be great.
//Start of joke
Never comment ur code. If it was hard to write, it should be hard to understand !!!
//End of joke
|
|
|
|
|
<br />
string s = "\"01\",\"test\",\"this,is the,problem\",\"test\"";<br />
string[] values = Regex.Split(s, @"(?<=\x22)\s*,\s*(?=\x22)");<br />
foreach (string val in values)<br />
Console.WriteLine(val);
OUTPUT:
"01"
"test"
"this,is the,problem"
"test"
Note that this solution requires every field to be delimited with double-quotes. If some fields are not (as often the case with CSV numeric data) the Split above will not work. However, such data is still certainly within the capabilities of a RE parse … instead of the RE Split , you would capture the desired data in the Groups collection using Match … the RE would describe the values you want; and not the space between them (as in the split above).
Also note that I used zero-width look-ahead and look behind assertions to keep the double quotes on the values. If you did not want them as part of the value, the Split RE would look as follows: @"\x22\s*,\s*\x22" . You would then have to remove a double quote at the beginning of the first value and one at the end of the last.
|
|
|
|
|
Hi
I tryed to use the RTF codes in RtfBox, doesnt work
How can i bold a text in a RTFBox without the "SELECT Method"(Select the text, and the Selection Font and Color ) ?
only \b doesnt work, appers a square
Thanks.
|
|
|
|
|
First off, you're getting the square because you're trying to set RTF codes using the Text property, which has no knowledge of RTF codes. (And you're not using the @ symbol in front of your string, so C# thinks "\b" is an escape character. Either make it a string literal or escape the backslash "\\b".)
If you want direct access to the RTF codes in a RichTextBox , you should use the Rtf or SelectedRtf properties.
However, I don't think that's what you're looking for, as it will make it quite a bit more difficult than using SelectionFont , SelectionColor , etc. The Rtf and SelectedRtf properties will give you the entire Rtf formatting string for the contents of the control or selection, respectively. There are intended more for pasting RTF from other sources. You can't use them to simply turn bold or color on or off.
Charlie
if(!curlies){ return; }
|
|
|
|
|
Hi,
I'm populating a DataTable in a DataGrid via asynchronous callbacks. Right now my program is single-threaded and I add each "event" (actually a MSMQ msg) to a Queue using lock in the PeekCompletedHandler. I process MSMQ peeks by firing a timer every 3 seconds and, if the queue has events, dequeue the msgs with lock.
Sometimes the program will run for hours with no problems. Sometimes I get an exception saying a Generic GDI+ error has occurred and the DataGrid's screen real-estate is blanked-out and has a big red "X" throught it.
I can't figure out what it causing this. Does anybody what is wrong and how I fix this?
TIA,
Matt
|
|
|
|
|
If you're setting (and even getting sometimes) properties or calling methods on controls from your asynchronous callbacks, are you using Control.Invoke ? It's important that when modifying a control from another thread (which async calls are on) that you make the changes in the thread on which the control was created. See the Control.Invoke method and Control.InvokeRequired property documentation in the .NET Framework SDK for more information.
Why does it works sometimes? It's not absolute behavior to fail or succeed (well, not in all cases) if you do modify a control from a different thread than what it was created on. It basically comes down to the Windows messaging system that is used for Windows Forms and the threads that the message pumps are running on. More information can be found in the .NET Framework SDK.
Another possibility is that you're not disposing disposable objects. While you'll typically run into memory problems, other strange things can happen as well (like depleating available handles). Telling us exact what the error was may help.
Microsoft MVP, Visual C#
My Articles
|
|
|
|