|
I want write text in an sdl window for this reason i will to create this control but keypress event need to map keyboard so i'll try to use wndproc...
|
|
|
|
|
Hi Dear
I use VS2005 , in windows app i want to have a thousand separator for numbers that shown in Textbox or MaskTextBox.
How can i do that?
|
|
|
|
|
thousand separator means ??
Do you want to create a custom textbox control??
|
|
|
|
|
Either use string.Format() or numberVariable.ToString(string formatString) to set the text for the TextBox
myTextBox.Text = string.Format(formatString goes here, numberVariable);
myTextBox.Text = numberVariable.ToString(format string goes here);
I'll leave you to look up format strings in MSDN.
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.”
|
|
|
|
|
hi everybody
i have a database named 'example',which is created in sql server 2000
now i want to convert it into msaccess 2007 through C# coding
hope you help me in this issue
thnx in advance
nagendra kumar
|
|
|
|
|
Generate a lot of inserts and execute them with a dataAdapter...
|
|
|
|
|
I need to create control that accepts rtf and draws it. Problem is that drawstring takes only regular text and I cant find anywhere how to draw rtf. Any sugestions are welcome and appreciated...
|
|
|
|
|
draw rtf
Have a look at 'RichTextBox' (that's a standard control)
|
|
|
|
|
Yes I know about richtextbox.. and load and save rtf etc. Please read post again. I need to draw rtf on user control. But thanks anyway.
|
|
|
|
|
You'll have explain a bit better what you mean with 'draw rtf'.
I don't really see the point in actually painting the text onto a usercontrol when the richttextbox (that you can drop onto a usercontrol) would accomplish all this for you. (if you don't want users to alter the text just set it to disabled or read-only)
|
|
|
|
|
Try using RichTextBox.DrawToBitmap, then rendering the bitmap. It's not perfect (it only draws the borders of embedded images), but suffices for a managed solution. I think you could use a method which draws a window (and by extension, control) image to a HDC, but I can't remember the name right now
|
|
|
|
|
Hi,
Conceptually OK, however a few days ago I learned RichTextBox.DrawToBitmap() does not really work.
I solved that by creating my own method, based on FormatRange, see here[^].
|
|
|
|
|
That's very clever. Did you print to another HDC instead of the one given by PrintPageEventArgs, or use another method?
|
|
|
|
|
public void DrawToBitmap(Bitmap bitmap) {
RECT rectToPrint;
rectToPrint.Top = 0;
rectToPrint.Bottom = (int)(bitmap.Height*anInch);
rectToPrint.Left = 0;
rectToPrint.Right = (int)(bitmap.Width*anInch);
RECT rectPage;
rectPage.Top = 0;
rectPage.Bottom = (int)(bitmap.Height*anInch);
rectPage.Left = 0;
rectPage.Right = (int)(bitmap.Width*anInch);
Graphics g=Graphics.FromImage(bitmap);
IntPtr hdc = g.GetHdc();
FORMATRANGE fmtRange;
fmtRange.chrg.cpMax = -1;
fmtRange.chrg.cpMin = 0;
fmtRange.hdc = hdc;
fmtRange.hdcTarget = hdc;
fmtRange.rc = rectToPrint;
fmtRange.rcPage = rectPage;
IntPtr res = IntPtr.Zero;
IntPtr wparam = IntPtr.Zero;
wparam = new IntPtr(1);
IntPtr lparam= IntPtr.Zero;
lparam = Marshal.AllocCoTaskMem(Marshal.SizeOf(fmtRange));
Marshal.StructureToPtr(fmtRange, lparam, false);
res = SendMessage(Handle, EM_FORMATRANGE, wparam, lparam);
Marshal.FreeCoTaskMem(lparam);
g.ReleaseHdc(hdc);
}
|
|
|
|
|
First of all I want to thank you all for replying to this topic... But disscusion went in te wrong way.
What I wanted is not any use of richtextbox, but method similiar to Graphics.Drawstring method that takes rtf instead of string and paints it on user control. Since there is no provided splution I guess I have to try to wirte some kind of parser that takes tekst and formating for it an use Graphics.Drawstring method...
|
|
|
|
|
|
Ok, thanks for the links. I'll take a closer look at ITextDocument.
|
|
|
|
|
I'm trying to build a custom control and I'd like to access some funcionalities of ClientScriptManager defined as internal on System.Web.UI
Here is a sample code:
namespace MyWebControls {
public class MyGridView : System.Web.UI.WebControl.GridView {
...
protected internal virtual MyMethod(object pLiteral) {
...
var vLiteralName = ClientScriptManager.GetScriptLiteral(pLiteral);
...
}
...
}
}
I've tryied also:
var vLiteralName = this.Page.ClientScript.GetScriptLiteral(pLiteral);
The functionality exists but is defined as internal. How can I access it?
Maybe some property on the Assembly. Change the namespace. I've tryied several things.
Please give me some light.
Thanks.
|
|
|
|
|
If the function you're trying to access is marked internal, it's only accessible from within the same module:
From HELP:
The internal keyword is an access modifier for types and type members. Internal types or members are accessible only within files in the same assembly.
A common use of internal access is in component-based development because it enables a group of components to cooperate in a private manner without being exposed to the rest of the application code.
For example, a framework for building graphical user interfaces could provide Control and Form classes that cooperate using members with internal access. Since these members are internal, they are not exposed to code that is using the framework.
It is an error to reference a type or a member with internal access outside the assembly within which it was defined.
|
|
|
|
|
|
Hi All,
does anyone know how to assign ownership of files and folders?
i have the code to take ownership myself, but can't figure out how to assign ownership to someone else - but i can in the GUI(Vista)!!
There are other 3rd party apps which can do it (setowner.exe) but i wanted to build my own so i can have extra functionality.
i have found this article:
"One of the security constraints of NTFS/NT is that you are only
allowed to set the owner of a file to yourself (e.g. "take ownership")
or to the "Administrators" group. However, there is a "side entrance"
whereby you can assign any arbitrary user as the owner, even if
they're not an administrator. This is a privilege that is *granted* to
administrators and backup operators, but NOT *enabled* by default. So,
how do you enable this? Unfortunately there is no native .NET way to
do this"
so my question is, does someone know how to make C# do this?
Many Thanks,
Phil
|
|
|
|
|
My app (which is part c++/cli and part c#) generates bitmaps on the fly, and they exist in memory initially as arrays of unsigned char (width * height * 3 bytes (rbg)).
I need to be able to crop, resize, rotate (90, 180 degrees), mirror and flip these images in an efficient way.
I've previously used GDI+, but GDI+ has some serious threading issues (although it allows multiple threads, only one thread per process actually gets executed by GDI+ at a time).
So i need a replacement image processing library. I looked at CImg, but internally it organises data into separate arrays, one per colour channel, which would make it a headache to get my data into and out of the library.
is anyone familiar with any other libraries which will meet my needs? could be c# or c++, it doesn't really matter.
|
|
|
|
|
Jon Hulatt wrote: only one thread per process actually gets executed by GDI+ at a time
Interesting. Do you have a link to that information?
|
|
|
|
|
|
Do you know that person? I mean that is certainly not authoritative.
I would consider this[^], a more reliable source. Note that he speaks specifically about Vista. I have no idea if previous implementations are identical in this regard.
|
|
|
|