|
click the little [...] button next to the "Image" field under the "Appearance" section of the picturebox's property window.
-Spacix
All your skynet questions[ ^] belong to solved
I dislike the black-and-white voting system on questions/answers.
|
|
|
|
|
Hi.
I wanted to convert this string to an image :
iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAA
ACXBIWXMAAAsSAAALEgHS3X78AAAABGdBTUEAALGOfPtRkw
AAACBjSFJNAAB6JQAAgIMAAPn/AACA6QAAdTAAAOpgAAA6m
AAAF2+SX8VGAAAEJElEQVR42mL8
8JQBCDiNaoSY/v4M+sfMbgriSwp+eK3Lf/qDHO8n11u3mS
8fOclQ9/XvlW8gOYAAYgERZSlGi1TUtaQc7NK0rn3nmxBs
yBlnqybAcP2XLMN7bmmGV68/Mry6ycOwMHT/f34eZrclO7kiZXh0Y558ubwfIIAYQS44OqXgjYGloTDTi+0
MjEysDD9EgxhmHv7AwKFuwMAoLMHw5x8Dw9effxjET9YxpJ
pdZ/jLwMKw9yzzp+j6d/YAAQBBAL7/AiASNBEA+eoCBvX
TAAAD/AD6AyYA/9+2APTNngDDu74A2Ov1AOPy+QDx+v4Azy
x9AJDOOgADAPw
ARzb6Di4hAmUCiDnOWas1zovf6fe3Fwx/Xj1m+PvuNcNfZl
kGczV5hiWnXzKc59FieP7lD8PXX38ZfgKdcuqbHIMf2y4G
bk5gWP1nkgUIAEEAvv8EEQPzJf/u4QD9AQQA/fL1AAL8/g
AOCOcAlM4CAMQWUgD87/gABQP6AOYFAQATCgUA9/X+AN/q
AgAWE/8AQCwEFQIAQQC
+/wTt9f0D/ezvAP4FAAD8+P8A6N72AH647gDHDDMA/SgQA
AD8/AD7/gIA7/wBAPn7/QD829UA7CT9AAAsBACw0QYDAoj
p64MPwn9eAw349o3h21
dmBmZWFgZ93rcMHDx8DOuepzJU3ahk4L9+mOHvv78Mn7
ZuB9fY3BU+0/0P0cDNzifxkAAgBBAL7/AuDqBOLz4PMAAPLyAAwMBwARIxwAbDUFAMIhpgA7EekAc
B3SADLyzgAA/P0AAff1ACb/4AACIgwAAAsHAPXpAwACAEEA
vv8C2fcBotTV/AD96/YABP7qAAz/7AAB/fcAuMz0AFu/LAAd1W0AwDBoAAL39QBIzpEAmEHnAAAZLQD++QAAjrPxsw
IAQQC+/wP0/uzd7vgXbTz/8wkGEv0ABQ8NAAH25AAUEgwAwfETAO0EFAAV5M8Aae6oA
JpK8AAVUC8AAO/9AIKH1QCzyPVVAgickLgFzPLrf1ye4K7
1g4HXQpBBUI4d6OT/DGxfuBn+/vrP8A8YkEzsTAzMOn8Z
2OUUGM5u/MjgsoTryJe3Jx0BAghsACMjI7egkMXe4o+Xz
F15vjFwqjAx8KhyM/CKczMwsjEA0x0bAyPrfwYOuX8Mu8
5wMyRt4X/4+sVpc6DelwABBDOAEZglRNjEHWcbfH3mH/btIYPmvx8MQEsZ2MUYGdhVWBhesPMyzH8qwrD9g8TFHy
8OhQLVPwDq/Q0QQGADQABoBlA5gyATl5QpC596LdAT+lz
AghuAAwADeIAuQaIRYGYl4lLgu/ftxevgew3QPwKiL8C9
fyDqQcIMACDoJbT47bbfAAAAABJRU5ErkJggg
So I used this method :
private Image Base64StringToImage(string base64ImageString)
{
byte[] b;
b = Convert.FromBase64String(base64ImageString);
MemoryStream ms = new System.IO.MemoryStream(b);
Image img = System.Drawing.Image.FromStream(ms);
return img;
}
but this Exception occurred :
Invalid length for a Base-64 char array
What do I have to do ?
Sorry for my English. I'm a freshman .
|
|
|
|
|
Google for the exception text.
Giorgi Dalakishvili
#region signature
my articles
#endregion
|
|
|
|
|
it is invalid data for base64
-Spacix
All your skynet questions[ ^] belong to solved
I dislike the black-and-white voting system on questions/answers.
|
|
|
|
|
Thanks.
Sorry for my English. I'm a freshman .
|
|
|
|
|
Hi
I tried to apply custom drawing on Windows Vista titlebar, interecepting WM_NCPAINT message.
To get a device context I used GetDCEx API function, but it fails if a second parameter is
a pointer to a clipping region ( wParam ), so I had to pass it IntPtr.Zero. It works, but then
all drawing logic is performed inside the window client area.
Is there any other solution to modify non client area on Windows Vista?
Thanks.
|
|
|
|
|
|
|
Start by asking in the correct forum. You are looking for ASP.NET..
|
|
|
|
|
(Just learning C# and trying to do what I did in C++ with C#, and this is not an urgent question)
I have a COM "server" with a method FileOpen which returns a HRESULT :
...
[id(2), helpstring("Open a file.")] HRESULT FileOpen([in] BSTR filename);
...
STDMETHOD(FileOpen)(BSTR filename);
...
When I added the reference to my COM stuff in my sample C# project, the method is listed as Void FileOpen(...) (when I look at the browser in the IDE), I loose the return code.
Am I missing something ? As far as I understand, the COM is wrapped in a proxy (Runtime callable Wrapper) of some kind; I assume this strips the return value from the prototype ?
Thanks for any help, hints, tips, or links (or even better) for google keywords that can help me in my searches.
Max.
This signature was proudly tested on animals.
|
|
|
|
|
Maximilien wrote: this is not an urgent question
That makes this a very very good question
Maximilien wrote: the method is listed as Void FileOpen(...) (when I look at the browser in the IDE), I loose the return code.
That is correct. AFAIK, the COM wrapper will check the HRESULT and auto throw the COM Exception, kinda neat, hey? (I could be completely wrong too, hehe)
|
|
|
|
|
That's what I just discovered, and above all, there is a HResult property in the System.Exception
Thanks.
This signature was proudly tested on animals.
|
|
|
|
|
|
baai koel
|
|
|
|
|
ja lekker hehe
|
|
|
|
|
Well I didnt really know, well maybe I did, I have been grinding on .NET for almost 7 years so I cant really recall. Anyways just follow the element of least surprise principle
|
|
|
|
|
I am using StreamWriter to write out some jpeg data in byte[] to a file.
The result of my file is always "System.Byte[]"
byte[] jpegData = new byte[img.Length];
jpegData = Convert.FromBase64String(img);
using (StreamWriter sr1 = new StreamWriter("C:\\123.jpg"))
{
sr1.Write(Convert.ToString(jpegData));
sr1.Flush();
sr1.Close();
}
|
|
|
|
|
Why don't you use BinaryWriter instead?
Giorgi Dalakishvili
#region signature
my articles
#endregion
|
|
|
|
|
System.IO.File.WriteAllBytes()
|
|
|
|
|
Thanks, this worked great.
Do you know how i would write this jpeg data in the form of byte[] to a form instead of to a file? So in other words i would like to display jpg on the form. Would i need a picture control?
|
|
|
|
|
You can simply do:
myform.BackgroundImage = Image.FromStream(new MemoryStream(jpegbytes));
|
|
|
|
|
thanks, i'll try that.
If i would like to put 4 images on the form, i would have to write them to a control write?
|
|
|
|
|
Hello I have one question regading the conversion of Hex String into Decimal number.
Hex Number is in format
“aaaaaa”
This 24-bit field is the direction “A” counter stored LS-byte first.
Example is, take this hex string "100000" which is decimal equivalent is 16
But i don't know how to convert this number into decimal number. If i give this number to C# function it is not giving me the exact 16 equivalent.
Another exanples are
060100= 262
1C0000= 28
Can any body please help me how to convert these numbers into decimal equivalent using C#
Thanks
Shailesh
|
|
|
|
|
int.Parse(hexValue, System.Globalization.NumberStyles.HexNumber);
Hogan
|
|
|
|
|
Thanks Hogan but i think you did not read the question. It is writing the LS byte first when i use your solution it is giving me 1048576 not 16.
Any body please help me
Thanks in advance
shailesh
|
|
|
|