
mooman_fl
Avatar/Signature-
Posts
194 -
Joined
-
Last visited
Content Type
Profiles
Forums
Blogs
Events
Articles
Resources
Downloads
Gallery
Everything posted by mooman_fl
-
I have some code in the Code Library that deals with this exact topic. I made a project based off of divil's tutorial that loads a GUI onto your form from the plugin DLL. All the code to handle the forms events would also be contained in the plugin. Here is the link. http://www.xtremedotnettalk.com/showthread.php?t=70920
-
The proper code is as follows: [b][size=2][color=#0000ff]public [/b][/color][/size][size=2][color=#ff0000]interface [/color][/size][size=2][color=#000000]myPlug[/color] [/size][size=2][color=#006400]{ [/color][/size][size=2][color=#ff0000]void [/color][/size][b][size=2][color=#191970]Initialize[/b][/color][/size][size=2][color=#006400]([/color][/size][size=2][color=#000000]test[/color][/size][size=2][color=#006400].[/color][/size][size=2][color=#000000]IHost host[/color][/size][size=2][color=#006400]); [/color][/size][size=2][color=#ff0000]string [/color][/size][size=2][color=#000000]Name [/color][/size][size=2][color=#006400]{[/color][/size][size=2][color=#8b4513]get[/color][/size][size=2][color=#006400];} [/color][/size][size=2][color=#ff0000]void [/color][/size][b][size=2][color=#191970]Go[/b][/color][/size][size=2][color=#006400]([/color][/size][size=2][color=#ff0000]object[/color][/size][size=2][color=#006400][] [/color][/size][size=2][color=#000000]objs[/color][/size][size=2][color=#006400]); }[/color][/size] This is as reference from the MSDN documentation at http://msdn.microsoft.com/library/default.asp?url=/library/en-us/csref/html/vcrefTheInterfaceType.asp
-
What is to stop you from writing your own? Parsing the lines in your .cfg file should be easy using regex.
-
Ok... didn't make it in time to take the poll. But I started at the age of 12 on a TI-99/4A using basic. I wrote my first game (Nerm's Revenge) which was a sequel to a "Snake" type of game. (Eat the mushrooms and your tail gets longer... avoid running into your tail or the wall). My parents were nice enough to get me a subscription to "Compute!" magazine and I spent hours typing in the programs in them and analyzing them. The next year I took my first computer course in Jr. High using a TRS-80 Model 3 (with 5 1/2 inch floppies). I later in herited 2 of these amazing machines from my church when then upgraded and sequestered myself in my room for days on end teaching myself assembly. I wrote and editor/assembler and a disassembler in BASIC on this machine as well as a drawing program that would save pictures and then compile them to an executable for viewing without a viewing program. Afterwards I got started on an ambitious project to make a Dungeons and Dragons RPG for the City of Greyhawk.... this fell flat since the computers finally bit the dust and I had no money to repair them. (I still have my disks though and have tinkered with them from time to time using emulators) I didn't discover the PC world until about the age of 26. I started working with VB3 and later upgraded to VB5. I finally got a job at a software company as a QA tester when I was 29 where I used VB6 to write some in-house utilities and fooled around in my spare time with DirectX 7. I also tinkered with VC++ but didn't get far with it since most of my programs needed to be developed quickly and only in my spare time. Most of my programming then was simple stuff and I didn't start getting really serious till the past several years. I am 34 now and have been using VB.NET for over a year. I have again tinkered with C# and am toying with the idea of moving to it permanently. I am about to finish a major component that will be available to make creating a plugin enabled application even easier than it already is in .NET.
-
That is correct because it is then assumed to be of the Object type. Not a good idea though and can only be done in VB anyway, that is very sloppy coding. Better to explicitly declare all types.
-
Events from User Control to Parent form ?
mooman_fl replied to Martin Brading's topic in Windows Forms
-
Might help if you post the code for the properties. Are they of a custom type? That could be one explaination. Also make sure you have both a Get and a Set. If you don't have a Set for the property then it will be readonly. Otherwise if you had a simple property of [size=2]Private _MyString as String Public Property MyString() As String Get Return _MyString End Get Set(ByVal Value As String) _MyString = Value End Set End Property[/size] this should show up as an editable property in the designer.
-
Those only work at runtime, and only on the executables compile directory. I want somthing that will be used at designtime in a control dropped on the form before a compile is done on the application. Using either of those suggestions would take you to the directory of the VS.NET executable. (In other words I had already tried that. LOL) I need something that will take me to the top level of the project directory for the project the control has been added to.
-
Getting the visual style with the manifest is fairly simple but there is one step you might be overlooking. Not only do you have to include the manifest in the directory with the executable.... but you have to set the "FlatStyle" property of each control that you want to appear XP style to "System". It is set to "Standard" by default.
-
Ok... here is a tough one. I need my usercontrol to be able to determine the current project directory for the project it is added to. After some searching I have come up with the EnvDTE.... but all attempts to use this in my control have failed. The only real examples I can seem to find are geared towards the Macro Editor. I may be barking up the wrong tree though. I need the project directory, not the application directory.
-
Ok... found the solution for this and so I will post as follows since I didn't see it listed anywhere else on the net. In a separate class... [size=2][color=#0000ff]Public [/color][/size][size=2][color=#0000ff]Class[/color][/size][size=2][color=#000000] ExFileNameEditor[/color] [/size][size=2][color=#0000ff] Inherits[/color][/size][size=2] System.Windows.Forms.Design.FileNameEditor [/size][size=2][color=#0000ff] Protected [/color][/size][size=2][color=#0000ff]Overrides [/color][/size][size=2][color=#0000ff]Sub[/color][/size][size=2] InitializeDialog([/size][size=2][color=#0000ff]ByVal[/color][/size][size=2] _OFD [/size][size=2][color=#0000ff]As[/color][/size][size=2] System.Windows.Forms.OpenFileDialog) _OFD.Title = "My File Dialog" _OFD.Filter = "Text File (*.txt)|*.txt" _OFD.InitialDirectory = System.Environment.CurrentDirectory [/size][size=2][color=#0000ff] End[/color][/size][size=2][color=#0000ff]Sub End[/color][/size][size=2][color=#0000ff]Class[/color][/size] For your property us this instead... [size=2] <Editor([/size][size=2][color=#0000ff]GetType[/color][/size][size=2](ExFileNameEditor), [/size][size=2][color=#0000ff]GetType[/color][/size][size=2](System.Drawing.Design.UITypeEditor))> _[/size] Welcom to your custom FileNameEditor dialog... easy huh?:D
-
Another way that is more involved but easy enough to do.... Open your Character Map application and your Calculator.... change the calculator to Scientific and change the option to Hex.... Pick the character... in the status bar for then "Ð" it says "U+00D0" (00D0 is the hex code for the character.) Just type that into the calculator and then switch the type to Dec.... it will show "208" now. You can also use the hex code in place of the decimal by typing it as such "&H00D0" and let the compiler perform the conversion. Really I would love (and might have to write) a new version of the character map that shows the ASC codes for the characters.
-
Got my collections showing up just fine now as properties... One of the subproperties though will be a file name. I have the following code setting the property to call up an OpenFileDialog... <Editor(GetType(System.Windows.Forms.Design.FileNameEditor), GetType(System.Drawing.Design.UITypeEditor))> _ Public Property FileName() As String Get Return _FileName End Get Set(ByVal Value As String) _FileName = Value End Set End Property So far so good... dialog comes up. The problem is that it is just a default one. I need it to have the following set for it: ....1. Title ....2. DefaultExt ....3. InitialDirectory How would this be done in this case? I haven't been able to find any information on this. Thanks!
-
Indeed that seems to be the problem. Adding the control to another project seems to have worked as intended. Thanks for the info!!
-
Ok... don't feel like going into all the code right now. But I can safely say that you won't be able to do what won't be able to do what you want to with straight HTML. At least not in an amount of code to make it worthwhile. For this you would be better off having a PHP, ASP, or CGI script that you can call on the server that will return a customized page for your game. You would also make a search script for the server. Your game would simply call that script and display the resulting page. There are tutorials out there that can explain how to do these things much better than I could. Hope this gets you started in the right direction.
-
The name says it all... and I am probably doing something wrong again. I am currently making a component. One of its properties should be the name of a container control or form on the app that will hold a configuration control I have made. This configuration control will then be added to the specified container by the component programmatically. This works perfectly. The problem I am having is that this usercontrol in the library shows up in the toolbox and I don't want it to since it should only be added by the main componnent. I have added <ToolboxItem(False)> _ immediately before the usercontrols class declaration but that doesn't seem to work. Any idea how I can get this pesky control to disappear from the toolbox?
-
As long as I can add them through the IDE and access them programmitcally through the collection that is all I want. For the component that I am making it really won't make much sense to do it any other way. As for the names. I have figured that out. Make a Name property as part of the Widget class... that sets the name that gets displayed in the Collection editor automatically it seems. The names will be mainly for keeping things straight for the user at designtime although you could write code that checks the name property of each element at run-time too. This much I have already tested at it works. I just won't be able to reference them DIRECTLY by name which is ok. Thanks for all the help... I am finally able to move forward with my project. This was holding the whole thing up. :-)
-
The reason as far as I understand it is because Media Player (which uses Direct X) and Open GL both write to video memory not the normal pipeline. When you take a screenshot you are take a shot of the normal pipeline (sorry if my technical terms are wrong) with a placeholder that the video card will then insert the extra information to on its way to the monitor.
-
Ok... did some test on what you said. Excellent advice so far. You have my vote next election. ;-) One hitch... I don't want the Widget items selectable as a normal control... I only want the accessable from within the collection. More akin to the way an imagelist works rather than the way a tabpage works. Added widgets as components (visible in the components list or not) the are still visible and selectable through the collection editor and not through the normal property panel. With this method the appear in the drop-down list of controls to choose from. Any idea how I would maintain this functionality while keeping them limited to the collection only?
-
Thanks!!! I am going to go give this a shot... stay tuned. LOL
-
Ok... abandoned my ealier post on collections as properties. I figured out what I needed there and started making a test application to get it all sorted the way I want it. I have a new problem now though... Here is the code for the collection... this goes in a component (not a usercontrol since there is no visible elements): In the declarations section: Private _Widget As WidgetCollection In the code section of the components class: <DesignerSerializationVisibility(DesignerSerializationVisibility.Content)> _ Public Property Widget() As WidgetCollection Get Return _Widget End Get Set(ByVal Value As WidgetCollection) _Widget = Value End Set End Property As a separate set of classes: 'This is the class that will be added to the collection. Public Class Widget Private _Name As String Private _TestNumber As Integer 'puts parentheses around the 'Name' property <ParenthesizePropertyNameAttribute(True)> _ Public Property Name() As String Get Return _Name End Get Set(ByVal Value As String) _Name = Value End Set End Property 'just for a test Public Property TestNumber() As Integer Get Return _TestNumber End Get Set(ByVal Value As Integer) _TestNumber = Value End Set End Property End Class Public Class WidgetCollection Inherits CollectionBase Public Sub Add(ByVal awidget As Widget) ' Invokes Add method of the List object to add a widget. List.Add(awidget) End Sub Public Sub Remove(ByVal index As Integer) ' Check to see if there is a widget at the supplied index. If index > Count - 1 Or index < 0 Then ' If no widget exists, a messagebox is shown and the operation is ' cancelled. System.Windows.Forms.MessageBox.Show("Index not valid!") Else ' Invokes the RemoveAt method of the List object. List.RemoveAt(index) End If End Sub ' This line declares the Item property as ReadOnly, and ' declares that it will return a Widget object. Public ReadOnly Property Item(ByVal index As Integer) As Widget Get ' The appropriate item is retrieved from the List object and ' explicitly cast to the Widget type, then returned to the ' caller. Return CType(List.Item(index), Widget) End Get End Property Build, start a Test application, add to the toolbox, and drop onto the form in the form designer. As you will see it adds the "Widget" property and it calles up the collection editor with the (Name) and TestNumber properties when a Widget is added.... The problems are this: ....1. In the property panel next to the Widget property there is no "(Collection)" listed. I have noticed that all the standard controls and components have this shown for collection properties. How is this done? ....2. When Widget items are added in the collection editor I want them added as "Widget1", "Widget2", etc. If the Widget class inherits from "System.ComponentModel.Components" this is done automatically but that method isn't desirable since it then adds a new component to the tray for each item added. Is there a way to do this automatically or will I have to code it manually? ....3. If Widget items are added in the collection editor then the editor is closed down and reopened the previous items are gone. Is there something in my code that is missing or am I doing something wrong? ....4. This may be tied to #3... but I would like the items accessable programmatically as such: Component1.Widget.Item(0).TestNumber Currently this doesn't seem to be possible with the code I have. I get an error telling me the Widget class is not instanced. Again a pointer as to what I am doing wrong would be appreciated. Any help would be appreciated.
-
I have tried using the STC Generator to generate a strongly typed collection for use as a property in a component. The goal to be a collection property in the properties panel of the form designer. There were a few bugs in the generated code that I managed to get worked out using notes from the comments on the site that I got the add-in from.... but this one has me stumped. the following is the code in question: Imports System Imports System.Collections Namespace PowerPlug '<summary> 'Strongly typed collection of PowerPlug.Employee. '</summary> Public Class EmployeeCollection Inherits System.Collections.CollectionBase '<summary> 'Default constructor. '</summary> Public Sub New() MyBase.New() End Sub '<summary> 'Gets or sets the value of the PowerPlug.Employee at a specific position in the EmployeeCollection. '</summary> Default Public Property Item(ByVal index As Integer) As PowerPlug.Employee Get Return CType(Me.List(index), PowerPlug.Employee) End Get Set(ByVal Value As PowerPlug.Employee) Me.List(index) = Value End Set End Property '<summary> 'Append a PowerPlug.Employee entry to this collection. '</summary> '<param name="value">PowerPlug.Employee instance.</param> '<returns>The position into which the new element was inserted.</returns> Public Function Add(ByVal value As PowerPlug.Employee) As Integer Return Me.List.Add(value) End Function '<summary> 'Determines whether a specified PowerPlug.Employee instance is in this collection. '</summary> '<param name="value">PowerPlug.Employee instance to search for.</param> '<returns>True if the PowerPlug.Employee instance is in the collection; otherwise false.</returns> Public Function Contains(ByVal value As PowerPlug.Employee) As Boolean Return Me.List.Contains(value) End Function '<summary> 'Retrieve the index a specified PowerPlug.Employee instance is in this collection. '</summary> '<param name="value">PowerPlug.Employee instance to find.</param> '<returns>The zero-based index of the specified PowerPlug.Employee instance. If the object is not found, the return value is -1.</returns> Public Function IndexOf(ByVal value As PowerPlug.Employee) As Integer Return Me.List.IndexOf(value) End Function '<summary> 'Removes a specified PowerPlug.Employee instance from this collection. '</summary> '<param name="value">The PowerPlug.Employee instance to remove.</param> Public Sub Remove(ByVal value As PowerPlug.Employee) Me.List.Remove(value) End Sub '<summary> 'Returns an enumerator that can iterate through the PowerPlug.Employee instance. '</summary> '<returns>An PowerPlug.Employee's enumerator.</returns> Public Shadows Function GetEnumerator() As EmployeeCollectionEnumerator Return New EmployeeCollectionEnumerator(Me) End Function '<summary> 'Insert a PowerPlug.Employee instance into this collection at a specified index. '</summary> '<param name="index">Zero-based index.</param> '<param name="value">The PowerPlug.Employee instance to insert.</param> Public Sub Insert(ByVal index As Integer, ByVal value As PowerPlug.Employee) Me.List.Insert(index, value) End Sub '<summary> 'Strongly typed enumerator of PowerPlug.Employee. '</summary> Public Class EmployeeCollectionEnumerator Implements System.Collections.IEnumerator '<summary> 'Current index '</summary> Private _index As Integer '<summary> 'Current element pointed to. '</summary> Private _currentElement As PowerPlug.Employee '<summary> 'Collection to enumerate. '</summary> Private _collection As EmployeeCollection '<summary> 'Default constructor for enumerator. '</summary> '<param name="collection">Instance of the collection to enumerate.</param> Friend Sub New(ByVal collection As EmployeeCollection) MyBase.New() _index = -1 _collection = collection End Sub '<summary> 'Gets the PowerPlug.Employee object in the enumerated EmployeeCollection currently indexed by this instance. '</summary> Public ReadOnly Property Current() As PowerPlug.Employee Get If ((_index = -1) _ OrElse (_index >= _collection.Count)) Then Throw New System.IndexOutOfRangeException("Enumerator not started.") Else Return _currentElement End If End Get End Property '<summary> 'Gets the current element in the collection. '</summary> Private ReadOnly Property Current() As Object Implements IEnumerator.Current Get If ((_index = -1) _ OrElse (_index >= _collection.Count)) Then Throw New System.IndexOutOfRangeException("Enumerator not started.") Else Return _currentElement End If End Get End Property '<summary> 'Reset the cursor, so it points to the beginning of the enumerator. '</summary> Public Sub Reset() Implements IEnumerator.Reset _index = -1 _currentElement = Nothing End Sub '<summary> 'Advances the enumerator to the next queue of the enumeration, if one is currently available. '</summary> '<returns>true, if the enumerator was succesfully advanced to the next queue; false, if the enumerator has reached the end of the enumeration.</returns> Public Function MoveNext() As Boolean Implements IEnumerator.MoveNext If (_index _ < (_collection.Count - 1)) Then _index = (_index + 1) _currentElement = Me._collection(_index) Return True End If _index = _collection.Count Return False End Function End Class The problem occurs in the EmployeeCollectionEnumerator class at the Current() property. As you can see there are two of them. As I understand it (and I may be wrong) they are both necessary since one implemements the IEnumerator.Current interface and the other actually handles the job for your collection. The only error that I am still getting is on the first one. The error says: Again, any help on getting this resolved would be appreciated.
-
Ok... evidently nobody knows that one. LOL That is fine. I found the what looks like the solution to the problem but it has raised another problem it seems. The evident solution is the DesignMode property of UserControls and Components. As a test I made the following code in the Sub New() of an empty component: If Me.DesignMode = False Then Throw New Exception("This should only be seen at runtime.") End If It would seem that if DesignMode = False then that means that it is NOT in design mode. I then built the control, added it to the toolbox, then added it to a test form. As soon as I added it I got the exception thrown. That shouldn't have happened. So I changed the If statement to check for a True value. Sure enough it didn't get thrown this time... but neither did it during runtime. I did some stepping through of code and found out that the DesignMode property doesn't even seem to appear at runtime. What this seems to mean is that: a) The booleans are backwards.... DesignMode = True seems to mean that it is in Runtime not in DesignMode. b) Since the DesignMode property isn't available at all in Runtime mode it is always looked at as being False once you are in a running program. Maybe I am doing this wrong. Any help is appreciated.
-
I am creating a component (Inherited from System.ComponentModel.Component instead of a UserControl). The problem is that I need to put some code in the Sub New() that should only be run at runtime. All well and good I say to myself... good case for a Designer. Only problem is that to make the Designer I need it to derive from UserControl. I don't need or want a visual interface for the control other than setting properties at design time. I want it to appear in the component tray. I have read divils tutorial on Designers and have even implemented them in the past with other controls I have made. I am stumped at the moment though on how to do this with a Component. I would appreciate any help I can get.