|
Try imageList1.Images(3)
<italic>Work hard and a bit of luck is the key to success. You don`t need to be genius, to be rich.
|
|
|
|
|
Yulianto AKA goodmast3r wrote:
Try imageList1.Images(3)
That won't do it. That collection contains the source images (in this case, only one, my single .BMP file.)
I was thinking that I will probably have to create an in-memory image, and draw the corresponding image from the imagelist there.
-- LuisR
Luis Alonso Ramos
Intelectix - Chihuahua, Mexico
Not much here: My CP Blog!
|
|
|
|
|
Been reading CP for over a year - great site! first post (be nice )
smidge of history: I've been working with C# for over a year and a half. This includes two applications with over two months of development each written almost completely by myself in use by customers in a commercial enviroment. I've converted a bunch of my friends from MFC evilness to C# Forms.
My problem: I'm creating a UserControl that shows a Direct3D (9.0C) drawing. I've created the panel and had it just clear the background to blue. Built. Dropped the user control (DXPanel - my name) into the form via the Designer. It runs properly. I then added a simple 2D triangle to the DXPanel, and now the Designer hangs whenever I attempt to touch the position or size of the panel or form. It is rendering the Direct3D within the Designer.
three questions (only need answer to one of them):
1. How do I tell the Designer to not show that custom panel while still allowing the built program to show the panel?
2. How do I tell the Designer to not render Direct3D stuff in general?
3. Is there a fix so that the Designer won't hang when rendering Direct3D?
|
|
|
|
|
Use this where it applies:
if (!this.DesignMode)
{
//Direct3D rendering code
}
|
|
|
|
|
I am trying to access some functionality of the underlying RichTextBox
control and am getting all mixed up with conversions of types. I know my
basic issue is not completely understanding types in C#. I would
be much obliged if someone could "educate" me some. I appoligize already for the
amount of text in this message. Italic text is unmanged code and bold text is my
attempt to write the same thing in C#.
Since I need to use the SendMessage of User32.dll I defined the following:
[DLLImport ("user32.dll")]
private static extern IntPtr SendMessage(IntPtr hWnd, int msg, IntPtr
wParam, IntPtr lParam);
Then I'm trying to create the equivalent code in C# for the following
callback function:
DWORD EditStreamCallback(DWORD_PTR dwCookie, LPBYTE pbBuff, LONG cb, LONG
*pcb);
by defining the following delegate:
public delegate UInt32 EditStreamCallback(IntPtr dwCookie, IntPtr pbBuff,
Int32 cb, IntPtr pcb);
That seems to work well (at least for the compiler).
I then "translated" the following typedef:
typedef struct _editstream {
DWORD_PTR dwCookie;
DWORD dwError;
EDITSTREAMCALLBACK pfnCallback;
} EDITSTREAM
into the following structure:
private struct EDITSTREAM {
public IntPtr dwCookie;
public UInt32 dwError;
public EditStreamCallback pfnCallback;
}
So with all the definitions out of the way I thought I could do something
like this:
...
FileStream fs = new FileStream(Filename, FileMode.Open);
int format = SF_RTF;EDITSTREAM es = new EDITSTREAM();
es.dwCookie = (IntPtr)fs;
es.pfnCallback = new EditStreamCallback(StreamIn);
SendMessage(this.Handle, EM_STREAMIN, (IntPtr)format, (IntPtr)es);
...
but now the complier isn't happy and I get "Cannot convert type 'x' to
System.IntPtr" errors where I try to cast to IntPtr. It was my
understanding the "new" creates a reference type (i.e. memory address,
e.g. pointer) So, why can't I cast to IntPtr here? It is interesting to
note that there is no error on the cast of "format". Now on the flip side
I have the following code:
static UInt32 StreamIn(IntPtr dwCookie, IntPtr pbBuff, Int32 cb, IntPtr
pcb)
{
UInt32 result = 0;
FileStream fs = (FileStream)dwCookie;
pcb = cb;
try
{
pcb = fs.Read((byte[])pbBuff, 0, cb);
}
catch (Exception e)
{
pcb = 0;
result = 1;
}
return result;
}
This is the callback function delegate used above. I get compile time
errors at the attempted unboxing of dwCookie and pbBuff.
Also there is an error at pcb = cb ("cannot implictly convert int to IntPtr")
I know I am asking alot here but I am really stuck and since I'm trying to learn C# on
my own I could really use some help. Am I correct in using IntPtr for the changes in types
from the Unmanaged code to C#?
Thank you in advance,
Eric
|
|
|
|
|
if Delphi we can check the windows versions like here:
{$IFDEF WIN32}
...
{$ELSE}
...
{$ENDIF}
In c# have some directives for know the .Net version (1.0, 1.1, 2.0)???
|
|
|
|
|
Enviroment.Version property.
Mazy
"One who dives deep gets the pearls,the burning desire for realization brings the goal nearer." - Babuji
|
|
|
|
|
|
I want to write a program like 007 spyware that monitor for all key press, even when other program has focus.
Can somebody help me?
|
|
|
|
|
|
|
I just search the Platform SDK include dir for the symbol in question. Those are the official definitions, after all. winuser.h has this line:
#define RT_RCDATA MAKEINTRESOURCE(10) so it's 10. I don't know how you'd do this without the C header files though.
--Mike--
LINKS~! Ericahist | 1ClickPicGrabber | CP SearchBar v2.0.2 | C++ Forum FAQ | You Are Dumb
Strange things are afoot at the U+004B U+20DD
|
|
|
|
|
Thanks for that, maybe i'll download the SDK
Regards
Wayne Phipps
____________
Time is the greatest teacher... unfortunately, it kills all of its students
LearnVisualStudio.Net
|
|
|
|
|
Hi...
I want to get a info about the logical drives on the computer...
My code looks like this..
private void logiskdrev()
{
string[] Drives = Directory.GetLogicalDrives();
foreach(string drive in Drives)
{
MessageBox.Show(drive.ToString());
}
}
but that only gives me the name/path (ex. "c:\", "i:\")
Can anyone tell/show me how to get info about the type! (like if it is a hdd, cd-drive or flashdisk)
And...
If you could tell/show me how to get the name too? (I have a drive called windows (c:\)) how can i get the name of the drive??
Thanks
QzRz
|
|
|
|
|
Hi!
You can get more information about your volumes by using WMI.
The class is Win32_LogicalDisk and it holds information on the type of drive, its filesystem or label: Win32_LogicalDisk on MSDN[^].
Regrads,
mav
|
|
|
|
|
it's written thats its only supported in windows 2003..
how do you do this in XP ?
|
|
|
|
|
Ooops, I've used the wrong link for the right class .
The class is, in fact, Win32_LogicalDisk and not Win32_Volume.
Win32_LogicalDisk should work on all systems.
Here's the correct link: Win32_LogicalDisk[^]
mav
|
|
|
|
|
Hi,
Suppose i have a list of all active applications in my system and every
application is a window using GetWindow() from the API. I can get their handles, the tittle af the applications, get the All children of any window of this application.I mean.. if this window is open, I'd get the handel of Address bare(because we can regard it children), and access to the content that is " www.msn.com ".
Now i want to Know how i can to do all this task by classes in C#
your help is greatly appreciated
|
|
|
|
|
So, you want to get the the handle to a window and all it's chrildren?
If so, there is a really good example on www.pinvoke.net, look up FindWindow and then FindWindowEx.
/\ |_ E X E GG
|
|
|
|
|
I'm working on a simple app for sending text messages through SMS.ac, but I need to know how to do a HTTP POST request, or more specifically, how to add the data to the request. It's encoding type is "multipart/form-data" all I need to add (I think) is the phone number and the message. Check it out at http://sms.ac/
So what would I need to do to get the correct data in the request?
|
|
|
|
|
Look into the Method property of the WebRequest class.
Somehting like this WebRequest.Method="POST";
/\ |_ E X E GG
|
|
|
|
|
I've made this code:
HttpWebRequest request = (HttpWebRequest)WebRequest.Create("http://sms.ac/login.asp");<br />
request.Method = "POST";<br />
Stream reqStream = request.GetRequestStream();<br />
<br />
byte[] buffer = Chars2Bytes(("loginuserid=<removed>&loginpassword=<removed>").ToCharArray());<br />
reqStream.Write(buffer, buffer.Length, 0);<br />
<br />
HttpWebResponse response = (HttpWebResponse)request.GetResponse();
But it keeps getting timeout when I get the response...the page exists, and if the data is wrong it sohuld return something since it's running on a .NET server so any errors would still get returned wouldn't they?
Tell me if I'm doing anything stupid
|
|
|
|
|
|
|
Hi there,
I am developing a C# application in which I would like to generate buttons/textboxes or whatever controls dynamically at runtime,The number of the controls to be generated will be determined in runtime..Do anyone have any idea can I do this..How can I generate them and then further access them to manipulate them???
Pleaaaaaaaaaaaaaaaaaaaaaaase HEEEEEEEEEEEEEEEEEEEEEEEEEEELP
Best Regards,
E.A.
|
|
|
|