|
GAC = Global Assembler Cache
And yes, you can create an installer project and deliver him a single MSI that will do all of the work.
|
|
|
|
|
Thanks for your help
will google for more info
|
|
|
|
|
At a minimum, he needs the dll that contains that library, which I am guessing got installed to the GAC, which means that yes, he'll need to install it.
Christian Graus
Driven to the arms of OSX by Vista.
Please read this[ ^] if you don't like the answer I gave to your question.
"! i don't exactly like or do programming and it only gives me a headache." - spotted in VB forums.
|
|
|
|
|
Hey there
I have a richtext editor i've made in C#. It's just about finished. Everything works very well and i love it lol. But there's one thing I don't know how to do yet and that is inside the Program.cs file when I send the file contents of the file that was opened from within a folder in windows explorer to the richtextbox control on Form1 (SPage)... I don't know how to retreive the name of the file using the args... I don't know how to explain it I'm very confused atm... Here's my code, it works beautifully, I just need to be able to grab the filename and pass it to the Tabpage that it creates and set the Text property of the selected tab to the name of the file.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Windows.Forms;
namespace J.T_Notes
{
static class Program
{
[STAThread]
static void Main(string[] args)
{
Application.EnableVisualStyles();
if (args.Length >= 1)
{
SPage frm = new SPage();
System.IO.StreamReader myFile = new System.IO.StreamReader(args[0]);
string line = "";
try
{
line = myFile.ReadToEnd();
if (line.Contains(@"{\rtf1"))
{
frm.Tb.Rtf = line;
myFile.Close();
}
else
{
frm.Tb.Text = line;
myFile.Close();
}
}
catch
{
MessageBox.Show("damn... this ain't workin' so good!",
"J.T Notes 3.1");
Application.Restart();
}
Application.Run(frm);
}
else
Application.Run(new SPage());
}
}
}
Does anybody know how to do this and/or have any suggestions or links to a tutorial/article as I am completely lost. Any help would be greatly appreciated! Thanks
regards,
j.t
|
|
|
|
|
IIRC, args[0] is the name of the application itself. Any filenames will be in args[1] and beyond.
"WPF has many lovers. It's a veritable porn star!" - Josh Smith As Braveheart once said, "You can take our freedom but you'll never take our Hobnobs!" - Martin Hughes.
My blog | My articles | MoXAML PowerToys | Onyx
|
|
|
|
|
Thank you for your reply Peter but I am unsure of how to go about using args[1] to retrieve the filename... Can you please explain in a little more detail?
thanks again
|
|
|
|
|
Sorry Pete but you are wrong. args[0] is indeed the first argument.
Panic, Chaos, Destruction.
My work here is done.
|
|
|
|
|
Thanks for that - I guess I'm getting my C++ and C# mixed up (C/C++ use args[0] for the program name).
"WPF has many lovers. It's a veritable porn star!" - Josh Smith As Braveheart once said, "You can take our freedom but you'll never take our Hobnobs!" - Martin Hughes.
My blog | My articles | MoXAML PowerToys | Onyx
|
|
|
|
|
To be honest, I checked because I couldn't remember. It just meant the Lucky Luc stole the medal!
Panic, Chaos, Destruction.
My work here is done.
|
|
|
|
|
In your defense, MS organized the confusion by defining Environment.GetCommandLineArgs() in the old way: "The first element in the array contains the file name of the executing program. If the file name is not available, the first element is equal to String.Empty. The remaining elements contain any additional tokens entered on the command line."
Luc Pattyn [Forum Guidelines] [My Articles]
The quality and detail of your question reflects on the effectiveness of the help you are likely to get.
Show formatted code inside PRE tags, and give clear symptoms when describing a problem.
|
|
|
|
|
Only in C(++). In any .net application, args[0] is the first argument passed
Between the idea
And the reality
Between the motion
And the act
Falls the Shadow
|
|
|
|
|
Huh?
you managed to get the content of the file you're interested in, but you don't know how to get its name??
args[0] is holding the one or first file of interest if:
- you created a desktop shortcut with target myFantasticExeFile "%1"
- or you told Windows to open a specific file extension with your app
BTW: it is strange to me you have an editor form that you need to feed from the outside; it seems much more logical to me to give it a public void Load(string filename) method so setting the tab's text, and interpreting the file's content (RTF/plain text) is burried inside the editor.
[ADDED] if the problem is extracting the short file name from the entire file path, have a look at the System.IO.Path class
[/ADDED]
Luc Pattyn [Forum Guidelines] [My Articles]
The quality and detail of your question reflects on the effectiveness of the help you are likely to get.
Show formatted code inside PRE tags, and give clear symptoms when describing a problem.
modified on Wednesday, June 3, 2009 10:13 AM
|
|
|
|
|
Damned you Mr P! Too fast for me!
Panic, Chaos, Destruction.
My work here is done.
|
|
|
|
|
I gave you a 15-minute head start. Not enough?
Luc Pattyn [Forum Guidelines] [My Articles]
The quality and detail of your question reflects on the effectiveness of the help you are likely to get.
Show formatted code inside PRE tags, and give clear symptoms when describing a problem.
|
|
|
|
|
Obviously not.
Panic, Chaos, Destruction.
My work here is done.
|
|
|
|
|
Luc, thanks for the tips, I have already used in my other forms in the same program:
RichTextBox Tb = Tc.SelectedTab.Controls[0] as RichTextBox;
Tb.LoadFile(Of.FileName, RichTextBoxStreamType.PlainText);
Tc.SelectedTab.Text = Of.SafeFileName;
.. I honestly have no idea why i didn't do it that way in the program.cs file lol. Ah... To answer your first question, I've read a few articles on args months ago and never really used what I learned up until a few days ago and I've forgotten most of what I learned and now I can't seem to find that article It must be hiding from me...
|
|
|
|
|
Thanks luc I solved my problem... here's what I came up with:
Program.cs File:
frm.Tb.Tag = (args[0]);
Form1 File (SPage):
Tc.SelectedTab.Text = Tb.Tag.ToString();
Thanks pete, luc and nagy for your help!
jase
|
|
|
|
|
I am trying to make a timmer that refreshes the dot on a button at half second intervals.
I added "this.Refresh" to do so however it creates the following error.
Error 1 Only assignment, call, increment, decrement, and new object expressions can be used as a statement
i called this.Refresh inside a method:
void m_mouseTimer_Tick(object sender, EventArgs e)
{
if(m_mouseClicked == true)
{
m_spotLocation = new Point( MousePosition.X, MousePosition.Y);
}
}
Does anyone know what im doing wrong here
|
|
|
|
|
'Refresh' is a method and must be called as one: this.Refresh();
I think you're on the right track.
-NP
Never underestimate the creativity of the end-user.
|
|
|
|
|
Ah yes thank you for the help. It works fine now.
Im unsure about my method of rotating the dot on the button. does anyone have an idea as to how i can make a dot move round the outside of the button depending on where the mouse is (MouseDown Event).
It will be a set distance say 10mm from the edge of the button and will need to stay at that distance while traveling the circumfrence.
Current Process:
DrawButton()Draws button
MouseDown() event true or false
Timmer() ticks every half second and refreshes If mouseDown true re position spot
I have searched the net everywhere but have not found any examples.
|
|
|
|
|
I guess you'll have to use your 10th grade geometry/math skills. You have a circle, a point, say X, in the same plane, and you want to find the point where the line from X to the center of the circle meets the circle.
If you could somehow derive equations for a circle and a line, then solving the equations should give you that point of intersection.
|
|
|
|
|
Sorry for the indescriptive title in advance, I figured that is what suited the problem at hand best.
I'm creating a menu based off a data source and dynamically adding buttons. The width of the menu should be set by the 'longest' string that is to be displayed on any of the buttons, so my question is how do i know what size to set my button to based off of the text to be displayed?
An example of such would be the following string array:
"Help"
"Option 1"
"This is a longer option"
All buttons should be set to have a width wide enough to display "This is a longer option" so that all menu buttons have an equal width. My question, how do I translate that string of text into a width in pixels to resize my button to?
If my problem is not descriptive or clear enough, sorry in advance and I'd be happy to clear anything up. Thanks for the view in advance.
|
|
|
|
|
1) Get a Graphics object from the control that will host the text
Graphics gr = menuButton1.CreateGraphics();
2) Use the MeasureString method of the Graphics object obtained above
SizeF buttonTextSize = gr.MeasureString("yourstring", menuButton1.Font, etc......);
Can't remember all params, look it up.
Add required margin size to buttonTextSize.Width, and Bobs your Aunties' SO.
[Edit]
Don't forget to dispose the Graphics object when done
[/Edit]
Henry Minute
Do not read medical books! You could die of a misprint. - Mark Twain
Girl: (staring) "Why do you need an icy cucumber?"
“I want to report a fraud. The government is lying to us all.”
|
|
|
|
|
Dim g As System.Drawing.Graphics = NewSubItem.ControlTextButton.CreateGraphics
Dim s As System.Drawing.SizeF
s = g.MeasureString(NewSubItem.ControlTextButton.Text, NewSubItem.ControlTextButton.Font)
Got it, thanks.
|
|
|
|
|
If you are using Windows Forms buttons, the easiest way is probably to use the AutoSize property. For example:
Button b = new Button();
b.AutoSize = true;
b.Text = "My longest text";
You can then retrieve the button's size using b.Size.Width and b.Size.Height , record the maximum values, tweak them if necessary, and then apply them to all of your buttons:
foreach (Button myb in MyButtons)
{
myb.Size = new Size(maxwidth, maxheight);
}
Of course you must also change the buttons' positions accordingly (myb.Location = new Point(x, y) ).
If the controls you are using don't have an AutoSize property, then you must get the font and calculate the string's size. You can Google for that.
2+2=5 for very large amounts of 2
(always loved that one hehe!)
|
|
|
|