|
hi.
I need to concut a string in C# so that it will be aligned to the left.
for example:
dd/mm/yyy message1 line
dd/mm/yyy message222 line
dd/mm/yyy message566455 line
etc...
note: it's not possible here but the intention was for all the "line"s to be one on top of the other....
Thanks....
|
|
|
|
|
strings are aligned to the left (at least if you write from left to right).
if you are painting to the screen, it may help to choose a "non-proportional" font,
such as "Courier New" so all characters have the same width;
maybe you want a DateTime format that applies leading zeroes,
and you might show your message number using a fixed number of digits:
num.ToString("000000") will generate at least 6 characters, using leading zeroes.
If you are painting on a Graphics, you can use MeasureString() to get the string
width in pixels, and adjust coordinates accordingly (but that would be useful only
if you do NOT want to align to the left).
Hope this helps.
|
|
|
|
|
A newbie question:
protected
Access is limited to the containing class or types derived from the containing class
protected internal
Access is limited to the current assembly or types derived from the containing class.
(MSDN)
What does 'assembly' refer to? Is it the same application or the same class?
protected internal combines protected and internal, but in an OR sense, not an AND sense (pro c#).
What does this mean?
Jon
|
|
|
|
|
jon_80 wrote: What does 'assembly' refer to? Is it the same application or the same class?
This is the same unit of code that is place on disk. In normal language: This is the .exe or .dll file in which the class sits.
jon_80 wrote: protected internal combines protected and internal, but in an OR sense, not an AND sense (pro c#).
You can only access a protected internal member, if you inherit from that class and you are in the same assembly. I think the book is wrong here, as you can't access protected members even if they are also internal. Might want to reread that part, because I'm pretty sure they didn't mean it that way.
WM.
What about weapons of mass-construction?
"What? Its an Apple MacBook Pro. They are sexy!" - Paul Watson
|
|
|
|
|
The book is right - protected internal means "protected OR internal" - the member can be accessed within the same assembly OR in any derived type, even if that derived type is outside of the assembly.
David Anton
www.tangiblesoftwaresolutions.com
Instant C#: VB to C# converter
Instant VB: C# to VB converter
C++ to C# Converter: converts C++ to C#
Instant C++: converts C# to C++/CLI and VB to C++/CLI
Instant Python: converts C# to IronPython and VB to IronPython
|
|
|
|
|
An assembly in .NET is one of two things, the .EXE file you make when you compile, or the .DLL file. So an assembly is the whole application, not just a class.
To answer your other question I'll have to define internal as well.
protected is an access modifier that limits access to the current class or classes derived from the current class.
internal is an access modifier that limits access only to the currect assembly.
protected internal is an access modifier that limits access to only derived classes in the current assembly.
The best way to accelerate a Macintosh is at 9.8m/sec² - Marcus Dolengo
|
|
|
|
|
Nope, as David said in a comment above 'proteced internal' means protected OR internal.
|
|
|
|
|
I have a single bitmap image that is comprised of 16 images (like a toolbar bitmap). I use the following to load the image into my imagelist.
Image img = Image.FromFile("jsiml.bmp");
treeViewImageList.Images.AddStrip(img); The problem is that the bitmap file must always be in the application folder. How can I add the bitmap as a resource and load the resource?
TIA,
Mark
|
|
|
|
|
Hi,
Visual can show you how to do this.
Example: add an icon to your app, look at what code gets generated.
|
|
|
|
|
I see what you mean. Anyway I used the following which works.
Image img = (Bitmap)JsLib.Properties.Resources.jsiml;
treeViewImageList.Images.AddStrip(img);
I also had to change the "Build action" property for the bitmap to "Embedded resource".
Mark
|
|
|
|
|
|
To add an image as an embedded resource:
1)RightClick the project or folder in project in the Solution Explorer
2)Select Add an Existing Item
3)Locate the bitmap (I prefer clicking the arrow on the open button to choose the add as link. By doing this the latest bitmap will always be added in the build)
4)RightClick the bitmap in the project
5)In the properties window change the build action or where it says content and in the combo box make the value Embedded Resource
To use the bitmap in your code:
Bitmap b=new Bitmap(/*stream object*/this.GetType().Assembly.GetManifestResourceStream("{projectname}{.foldername if bitmap is in a folder}.{filename});
or something along those lines.
Regards,
Thomas Stockwell
Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning.
Visit my homepage Oracle Studios[ ^]
|
|
|
|
|
I'm developing a user control which is build with a datagridview, and others controls.
When I use this control in my application at desing time, I'd like to access de properties of the datagridview embebed in my control to add columns. I've created a public property to expose de grid, something like this:
<br />
private System.Windows.Forms.DataGridView _grid;<br />
<br />
[Description("Description"), Category("mycategory"), EditorBrowsable]<br />
public System.Windows.Forms.DataGridView Grid<br />
{<br />
get { return _grid; }<br />
set { _grid = value; }<br />
}<br />
My problem is that I can't access the Columns property at desing time (In the property editor. I get this error:
Object reference not set to an instance of an object.
Then I decide to expose a property for the datagrid columns:
<br />
[Description("My Description"), Category("MyCategory"), EditorBrowsable]<br />
public DataGridViewColumnCollection MyColumns<br />
{<br />
get { return this.grid1.Columns; }<br />
}<br /> Now I've binded the grid to a TableDataAdapter returned by a Web Sevice. My problen now is when I add a new column, the column is not show at execution time. (At desing time I can see the column added). I think that in execution time the grid executes the databinding and rewrites my added column. The same happens if I want to hide one of the columns returned by my Web Service, in execution time the column is visible.
Perhaps doing it programatically I could add and hide columns , but I want to do it the easiest possible for de developers who are going to use this control.
Thanks.
|
|
|
|
|
Just change "private System.Windows.Forms.DataGridView _grid;" to
private System.Windows.Forms.DataGridView _grid=new DataGridView();
|
|
|
|
|
I forgot to post that I've an instance of the grid (In the code behind):
this.grid1 = new Mycontrols.Controles.Grid(this.components);
So that is not the problem.
Thank you.
-- modified at 10:52 Sunday 3rd June, 2007
|
|
|
|
|
I want to make a service which continuously listen the key board and make a entry in log file that have the actions that have been performed through keyboard????????
|
|
|
|
|
Hmm, sounds like a keylogger...
WM.
What about weapons of mass-construction?
"What? Its an Apple MacBook Pro. They are sexy!" - Paul Watson
|
|
|
|
|
Yeah, you're not going to get any help with something that, 99% of the time, is only used illegally.
|
|
|
|
|
Dave Kreskowiak wrote: you're not going to get any help with something that, 99% of the time, is only used illegally
Probably why he isn't getting any helpful replies
"The clue train passed his station without stopping." - John Simmons / outlaw programmer
|
|
|
|
|
Yeah! But, this particular app is how I taught myself Remoting, about 6 years ago. When the client started, a window popped up on my machine and I cold see every character the target typed, real-time. Oh, a window for every machine that started up and launched the service. Of course, I made everyone aware of what I was doing!
|
|
|
|
|
Dave Kreskowiak wrote: When the client started, a window popped up on my machine and I cold see every character the target typed, real-time.
I could see it as a possible troubleshooter tool, but I think most people will quickly think of some kind of bad hacker prog
"The clue train passed his station without stopping." - John Simmons / outlaw programmer
|
|
|
|
|
That's the first thought I had when I wrote the thing. "Oh how this could be perverted into something bad." I uninstalled the clients and server, zipped up the source and packed it away so noone could grab it.
|
|
|
|
|
Hi every one,
I need to record the phone calls made by the PC into files or a db, i used AT commands, and i'm working on c#.
is it only solved by TAPI??
if so i need a good tutorial in this concern..
Help is highly appreciated and Thanks in advance,
|
|
|
|
|
do you have any code so far?
|
|
|
|
|