Jump to content
Xtreme .Net Talk

PlausiblyDamp

Administrators
  • Posts

    7016
  • Joined

  • Last visited

Everything posted by PlausiblyDamp

  1. The problem seems to be down to the pen width, if you reduce the width from 3 down to one then the problem is minimized, you might need to reduce the triangle size slightly based on the pen size and see if that helps.
  2. There are several ways you could do this, XmlWriter is a fairly low level mechanism but might be suitable if you are maintaining a simple structure. An alternative route could be using the DOM via XmlDocument class. Personally I would tend towards using XmlSerialization as it gives a cleaner code model in my opinion.
  3. Could you not just define an enum containing the valid options and use that as the data type for the property?
  4. You don't need to create a variable to use the File object so you could remove a couple of lines Dim fs As System.IO.FileStream 'Reference to Filestream object fs = System.IO.File.Open(Filename.Text, IO.FileMode.Open, IO.FileAccess.Read) ' Allocate a byte array accoording to file length Dim b(fs.Length - 1) As Byte ' Read the entire file fs.Read(b, 0, fs.Length) ' Cleanup file+Stream fs.Close() The code will work fine, howver if the size of the file is very large then allocating the byte array could consume a lot of memory in one go, depending on what you are doing with the file you might be able to read it a chunk at a time to reduce memory overheads. If the file is text based then you might find using a StringReader makes reading from the file a lot easier.
  5. In all honesty it might be easiest to contact Microsoft about this, if you search their site there should be a whole set of contact details regarding licensing queries.
  6. Process.Start only returns a process object if it has to create a new process, there is a good chance that there is already a web browser open and this process will be reused. Depending on what you are trying to do (and if you want to honour the users' browser choice or not) you could always add a reference to IE and use that...
  7. That looks pretty smart actually, glad you got it working in the end.
  8. Re: (C#) Fixed Vertex point, but draggable user control. A bit of a rough example (doesn't invalidate the previous triangle yet for starters) should get you started though. I will try to tidy it up a bit more when I get chance though. PopupDraggable.zip
  9. Re: (C#) Fixed Vertex point, but draggable user control. I think the problem is down to the fact the panel is handling the dragging and as such the event is never getting raised. It might be easier to associate the triangle with the panel directly and manage it's position as part of the panel movement. I might have a bit of free time later and will have a look if it turns out I do.
  10. No idea then, just tried it on my pc and other than changing the path in the line Dim FileContent As String = "[.ShellClassInfo]" + vbNewLine + "IconFile=%ProgramFiles%\Company\Product\Program.exe" + vbNewLine + "IconIndex=0" + vbNewLine + "InfoTip=Information collected using our application" to point to an executable that exists on my hard drive it worked perfectly. I am running windows 7 but that shouldn't make a difference as the API has been in existence since NT 4 with IE 4!
  11. Try removing the line FileDetail.Attributes = IO.FileAttributes.Hidden + IO.FileAttributes.System from the end as it might reseting the attributes set by PathMakeSystemFolder call.
  12. Declare Auto Function PathMakeSystemFolder Lib "shlwapi.dll" Alias "PathMakeSystemFolder" (ByVal pszPath As String) As Integer Call the above function passing the folder path as an argument - that sorts out the attributes correctly.
  13. Try setting the folder to ReadOnly and see if that fixes the problem, I am sure I read something about this once but haven't tried it myself.
  14. Try to get it working in a simplified way first, if you can get it to print the numbers descending correctly, even one on a line, then you have solved part of the problem. If you can then get it to print the correct number of numbers on each line, even without formatting, you have then solved another part. Finally solve the problem of aligining the numbers correctly into the output string. If the problem can be turned into a series of simpler problems then each one you solve puts you nearer to the total solution, or if your approach doesn't work you have identified the failure in isolation from the other problems facing you - this helps you spot mistakes sooner.
  15. Out of interest could you give a bit more detail about the scenario you are aiming for? There might be an alternative solution that offers an eassier path.
  16. There are other encoding classes under System.Text you could use, System.Text.UnicodeEncoding or one of the System.Text.UTFxxEncoding classes instead. Alternatively you might try using a StreamWriter to write the strings directly to the file rather than handling the encoding yourself.
  17. Do you have a method called PreparePrintDocument (or is it PreparedPrintDocument - both are mentioned in your question ) in your code somewhere?
  18. Re: WELL DONE Bit of a grave dig but... You might get that error if you are running a 64bit os and the configuration is set to AnyCpu - you might want to try an x86 build instead. Just make sure you copy the .bmp files to the same folder as the executable and it should work fine.
  19. Using pictureboxes in that way will always be slow unfortunately. Could you not just use a custom cursor instead?
  20. The element names in the actual XML file are not what the serializer is expecting, by default it assumes the element names are the same as the property names. Try adding the relevant attributes to the class i.e. [XmlRoot(ElementName = "TTTTClass")] public class ActionClass { [XmlElement(Form = XmlSchemaForm.Unqualified, ElementName = "TTTTType")] public string ActionType { get; set; } [XmlElement(Form = XmlSchemaForm.Unqualified, ElementName = "TTTTDate")] public DateTime ActionDate { get; set; } } [XmlRoot(ElementName = "TTTTModel")] public class ActionModel : List { public ActionModel() { XmlSerializer xs = new XmlSerializer(typeof(ActionModel), ""); using (Stream ms = new FileStream("Demo.xml", FileMode.Open, FileAccess.Read)) { object inp = xs.Deserialize(ms); this.AddRange((ActionModel)inp); } } }
  21. If you already have the actual event handler code written then you can attach it via the AddHandler keyword. e.g. Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) MessageBox.Show("Clicked", "Clicked", MessageBoxButtons.OK, MessageBoxIcon.Information) End Sub Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load Dim b As New Button b.Text = "click me" b.Location = New Point(10, 10) Me.Controls.Add(b) AddHandler b.Click, AddressOf Button1_Click End Sub
  22. http://www.xtremedotnettalk.com/showthread.php?t=87847 should give you the basic ideas.
  23. If you type the function name though does it still work or is the compiler failing to find them as well? What version of visual studio are you running? Out of interest have you considered just making the functionality part of the structure, that way it behaves more Object Orientated and saves you needing to worry about the functions not appearing in the intellisense.
  24. Any chance you could post the relevant code?
  25. The process object needs it's .EnableRaisingEvents property to be true before events will be raised. The following snippet should get you started. Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Dim ps As New ProcessStartInfo ps.FileName = "cmd.exe" Dim p As New Process() p.EnableRaisingEvents = True 'required if using events p.StartInfo = ps AddHandler p.Exited, AddressOf Process1_Exited p.Start() End Sub Private Sub Process1_Exited(ByVal sender As System.Object, ByVal e As System.EventArgs) MessageBox.Show("CMD has closed") End Sub
×
×
  • Create New...