|
I don't want to read a post that has the words girlfriend and self satisfaction situated anywhere near each other.
Now - we don't want you to get your CP rights removed, which is what will happen if we give you help on this; also, you're likely to have your testes surgically removed with a soup spoon.
"WPF has many lovers. It's a veritable porn star!" - Josh Smith As Braveheart once said, "You can take our freedom but you'll never take our Hobnobs!" - Martin Hughes.
My blog | My articles | MoXAML PowerToys | Onyx
|
|
|
|
|
Soup spoon? Pah! Angry girlfriends have no need for utensils.
10110011001111101010101000001000001101001010001010100000100000101000001000111100010110001011001011
|
|
|
|
|
They do, if they reach down your throat to do it.
"WPF has many lovers. It's a veritable porn star!" - Josh Smith As Braveheart once said, "You can take our freedom but you'll never take our Hobnobs!" - Martin Hughes.
My blog | My articles | MoXAML PowerToys | Onyx
|
|
|
|
|
Not even a rusty spoon with a ragged edge?
|
|
|
|
|
Convince us you're not using it for evil before we give you any assistance.
PS Good luck, you'll need it.
It is a truth universally acknowledged that a zombie in possession of brains must be in want of more brains.
-- Pride and Prejudice and Zombies
|
|
|
|
|
nike_arh wrote: I am putting together a key logger
Stop right there. Get lost.
There is no way anyone around here is going to help you with this. Why?? Because the answers we give would help some other person who does not have the same sense of "ethics" you do. Sorry, but we're no opening ourselves up to litigation and/or criminal charges for aiding an illegal activity.
|
|
|
|
|
I have a float in a binary file ( 0x00, 0x00, 0x06, 0x8B ) (1675), on a Windows Machine, How do I read it in from a binary file in c#?
(The file was written big endian, I am trying to read it in on a little endian computer)
Currently I
{
BinaryReader BR = new BinaryReader(File.Open("test.bin", FileMode.Open), Encoding.BigEndianUnicode);
byte[] arr = BR.ReadBytes(4);
BR.Close();
float altmsl = GetFloat(arr, 0);
}
static float GetFloat(byte[] fullpacket, int startindex)
{
byte[] intarr = new byte[4];
Array.Copy(fullpacket, startindex, intarr, 0, 4);
Array.Reverse(intarr);
return BitConverter.ToSingle(intarr, 0);
}
and this returns a number to e-22
double, and int works just fine
|
|
|
|
|
Greg Mort wrote: 0x00, 0x00, 0x06, 0x8B
If by this you mean the lowest address holds 00, the highest 0x8B then it does not look like big-endian to me.
Check: skip the Array.Reverse() and watch your code return 1675?
|
|
|
|
|
correction
I see no way {0x00, 0x00, 0x06, 0x8B} could equal 1675
in fact on Intel processors the float number 1675 is stored as 00 60 D1 44 so only one byte is zero.
FWIW: the double number 1675 is stored as 00 00 00 00 00 2C 9A 40
|
|
|
|
|
|
Hi Greg,
I think you could use this code ( for little endian) :
int result = 0;
int limit = 4;
static float GetFloat(byte[] ToArray, int startindex)
{
for (int i=0; i <limit; i++)
{
byte thebyte = ToArray[startindex +limit-i-1];
result = result << 8;
result = result | thebyte;
}
return result;
}
I didn't manage binaries numbers wrote using big endian over little endian , but i think they are opposite in writing mode.
Try this, If it doesn't work change [startindex +limit-i-1] to [startindex +i]
hope this help you.
|
|
|
|
|
FYI, 0x0000068B is the int32 representation of 1675, not float. Also, if you're using the BinaryReader class, why not just use the ReadInt32, ReadSingle, etc. methods? Will they not work when you specify the endian-ness of the file?
Dybs
|
|
|
|
|
Hi to all,
I have a problem with a monochrome printer. ( samnung SCX-4x21 series)
I have a program that write a report on a printer. ( the content of the report consist of colored text and graphic objects ; I mean plain text, lines, rectangles , images..)
The problem is when I print the report on a monochrome printer. In this case for the objects with a black property color the rendering to the printer is ok , but for the objects with colored property the rendering to the printer is wrong. What is printed is a dirty gray color with wrong grain points.
I thought by myself that a monochrome printer translate a colored page content in a monochrome color automatically. doesn't it steel true? or am I wrong something?.
My snippet code is :
...
Printer = new System.Drawing.Printing.PrintDocument();
Printer.BeginPrint += new PrintEventHandler(doc_BeginPrint);
Printer.PrintPage += new PrintPageEventHandler(doc_PrintPage);
Printer.EndPrint += new PrintEventHandler(doc_EndPrint);
PrintController standard = new StandardPrintController();
Printer.PrintController = standard;
void doc_BeginPrint(object sender, PrintEventArgs e)
{
Printer.PrinterSettings.DefaultPageSettings.Color = false;
}
void doc_EndPrint(object sender, PrintEventArgs e)
{
}
void doc_PrintPage(object sender, PrintPageEventArgs e)
{
Pen ePen = new System.Drawing.Pen(Color.Orange, 1);
Font eFont = new System.Drawing.Font("Tahoma",08,FontStyle.Regular);
SolidBrush eBrush = new SolidBrush(Color.Red);
e.Graphics.DrawRectangle(FCanvasPen, e.MarginBounds.X, e.MarginBounds.Y, e.MarginBounds.Width, e.MarginBounds.Height);
e.Graphics.DrawString("some text", eFont , eBrush , 220, 50);
eFont.Dispose();
eBrush.Dispose();
ePen.Dispose();
e.HasMorePages = false;
}
Probably is a stupid question, but i can't get rid of.
Could someone help me to solve
|
|
|
|
|
If you know in advance that a monochrome printer is being used (e.g. user presses a button 'Print in Monochrome', or similar), you might be able to use a boolean field and convert the colors to greyscale. Something like:
if (monochrome)
{
Pen ePen = new System.Drawing.Pen(ConvertToGreyscale(Color.Orange), 1);
}
else
{
Pen ePen = new System.Drawing.Pen(Color.Orange, 1);
}
Font eFont = new System.Drawing.Font("Tahoma",08,FontStyle.Regular);
if (monochrome)
{
SolidBrush eBrush = new SolidBrush(Color.Red);
}
else
{
SolidBrush eBrush = new SolidBrush(ConvertToGreyscale(Color.Red));
}
For the ConvertToGreyscale Method Google for convert to greyscale c# there are so many different ways to do this, that you are better off choosing for yourself.
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.”
|
|
|
|
|
thanks Henry,
As I say in my post , I didn't know I must do it by hand. My knowledge is so poor?.
In any case, the only information I know is this flag in PrintDocument object:
( Printer.PrinterSettings.SupportsColor ).
When I tried to check this flag I got the contrary of the true; I mean , in a printer that support color I receive this flag false and vice versa. I am confused!
Do you confirm me this is the right direction ?
thanks
|
|
|
|
|
Have you looked at the MSDN documentation for PrinterSettings.SupportsColor? There is an example there that prints 2 pages, only the first in color. If this works for your printer, then you have the solution.
I had assumed that you had exhausted, all possibilities and that is why I suggested what I did, as if you had then there must be a peculiarity with your printer which my code might have overcome. I would suggest that you investigate the MSDN documentation further, and experiment with the examples you find there. You will learn more by doing that, than by asking on here.
If you do get stuck, by all means come back yo CP and ask a new question.
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.”
|
|
|
|
|
Thank you Henry,
Generally I don't like to get information on MSDN , because most times my ideas are clear when I get in to, and confused after I read the items that explain what they want and not what you are looking for.
I said "most times" , but not all times. Probably this time is right time. ( I hope!)
Thanks again.
|
|
|
|
|
I need to place some text rotated at 45 degrees onto a bitmap. The text needs to be centred on a specific point. Placing normal text centred on a point on a bitmap is easy enough, and I’ve googled a number of different solutions to rotating text ... but I can’t rotate *and* centre on a point at the same time. An added complication is the text may sometimes contain CRLFs.
Can anyone show me the code how to do this (in VS2005)? Thanks.
|
|
|
|
|
Hi,
this is my view on this:
1. first attempt to paint the text without rotation; the text height can be measured using Graphics.MeasureString; when given the available width it will optionally do word wrapping, and anyway it will calculate the effective width and necessary height. So you know the distance from topleft to center now.
2. you can ask a Graphics to do all transformations for you; first order a translation to the point where your text should be centered; then order a rotation; now draw the string with Graphics.DrawString at location (0,0). That should do it.
|
|
|
|
|
Hi Luc
Sorry to sound like a newbie but can you give me the code to show how this is done? I tried but got myself muddled.
|
|
|
|
|
No, sorry, I am not going to create and provide code. That is not how this site works. You do the effort, show some results, then ask specific questions.
So I suggest you raise the level of your knowledge where it is lacking by studying serious material (preferably a book) and/or performing some experiments.
Hint: when playing with TranslateTransform and RotateTransform, make sure to make your view much larger than you consider necessary, things go out of sight pretty soon, especially if you choose the wrong polarity for some of the factors.
|
|
|
|
|
Hello,
i have no problem to start a presentation by an c#-program (interop), but i need to navigate to slides by an externel source (via serial-interface).
Is there a way to "call" a special slide via PowerPoint-automation?
Heiko
|
|
|
|
|
I'm running a little code that should write code to a text file within the application directory, however I'm getting the following error:
Access to the path c:\inetpub\wwwroot\MapFile\Mapped.txt is denied
I'm logged on as Administrator on Windows Server 2008 and running VS 2008 SP1 / .NET 3.5.
Any ideas?
Jon
|
|
|
|
|
Navigate to that folder, view the properties -> security. Give Users write permissions.
|
|
|
|
|
This can also come up if the file has already been opened somewhere else in your code and you've forgotten to close it.
|
|
|
|
|