|
Well, he can code in VS2005 and just compile it with Mono - that's what I do. In many respects, Assemblies produced by MS's compiler are compatible with Mono too (you're asking for trouble if you execute them, missing dependencies, etc, etc, but you can probe them easily).
|
|
|
|
|
Hi.
I don't underestand what is delegate, and where is need !!
I'd read many papers ....
You know any refrence that describes it clearly ?
Best wishes
|
|
|
|
|
A delegate is a function pointer. An example of a delegate is a click event. If you place a button on your form class, that button defines a delegate, that is, a function signature. Your form class can subscribe to the delegate, that is, it can write a function with that signature, and tie it to the event. When your button class registers that it's been clicked, the code in your form class is called. so, delegates are a way for one class to call a method in another class.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
A delegate is a something like int,string etc used for functions.
Basically a delegate declares a type for a specific function signature.
Then using this delegate you can create a function pointer.of coarse target function signature and the delegate's function signature must much.
|
|
|
|
|
So I want to poll for example if program is in "C:\prog1\" I want to put this path in string at program start up, so i can manipulate files accoring to that as root folder?
|
|
|
|
|
It actually happened to me few times some files ended who know where when I only set file names in program and no path... (all work fine with absolute path but I don't want to hard code it) so I want to prevent this behavior?
|
|
|
|
|
string originalPath =System.Reflection.Assembly.GetExecutingAssembly().CodeBase;
will this work for you.
this gives full path of ur exe file u have to parse to get the path only.
|
|
|
|
|
Application.ExecutablePath, I believe. It's something like that.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
Thank you both, I tried
Christian Graus wrote: Application.ExecutablePath,
and it work just fine, I'll try other method too.
Does anyone know maybe why XMLTextWriter write file who know where sometimes if only file name is specified (and it's almost random, sometimes it end up where it need to be)?
This way it work fine
|
|
|
|
|
If you don't specify a path, the working directory will be used. It's usually the same, but not always.
Christian Graus - C++ MVP
'Why don't we jump on a fad that hasn't already been widely discredited ?' - Dilbert
|
|
|
|
|
Yeah for example if array list is same on serialization like one I deserialized in (data didn't change) than it remain same, but if I added something to it... then it isn't go figure...
|
|
|
|
|
I use Application.StartupPath...
|
|
|
|
|
I'll try this also... although other solution work nice... but as they say there is always more than one way to do something in programming
|
|
|
|
|
Try Application.ExecutablePath
There is also and another property which return the applications folder. Sorry currently i don't have access to VS
|
|
|
|
|
kinda' late but maybe it will help ... Application.StartupPath
|
|
|
|
|
Radu Sorin wrote: kinda' late but maybe it will help ... Application.StartupPath
Thanks... it's not late all things I do in C# for now are only my learning so more I know better...
I'll implement all options to see if there is any difference...
|
|
|
|
|
I have a bitmap (300x471) which I added as a resource.
I wanted to modify the bitmap and display it.
My picture box control has also same dimensions. (300x471)
void Smile_Load(object sender, System.EventArgs e)
{
_Background = Book.CSharp.Properties.Resources.Monaliza;
_Final = new Bitmap(_Background.Width, _Background.Height);
Graphics fg = Graphics.FromImage(_Final);
fg.DrawImage(_Background, 0.0F, 0.0F);
fg.Dispose();
pictureBox1.Image = _Final;
}
problem: If I give picture box actual bitmap (pictureBox1.Image = Background) it fits inside the control.
But if just copy to new bitmap, then it does not fit and control scales to bigger bitmap and only show partially which is very annoying.
I looked different articles and it looks perhaps this is done by AutoScaleDimensions
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
I played and also even removed, but no effect.
Any idea?
A prompt answer will be very appreciated.
agha.khan@hotmail.com
Agha Khan
|
|
|
|
|
Yep, I would suspect the automatic scaling.
Maybe you can replace
fg.DrawImage(_Background, 0.0F, 0.0F);
by
fg.DrawImageUnscaled(_Background, 0.0F, 0.0F);
FYI both also accept int coordinates, no need for floats here.
Luc Pattyn
|
|
|
|
|
Thank you for prompt reply.
But it did not work.
Agha Khan
|
|
|
|
|
Some ideas:
I do not know what is happening, you could check if the result has anything to do
with your scaling, just try to see what percentage of width and height is drawn...
You should try to figure out which part fails: the copying of the bitmap, or the
picturebox showing the image.
You dont need the Graphics to copy the bitmap, you could simply do
_Final=new Bitmap(_Background);
check if this works OK, if so you can still create a Graphics for it and modify it at will.
Luc Pattyn
|
|
|
|
|
Thank you.
I did not have much control on Picture box, so I changed control to
partial class Display : System.Windows.Forms.Panel
And override the paint function.
As for as display is concern, it worked fine, but scaling problem still persist.
As you suggested I used
_Final=new Bitmap(_Background);
And I looked the dimensions of bitmap and they are correct.
Only when I look at it is wrong.
When I increase the size of display I can see the whole, but bigger bitmap.
Best regards
Agha Khan
Agha Khan
|
|
|
|
|
The bitmap is drawn with the same physical size. That size is expressed in inches and not pixels. As the new bitmap that you have created does not have the same resolution (pixels per inch) as the bitmap that you are drawing, it will be drawn at a different pixel size.
You can either set the resolution of the new bitmap to the same as the bitmap that you are drawing (or the other way around if you like):
_Final.HorizontalResolution = _Background.HorizontalResolution;<br />
_Final.VerticalResolution = _Background.VerticalResolution;
or you can draw the bitmap specifying the pixel size:
fg.DrawImage(_Background, 0, 0, _Background.Width, _Background.Height);
---
Year happy = new Year(2007);
|
|
|
|
|
Perhaps I need more experiments, but it looks it works.
Thank you everyone.
Best regards,
Agha Khan
|
|
|
|
|
I'm currently trying to create an OpenDialog that is similar to the Windows Explorer in appearance.
(TreeView on the left, ListView on the right)
To get the logical drives is pretty simple. I just use the Directory.GetLogicalDrives() method.
However, I didn't find anything similar to access network drives, like in the Network-node
in the Windows Explorer TreeView.
I found a few solutions, that take hundreds of lines of code to get the result, that this one method
achieves for the logical drives.
Is there no shorter way? If there is one, what is it?
|
|
|
|
|
Is there a reason why you're not using the common OpenFileDialog? Unless there is some technical reason or compelling user scenario for not doing so, I'd suggest using the common Windows dialogs because they help to keep a consistent user interface across applications and therefore breeds familiarity for the user. In addition, if Microsoft decides to revamp the dialogs, your application will automatically inherit the improvements. Plus, it's a lot less work.
Anyway, just my humble opinion. I realize that the common dialogs won't work well in every possible situation.
-Phil
|
|
|
|