|
try aligning the button edges to the borders .... I had that kinda of issue but I got around by trial and error
Pushkar Pathak
|
|
|
|
|
I'm having problems trying to accomplish a certain task. I want to save some custom information about an image and then save the image itself in the same file. I can write and read my infomation by itself using a binary writer/reader but as soon as I try to throw a System.Drawing.Image in the mix things get messed up. Am I going about using the image correctly like this:
...<br />
System.IO.FileStream iStream = new System.IO.FileStream(FileName, System.IO.FileMode.Append, System.IO.FileAccess.Write);<br />
Image.Save(iStream, System.Drawing.Imaging.ImageFormat.Png);<br />
...
It seems to me that as soon as I do the above code the filestream gets all weird and I it's no longer in a readable format.
Please help,
Rob Tomson
--
There are 10 kinds of people. Those who understand binary and those who don't.
|
|
|
|
|
Rob Tomson wrote:
System.IO.FileStream iStream = new System.IO.FileStream(FileName, System.IO.FileMode.Append, System.IO.FileAccess.Write);
Why do you Append? Try Create or Truncate.
<italic>Work hard and a bit of luck is the key to success. You don`t need to be genius, to be rich.
|
|
|
|
|
I was doing Append because the code before this writes my custom information that I want before the actual image. If I just do Create then it would overwrite all the info I just wrote. I've also tried just writing my stuff then writing the image through one FileStream but I get the same effect of not being able to read the file afterwards.
Thanks,
Rob Tomson
--
There are 10 kinds of people. Those who understand binary and those who don't.
|
|
|
|
|
You cant do that, it break the file format. Alternatively, it you wanna encapsulate the image files, you can embed them in the Stream, but you will have to setup (preferably another) Stream to supply only the correct offsets for Image.FromStream() to work.
xacc-ide 0.0.15 now with C#, MSIL, C, XML, ASP.NET, Nemerle, MyXaml and HLSL coloring - Screenshots
|
|
|
|
|
How would I go about doing that?
Thanks,
Rob
--
There are 10 kinds of people. Those who understand binary and those who don't.
|
|
|
|
|
Well, if I wanted to save an Image along with additional info, I would (as I am using NTFS) use alternate data streams to store my info.
This means, any Image-Processor can still load that file (if the image is in a common format) and my program could utilize the additional data streams attached to the image file.
If you really need to save everything into one stream, try writing an offset first.
This means:
Save into the very first bytes of your file (lets say: the first 4 bytes) an integer which contains the exact location at which the image data begins.
So: you format your information (be sure to have some kind of delimiter or such) and store it into a string.
Get the length of that string, add 4 and save that integer into your file (BINARY format, not as a string).
Then, append your info-string and the image-data.
That way you will be able to jump to the image data directly, without having to parse the info first.
Thats all.
Sid
|
|
|
|
|
That sounds very interesting, thank you. What do you mean by 'use alternate data streams'? Does this mean I can embedd info in the file and still have other programs read the file? That would really helpful if I could do that instead. Any suggestions?
Thanks,
Rob Tomson
--
There are 10 kinds of people. Those who understand binary and those who don't.
|
|
|
|
|
Well, try googling for "alternate data stream NTFS" and you should find plenty of information.
Cheers
Sid
|
|
|
|
|
wow, thank you very much. I didn't know something like this existed and it's very interesting. Looks like this is what I'm going to use.
Thanks,
Rob
--
There are 10 kinds of people. Those who understand binary and those who don't.
|
|
|
|
|
Just do not forget that this only works on recent NTFS versions.
And that it is quite easy to break the alternate streams.
I suggest you do some "experiments" by hand first.
Cheers
Sid
|
|
|
|
|
Hai ,
I placed one webcontrol on form(web based application - c#.net).
i placed BUTTON . After execution iam unable to see my button on browser.
i also chked visible property . its set to true.
i am unable to find the prob .not only button any webctrl iam not able to display.
kindly solve my prob
my html code
<%@ Page language="c#" Codebehind="WebForm1.aspx.cs" AutoEventWireup="false" Inherits="sai.WebForm1" %>
<title>WebForm1
<asp:button id="Button1" style="Z-INDEX: 101; LEFT: 198px; POSITION: absolute; TOP: 124px" runat="server" text="Button">
|
|
|
|
|
Where's the button in your HTML code?
<italic>Work hard and a bit of luck is the key to success. You don`t need to be genius, to be rich.
|
|
|
|
|
<%@ Page language="c#" Codebehind="WebForm1.aspx.cs" AutoEventWireup="false" Inherits="prob.WebForm1" %>
<title>WebForm1
<asp:button id="Button1" style="Z-INDEX: 101; LEFT: 170px; POSITION: absolute; TOP: 128px" runat="server" text="Button">
|
|
|
|
|
i pasted codewith asp button but here its not displaying.
<asp:button id="Button1" style="Z-INDEX: 101;LEFT:170px;
POSITION: absolute; TOP:128px" runat="server" text="Button">
|
|
|
|
|
i pasted codewith asp button but here its not displaying.
<asp:button id="Button1" style="Z-INDEX: 101;LEFT:170px;
POSITION: absolute; TOP:128px" runat="server" text="Button">
|
|
|
|
|
Calm down. Some character can not be displayed correctly in HTML. Try eliminate that characters.
<italic>Work hard and a bit of luck is the key to success. You don`t need to be genius, to be rich.
|
|
|
|
|
hi
i write a web application with c#.
it has some pages and thir controls such as:
validators , datagrid , datalist with template column
and they have thir event handler functions.
the application works correctly on local.
{ my system: [windows 2003 server ]}
but when i upload it to the host server , the events dont work correctly.
------------
site address:http://siteavval.com/WebVDir/MainGrps.aspx
error message for:
javascript__doPostBack('MainGrpsList$_ctl0$LBGrpShr','')
|
|
|
|
|
Hi,
Try uploading the aspnet_client folder in your wwwroot to the server. This may work.
|
|
|
|
|
hi
i dont get it
please explane more..
thanks
|
|
|
|
|
I have created a Windows Forms app in which I have a custom numeric edit box that is bound to an item in a DataSet, and a TrackBar control that I want to mirror the value in the edit box (i.e. changes to the number in the edit box effect the TrackBar and changes to the TrackBar are reflected in the edit box). Unfortunately I can not bind the TrackBar to the same value as the edit box because the edit box can contain values between .01 and 1000 (and it is my understanding that the TrackBar can only handle integers). It seems straight forward enough to trap the Validated event of the edit box and update the location of the TrackBar accordingly (after applying scaling factor – i.e. multiplying by 100 so min value is 1 and max value is 100000, and converting to int). The problem that I am having comes from trying to adjust the bound edit box value programmatically in the Scroll event of the TrackBar. In order to get the functionality that I want I had to add the following code to the Scroll event handler:
private void ctrlPowerTrackBar_Scroll(object sender, System.EventArgs e)<br />
{<br />
(this.cmMyCurrencyManager.Current as DataRowView).EndEdit();<br />
<br />
this.dsMyDataSet.tblModelSettings[0].itemPower = this.ctrlMyNumericEdit.Value / 100.0;<br />
}
Could some one explain to me why I must call EndEdit(). If I remove the call to EndEdit(), changes to the TrackBar update the edit box as I would expect – at least until I change a value in any of the edit boxes that are bound to the same DataSet as the edit box that I am trying to update programmatically. It appears that modifying the value of a bound edit box causes BeginEdit() to be called for that row, but I haven’t been able to find any documentation on when EndEdit should be called. I’m not sure that calling EndEdit is the correct thing to do - I just stumbled across it and it seems to work. (If it helps, I should also mention that I am only using the DataSet for the purpose of data binding and as a means of easily storing and recalling control values in presets – i.e. there is no underlying database that will be updated with the data in my DataSet, and there will never be more than one row in this DataSet)
Thanks for your help.
|
|
|
|
|
I have a game that I have written and I have a form timer that tracks the time in the current game. Basically the counter is set to every 1000 miliseconds and counts the time the current game is in progress.
The problem is I am using a system.threading.wait() to pause the display of two cards for 1.5 seconds and it is also pausing the game clock for 1.5 seconds.
Is there a way I can still pause the thread but not pause the game clock, such as putting the timer in a seperate thread?
|
|
|
|
|
|
In Your case Threading.Timer would be th ideal one.
James
|
|
|
|
|
Hi all,
I have a question on how to properly implement network broadcasts.
Our network is divided in subnets and I need help (it is probably more of a networking question than code)
To broadcast I use this code:
IPEndPoint ep = new IPEndPoint(IPAddress.Broadcast, 8300);
UpdClient client = new UdpClient();
client.Send(...,ep);
To receive I use this code:
IPEndPoint ep = new IPEndPoint(IPAddress.Any, 0);
UpdClient client = new UdpClient(8300);
byte [] buffer = client.Receive(ref ep);
My machine is on the 192.168.1.xxx subnet and all machines on the 1.xxx network receive the broadcast, but machines on the 192.168.8.xxx network do not. What IP address should I use in the sending portion to make sure I broadcast to the 8.xxx network?
|
|
|
|