|
ok , thanks i shall try that
|
|
|
|
|
Hello guys.
How much bytes does Color struct get ?
Thank you
|
|
|
|
|
Mohammad Dayyan wrote: How much bytes does Color struct get ?
what for? static data? instance data? IL code? native code?
each Color instance is a struct which only offers four 8-bit components (A, R, G, B), so 32-bit seems the obvious answer. You can measure that yourself.
ADDED: see correction in another message [/ADDED]
Luc Pattyn [Forum Guidelines] [My Articles]
- before you ask a question here, search CodeProject, then Google
- the quality and detail of your question reflects on the effectiveness of the help you are likely to get
- use the code block button (PRE tags) to preserve formatting when showing multi-line code snippets
modified on Saturday, March 14, 2009 10:42 AM
|
|
|
|
|
I've got it, thanks
|
|
|
|
|
You're welcome.
Luc Pattyn [Forum Guidelines] [My Articles]
- before you ask a question here, search CodeProject, then Google
- the quality and detail of your question reflects on the effectiveness of the help you are likely to get
- use the code block button (PRE tags) to preserve formatting when showing multi-line code snippets
|
|
|
|
|
The important point here is that it would have taken just one line of code to find that out on his own. I have a winform app standing by specifically to test things and discover stuff just like this.
"Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997 ----- "...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001
|
|
|
|
|
I've never needed to do this on Color so I gave it a try.
Console.WriteLine(sizeof(Color)); interestingly produces the following error:
'System.Drawing.Color' does not have a predefined size, therefore sizeof can only be used in an unsafe context.
Console.WriteLine(System.Runtime.InteropServices.Marshal.SizeOf(typeof(Color))); returns 24.
DaveBTW, in software, hope and pray is not a viable strategy. (Luc Pattyn)Visual Basic is not used by normal people so we're not covering it here. (Uncyclopedia)
|
|
|
|
|
Are you running a 64-bit Windows version?
Luc Pattyn [Forum Guidelines] [My Articles]
- before you ask a question here, search CodeProject, then Google
- the quality and detail of your question reflects on the effectiveness of the help you are likely to get
- use the code block button (PRE tags) to preserve formatting when showing multi-line code snippets
|
|
|
|
|
No, that was Vista 32bit.
[Edit] Same results on Weven 32 bit [/Edit]
DaveBTW, in software, hope and pray is not a viable strategy. (Luc Pattyn)Visual Basic is not used by normal people so we're not covering it here. (Uncyclopedia)
modified on Saturday, March 14, 2009 11:50 AM
|
|
|
|
|
Just seen your clarification below - cool and fived
DaveBTW, in software, hope and pray is not a viable strategy. (Luc Pattyn)Visual Basic is not used by normal people so we're not covering it here. (Uncyclopedia)
|
|
|
|
|
So today we learned one drop of color paint is much bigger than one pixel.
Regards,
Luc Pattyn [Forum Guidelines] [My Articles]
- before you ask a question here, search CodeProject, then Google
- the quality and detail of your question reflects on the effectiveness of the help you are likely to get
- use the code block button (PRE tags) to preserve formatting when showing multi-line code snippets
|
|
|
|
|
Hi,
Looking at it with both the Reflector tool and some reglection code, the conclusion seems to be Color struct occupies 24 bytes, holding:
string name;
long value;
short knownColor;
short state;
[CLARIFIED]
on Win64, there are 8+8+2+2 meaningful bytes, struct alignment rounds it up to 24 and all is fine;
on Win32, if they had chosen a different order of the fields, the 4+8+2+2 bytes would have fitted into 16 bytes of memory.
[/CLARIFIED]
Luc Pattyn [Forum Guidelines] [My Articles]
- before you ask a question here, search CodeProject, then Google
- the quality and detail of your question reflects on the effectiveness of the help you are likely to get
- use the code block button (PRE tags) to preserve formatting when showing multi-line code snippets
|
|
|
|
|
Luc Pattyn wrote: string name; // either null or pointer to the name of one of many known colors such as "white"
why string if its pointer. Pointers are suppose to be IntPtr or long.
TVMU^P[[IGIOQHG^JSH`A#@`RFJ\c^JPL>;"[,*/|+&WLEZGc`AFXc!L
%^]*IRXD#@GKCQ`R\^SF_WcHbORY87֦ʻ6ϣN8ȤBcRAV\Z^&SU~%CSWQ@#2
W_AD`EPABIKRDFVS)EVLQK)JKSQXUFYK[M`UKs*$GwU#(QDXBER@CBN%
Rs0~53%eYrd8mt^7Z6]iTF+(EWfJ9zaK-iTV.C\y<pjxsg-b$f4ia>
--------------------------------------------------------
128 bit encrypted signature, crack if you can
|
|
|
|
|
Xmen wrote: why string if its pointer. Pointers are suppose to be IntPtr or long.
On the functional level, it is a string. However strings are reference types, so what is actually sitting inside the struct and taking up some bytes, is just a 32 or 64-bit pointer/reference to the actual string. We ancients, with a pre-.NET background, call that a pointer.
When you need to pass a reference of something to the native world, the correct way is by using an IntPtr; a long would be wrong, and so would be an int. IntPtr adapts itself automatically to the Win32/Win64 situation at hand. Unfortunately the majority of P/Invoke examples on the web are still using int for passing pointers, and so they are plain wrong.
Luc Pattyn [Forum Guidelines] [My Articles]
- before you ask a question here, search CodeProject, then Google
- the quality and detail of your question reflects on the effectiveness of the help you are likely to get
- use the code block button (PRE tags) to preserve formatting when showing multi-line code snippets
|
|
|
|
|
Luc Pattyn wrote: so what is actually sitting inside the struct and taking up some bytes, is just a 32 or 64-bit pointer/reference to the actual string.
but struct is not holding string...its holding pointer numeric value. If I'm not wrong then string size is depend on character length ?
TVMU^P[[IGIOQHG^JSH`A#@`RFJ\c^JPL>;"[,*/|+&WLEZGc`AFXc!L
%^]*IRXD#@GKCQ`R\^SF_WcHbORY87֦ʻ6ϣN8ȤBcRAV\Z^&SU~%CSWQ@#2
W_AD`EPABIKRDFVS)EVLQK)JKSQXUFYK[M`UKs*$GwU#(QDXBER@CBN%
Rs0~53%eYrd8mt^7Z6]iTF+(EWfJ9zaK-iTV.C\y<pjxsg-b$f4ia>
--------------------------------------------------------
128 bit encrypted signature, crack if you can
|
|
|
|
|
The data (characters) of the string are not relevant here, the struct only has something that knows where the data is, call it a reference, a pointer, an indirection, or whatever you like; it needs 4 or 8 bytes to do that depending on the kind of Windows it is built for.
Luc Pattyn [Forum Guidelines] [My Articles]
- before you ask a question here, search CodeProject, then Google
- the quality and detail of your question reflects on the effectiveness of the help you are likely to get
- use the code block button (PRE tags) to preserve formatting when showing multi-line code snippets
|
|
|
|
|
I writing some application that have reference of Microsoft office outlook.
My application can work with office 2007 or office 2003.
When i work with office 2007 all work fine - and i don't have any problem to control the outlook.
But with office 2003 i cant control the outlook even if i install the interop assembly of office 2003.
I think that the problem is in the loading Interop assembly - because i compiled the setup file with office 2007.
Someone can help ?
I don't know how to solve this problem.
|
|
|
|
|
How to retrieve data from sqldatabase to gridview's top row.
now i can display data from databse to gridview,but i need to retreve last updated data from database to gridview's top row.
source code:
<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" Style="z-index: 120;
left: 59px; position: absolute; top: 457px" CellPadding="4" ForeColor="#333333" GridLines="None" Height="170px" Width="890px" AllowSorting="True" BorderWidth="2px" CellSpacing="5">
<Columns>
<asp:BoundField DataField="date" HeaderText="Date" InsertVisible="False" />
<asp:BoundField DataField="description" HeaderText="Description" />
<asp:HyperLinkField DataNavigateUrlFields="url" DataTextField="title" HeaderText="Click here to read more"
NavigateUrl="url" Target="_parent" />
<asp:BoundField DataField="country" HeaderText="Country" />
<asp:BoundField DataField="city" HeaderText="City" />
<asp:BoundField DataField="author" HeaderText="Author" />
</Columns>
<FooterStyle BackColor="#990000" Font-Bold="True" ForeColor="White" />
<RowStyle BackColor="#CCCCFF" ForeColor="#333333" />
<SelectedRowStyle BackColor="#FFCC66" Font-Bold="True" ForeColor="Navy" />
<PagerStyle BackColor="#FFCC66" ForeColor="#333333" HorizontalAlign="Center" />
<HeaderStyle BackColor="#990000" Font-Bold="True" ForeColor="White" />
<AlternatingRowStyle BackColor="White" />
</asp:GridView>
c# code:
protected void Page_Load(object sender, EventArgs e)
{
string m;
m = Request.QueryString["a"].ToString();
TextBox1.Text = m;
if (!IsPostBack)
show();
}
private void show()
{
adp = new SqlDataAdapter("select date ,title ,url ,description, author, city,country from postupdation ", con);
adp .Fill (ds);
GridView1.DataSource = ds;
GridView1.DataBind();
// GridView2.Visible = true;
}
can any one pls help me
|
|
|
|
|
You are not enough clear in your question!What concretely you want to do with your data?
I Love T-SQL
"Don't torture yourself,let the life to do it for you."
If my post helps you kindly save my time by voting my post.
|
|
|
|
|
How to associate event handler with the Idle event in c#?
thanks
|
|
|
|
|
public static event EventHandler Idle
private void Application_Idle(Object sender, EventArgs e)
{
MessageBox.Show("You are in the Application.Idle event.");
}
|
|
|
|
|
I tried this. But with this how will it attach the Application_Idle to Applications Idle processing?
thanks
|
|
|
|
|
saksp wrote: How to associate event handler with the Idle event in c#?
?? why would it be different from any other event? try Application.Idle+=myIdleHandler;
Luc Pattyn [Forum Guidelines] [My Articles]
- before you ask a question here, search CodeProject, then Google
- the quality and detail of your question reflects on the effectiveness of the help you are likely to get
- use the code block button (PRE tags) to preserve formatting when showing multi-line code snippets
|
|
|
|
|
Another example of trying different things in a test app. I swear, some of these guys really should reevaluate their current career path...
"Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997 ----- "...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001
|
|
|
|
|
Yep. Weekend programmers resemble weekend traffic. Quantity down, quality down.
Luc Pattyn [Forum Guidelines] [My Articles]
- before you ask a question here, search CodeProject, then Google
- the quality and detail of your question reflects on the effectiveness of the help you are likely to get
- use the code block button (PRE tags) to preserve formatting when showing multi-line code snippets
|
|
|
|