Jump to content
Xtreme .Net Talk

Volte

*Experts*
  • Posts

    2372
  • Joined

  • Last visited

Everything posted by Volte

  1. Change parent to parent.Controls, which refers to the collection of controls contained within the parent.
  2. Here is an example COM Class I whipped up. Note that it does not generate a true COM DLL. The DLL still uses .NET, but when 'Register for COM Interop' is on, it generates a .tlb (TypeLib) for you to use in VB6. You add it to the project references just as if you were adding a DLL.'To flag a class library as being a COM library, follow these steps: ' 1. Right click on the project in the solution explorer, and click "Properties" ' 2. Click the "Configuration Properties" node in the tree at the side, and under that, ' click the "Build" item. ' 3. Check the "Register for COM Interop" checkbox ' 4. Click OK <ComClass(SimpleMath.classGuid, SimpleMath.interfaceGuid, SimpleMath.eventGuid)> _ Public Class SimpleMath 'These GUIDs were generated using the "guidgen.exe" tool, found at this location: 'C:\Program Files\Microsoft Visual Studio .NET\Common7\Tools\guidgen.exe Public Const classGuid As String = "D0637236-F915-447a-9347-E11770C07466" Public Const eventGuid As String = "09725A16-9195-4d8c-A4B4-D5404A3A4CC7" Public Const interfaceGuid As String = "C1D08CEA-2286-4285-ABF4-3C1E642F7C33" Public Function Add(ByVal num1 As Integer, ByVal num2 As Integer) As Integer Return num1 + num2 End Function Public Function Subtract(ByVal num1 As Integer, ByVal num2 As Integer) As Integer Return num1 - num2 End Function Public Function Multiply(ByVal num1 As Integer, ByVal num2 As Integer) As Integer Return num1 * num2 End Function Public Function Divide(ByVal num1 As Integer, ByVal num2 As Integer) As Integer Return num1 \ num2 End Function 'Every COM class must have a parameterless constructor to register properly Public Sub New() MyBase.New() End Sub End ClassAlso note that you must use VB.NET for this, as C# does not have support for the creation of COM components. Also, you cannot use these COM components from within another .NET application.
  3. So what's the problem with it? What does it do (or not do)?
  4. I suggest you take a look in the MSDN at the ComClassAttribute class and read about that, and check out some of the other related topics off of that. It's not as simple as simply choosing which method you want to use in compiling the DLL; you need to do some of it yourself.
  5. CheckBox1.Text = verb
  6. It looks like the browser bit of Opera (browser itself, and the toolbar at the top of it with the addressbar etc) is all one class called FRAMES2. Even Spy++ couldn't see that it had child windows. You might be able to enumerate the child windows with VB, but if Spy++ couldn't do it, you may be out of luck. Anyway, why do you need to read the addressbar of Opera?
  7. Are you making sure to set the [serializable()] attribute of both the base and the inherited class? i.e. [serializable()] public class Base { // etc } [serializable()] public class Second : Base { // etc }
  8. You could set the background of the form to something you won't use elsewhere on your form (flourescent pink, or something), and then use that same color as the form's TransparencyKey property. That will make all the bits of colors that are pink show through to the back.
  9. You can use the console application for things that you don't wish to load down with a graphical UI. For example, if you are making some sort of server application that doesn't have any sort of user interaction, you may wish to make it a console application so as to enable basic statistical output or errors or whatever. There isn't really any time you need to use a console application, it's just that you can use it if you don't need controls.
  10. It doesn't surprise me that you can't see the line, since the start point and end point are at the same point (10, 10). Try changing the coordinates.
  11. You need to set grph to an instance of a Graphics object. For example;Dim grph As System.Drawing.Graphics = Me.CreateGraphicswould use the graphics object of the form.
  12. No, you are declaring it once, and then setting that variable to a new instance. When you declare a structure or class without setting it to New, you are creating a null reference to a commandStruct, meaning that it points nowhere, and you can't use any non-static class members. Once you use New, it creates a new instance and assigns it to the reference variable, rendering it usable. 'This creates an empty (null) reference to a commandStruct Public resetCommand As commandStruct 'This creates an instance of a commandStruct and makes resetCommand reference it resetCommand = New commandStruct(commandEnum.OtherCommand, "0x01", 0, "Reset MPU")
  13. You can attach the project to posts by using the attachment box on the New Reply screen.
  14. You need to add it to the project references: right click the 'References' item in the solution explorer and find System.Windows.Forms.dll, and add that to your project.
  15. What do you mean by "bind multiple panels to one master panel"?
  16. If you don't need the caption to be visible, you can just substitute it for a panel control. If you do, you can either just do something simple like stick a label control above the panel, or you can manually draw the group box (just put code in the OnPaint event) and use the .DrawString method of the GroupBox's Graphics object (provided in the OnPaint event) to draw it.
  17. Actually, that wouldn't work either. You need to set them to new separately.Dim newline(25) As LineStuff 'don't create instance here Dim i As Integer 'note: For Each..Next will not work here For i = 0 To newline.GetUpperBound(0) newline(i) = New LineStuff() Next
  18. Is there a game loop you are inside? For example: 'declare bContinue form-wide Do Until bContinue 'rendering code and game code here LoopIf you try to close the game without ending the loop, it will still be in run mode. You need to make sure you set bContinue = True to close the program.
  19. On second thought, that DrawString line should be this:g.DrawString(Label1.Text, Label1.Font, _ New Pen(Label1.ForeColor).Brush, New RectangleF(1, 1, Label1.Width, Label1.Height)) otherwise you won't get text wrapping.
  20. You can use your method with SetCursor; just pass myIcon.Handle into the API, rather than just myIcon.
  21. There's no built in way to have the gradient on the back of the label, but you can easily paint the control yourself. Here's an example:Private Sub Label1_Paint(ByVal sender As Object, ByVal e As System.Windows.Forms.PaintEventArgs) Handles Label1.Paint Dim g As Graphics = e.Graphics Dim gradBrush As New Drawing2D.LinearGradientBrush( _ New Point(0, Label1.Height / 2), _ New Point(Label1.Width, Label1.Height / 2), _ Color.PowderBlue, _ Color.Green) g.FillRectangle(gradBrush, Label1.ClientRectangle) g.DrawString(Label1.Text, Label1.Font, _ New Pen(Label1.ForeColor).Brush, 1, 1) gradBrush.Dispose() End SubAs for stretching the font's image, you'll need to do something similar to the label. You just get the Form's paint event and use the DrawImage method of the form's graphics object to draw the image over the entire window (DrawImage will scale it for you).
  22. Well, there is no built in .NET way that I know of to use global hotkeys, so you'll need Windows hooks for that; I not only don't know much about windows hooks, global keyhooks are an easily misused item, and so you probably won't find much help here (forum policy). To make a button "float", you can use the [api]SetParent[/api]() API to set the button's parent window to that of the desktop (you can get this with the [api]GetDesktopWindow[/api]() API).
  23. Could you explain in detail what precisely you mean by "splash buttons onto the screen" an "have hotkey respond"? As for your second question, you will need to use [api]SetForegroundWindow[/api] and possibly [api]SetFocus[/api] APIs to focus the window before SendKeys'ing to it; there's no way to send commands to a program regardless of focus state. SendKeys simply blindly emulates you typing on the keyboard in hopes that the correct window is focused. 800th post! :)
  24. Oops, sorry, I missed the title of this thread. That would have cleared it up for me. :) Glad you got your answer anyway.
  25. What do you mean by "stop"; you can close a form by calling this line from within it: Me.Close()Or, if you have the form instance of the form you wish to close stored in a variable: frm.Close() 'replace frm with the form instance variable Note that you cannot simply say Form2.Close()because Form2 is the form's class, and all forms are instances of that class. You can't call non-static methods on a class (which Close is not) itself, only instances of that class. This is valid: Dim frm As New Form1() 'creates an [i]instance[/i] of the form frm.Close() 'show the instance of the form This is not: Form1.Close() 'attempts to show the actual form class, rather than an instance
×
×
  • Create New...