|
Hi all,
I was wondering if there is some way to implement ownerdraw buttons in C#.
I've searched around but didn't find anithing.
Any idea?
Thanks in advance and Kind Regards
Severino
|
|
|
|
|
This should give you a base to start from.
using System;
using System.Windows.Forms;
namespace Namespace {
public class MyButton : Button {
public MyButton() : base() {
SetStyle( ControlStyles.AllPaintingInWmPaint | ControlStyles.UserPaint, true );
}
protected override void OnPaint(PaintEventArgs e) {
}
}
} HTH,
James
Sonork ID: 100.11138 - Hasaki
"Smile your little smile, take some tea with me awhile.
And every day we'll turn another page.
Behind our glass we'll sit and look at our ever-open book,
One brown mouse sitting in a cage."
"One Brown Mouse" from Heavy Horses, Jethro Tull 1978
|
|
|
|
|
Is there any way to access the shell in C# ?
I want to list the contents of the desktop....
Thanks!
|
|
|
|
|
Well this isn't done via the shell but you can get this list by doing this.
public string [] GetFilesOnDesktop() {
string desktop = System.Environment.GetFolderPath( System.Environment.SpecialFolder.DesktopDirectory );
return System.IO.Directory.GetFiles(desktop);
} I'm not familiar with the Shell API but you should be able to also use PInvoke to call the functions you would normally.
HTH,
James
Sonork ID: 100.11138 - Hasaki
"Smile your little smile, take some tea with me awhile.
And every day we'll turn another page.
Behind our glass we'll sit and look at our ever-open book,
One brown mouse sitting in a cage."
"One Brown Mouse" from Heavy Horses, Jethro Tull 1978
|
|
|
|
|
Thanks for the answer! I did try that, but the idea is to create a little explorer-like application in C#, with a tree listing of all contents of the desktop (the virtual directory, not the physical!).
So the question was in fact: how do I access virtual folders like desktop, my computer, my documents,...
|
|
|
|
|
Anonymous wrote:
So the question was in fact: how do I access virtual folders like desktop, my computer, my documents,...
OK, I believe the shell functions are nothing more than a COM object, so you can use the COM object via PInvoke.
Unfortunately I can't give you any more than that, PInvoke and Shell programming are both something I haven't delved into much (PInvoke) or at all (Shell programming).
I can however point you to a place that might have already answered or question, or if it hasn't been answered you can ask it there. The DOTNET mailing list is probably the best mailing list out there dealing with .NET.
Hope I pointed you in the right direction,
James
Sonork ID: 100.11138 - Hasaki
"Smile your little smile, take some tea with me awhile.
And every day we'll turn another page.
Behind our glass we'll sit and look at our ever-open book,
One brown mouse sitting in a cage."
"One Brown Mouse" from Heavy Horses, Jethro Tull 1978
|
|
|
|
|
Thanks, great link!
However, something else.. using COM-objects, is that good programming practice...? I mean, this way you put some Windows-only code into the application, or am I wrong...?
|
|
|
|
|
Anonymous wrote:
I mean, this way you put some Windows-only code into the application, or am I wrong...?
Correct, but you'll have to use different methods for getting a list of files on the desktop for each operating system anyway. If you place all your OS specific stuff in a separate assembly then you can load the proper assembly at runtime.
FWIW I'm not sure how much of Windows.Forms is going to be ported; it isn't a part of the CLI specs but I believe the Mono project is going to port some of it over anyway.
James
Sonork ID: 100.11138 - Hasaki
"Smile your little smile, take some tea with me awhile.
And every day we'll turn another page.
Behind our glass we'll sit and look at our ever-open book,
One brown mouse sitting in a cage."
"One Brown Mouse" from Heavy Horses, Jethro Tull 1978
|
|
|
|
|
Okay, now I understand. Depending on the operating system, you still have to write different code.
Thank you very much for your remarks!
Kind Regards,
Ludwig
|
|
|
|
|
What new system files are required to use C# apps on Win95 Win98 WinMe etc... or do they run normally using only the ordinary system files.
Basically is it worth using C# if it needs loads of extra libraries that have to be included in the installer
.NET or not .NET? MFC is the question......
|
|
|
|
|
The .NET Framework needs to be installed, about a 19mb download.
I don't think Win95 is supported as a .NET platform.
Michael
|
|
|
|
|
19meg!!! Does XP have this already? Is it in the Service packs for Win2K? Is it really worth moving to C#. Is it free to distribute on CD with a C# app?
.NET or not .NET? MFC is the question......
|
|
|
|
|
XP doesn't have it yet.
The last service pack for Win2k doesn't have it.
I don't know of any Microsoft applications or products that distribute it yet - apart from Visual Studio.
I would expect to see it in a service pack soon and probably in the next version of IE.
Michael
|
|
|
|
|
Hehe lets hope so. It also seems that .NET server has it already and will have it. On my beta it has 'The .NET Framework' however I have not dabbled in that realm as of yet.
.NET or not .NET? MFC is the question......
|
|
|
|
|
The latest version of the user interface library for C# is now available. It includes source code and articles for a TabControl, Docking Windows and hand built menu code. You can achieve the VS.NET IDE look and feel quickly and easily. (And its free!)
www.dotnetmagic.com
Phil Wright
phil.wright@dotnetmagic.com
|
|
|
|
|
How can I write a FTP client program, which can connect to the FTP server for uploading and downloading file? Which class(es) should I be choosen for writing this program?
Best regards,
Frankie Leung.
|
|
|
|
|
Trying to create a custom listbox control, but have run into a roadblock here. The popup list cannot be made to float as the common control's version does. Is there not some style to be applied to a window resulting in not being clipped by its container? The framework is obviously capable, looking at the menu component and the dotnet combobox, but I need to know where to look.
|
|
|
|
|
How to convert "string" to "int"?
Alexandr
|
|
|
|
|
I know several functions:
- atof - converts to double
- atoi - converts to int
- _atoi64 - converts to __int64
- atol - long
or function from Shell API
- StrToInt - you must attach SHLWAPI.LIB library to the project
I don't know if they exist in C#. Try them.
Good luck
|
|
|
|
|
I think that's not possible.
Mazy
"So,so you think you can tell,
Heaven from Hell,
Blue skies from pain,...
How I wish,how I wish you were here." Wish You Were Here-Pink Floyd-1975
|
|
|
|
|
Convert.ToInt32 Method or Convert.ToInt64 Method or Convert.ToInt16
Mazy
"So,so you think you can tell,
Heaven from Hell,
Blue skies from pain,...
How I wish,how I wish you were here." Wish You Were Here-Pink Floyd-1975
|
|
|
|
|
What about Int32.Parse("23");?? exactly the same??
|
|
|
|
|
for any conversation i use System.Convert.
Example:
string str = "555";
int i = System.Convert.ToInt32(str);
(also you can use ToInt16(), ToInt64() ...)
See System.Convert for additional Information.
Rgrds
Martin
|
|
|
|
|
If you left click on a line item in a listbox it selects the item. Clicking the right mouse button is detectable in the listbox but does not select the item. Is there a way to override this listbox behaviour and select an item with the right mouse button?
Kyle
|
|
|
|
|
override the MouseDown Event from the ListBox Control:
private void listBox_MouseDown(object sender, System.Windows.Forms.MouseEventArgs e)
{
if(e.Button != MouseButtons.Right) return;
int nIndex = listBox.IndexFromPoint(new Point(e.X,e.Y));
if(nIndex != -1)
listBox.SetSelected(nIndex,true);
}
Rgrds
Martin
|
|
|
|