Jump to content
Xtreme .Net Talk

rbulph

Avatar/Signature
  • Posts

    398
  • Joined

  • Last visited

Everything posted by rbulph

  1. In which case I'm baffled as to what you want this for. If you want all functions to be called in sequence, just do this in your plug-in.
  2. Sounds very odd to me. How will your application know what to do with the functions contained in the plug-ins once it knows what they are? If, as you seem to be suggesting in your title, you want to access random functions, can't you incorporate the randomness in your plug-ins rather than the application?
  3. Given a brush, how do you get its colour? And vice versa - given a colour, how can you get a brush with that colour?
  4. Yes is the short answer. I'd rather that it was unreliably positioned above, than accurately positioned below.
  5. Yes, I get the idea. Thing is, the user is more likely to select the combobox by clicking with the mouse than using the Tab key. What he really wants then is for the caret to appear at the point between characters where he clicked. I suppose I could manage that with MeasureString.
  6. Why does the combobox select all text when it gets focus? I don't see any need for this and note that textboxes don't do it. And is there anything better that I can do to fix itthan: Private Sub ComboBox1_GotFocus(ByVal sender As Object, ByVal e As System.EventArgs) Handles ComboBox1.GotFocus Me.ComboBox1.Select(Me.ComboBox1.Text.Length, 0) End Sub?
  7. Not really, since the tooltip doesn't have a font. I suppose I can just create a label and assume it has the same font as a tooltip, but it's a bit of an assumption.
  8. Is there any way to get the drop down shown by a TextBox's AutoComplete facility to be as wide as the widest item in it? Also, can you get a RichTextBox to do AutoComplete?
  9. I'm creating an autotext facility in a richtextbox (like in Word where entries like "Yours faithfully" are suggested with a tooltip). If the user clicks away from the richtextbox then then the autotext suggestion should vanish. But this is easier said than done. The richtextbox's leave and lost focus events don't occur if the user clicks on the parent form for instance. I can approach the problem by capturing the mouse as follows: Private Sub RichTextBox1_KeyUp(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles RichTextBox1.KeyUp Me.RichTextBox1.Capture = True Me.RichTextBox1.Cursor = Cursors.Default 'I'm sure this line shouldn't be necessary, but without it the cursor disappears! End Sub but then initial clicks on buttons etc. are not recognised, which isn't very good. I can't believe that something that should be so simple is so problematic. Any suggestions?
  10. How to get the height of a tooltip control?
  11. OK, looks like I should just put up with it then. I can live with it.
  12. Well, here's the code I have: Protected Sub DrawText(ByVal gpcs As Graphics, ByVal br As Brush, ByVal s As String, ByVal R As RectangleF, ByVal ss As System.Drawing.StringFormat) Dim ff As Font = New System.Drawing.Font("Arial", 10) Dim hj As SizeF = gpcs.MeasureString(s, ff, New SizeF(R.Width, R.Height), ss) gpcs.DrawString(s, ff, br, R, ss) Dim RT As Integer Select Case ss.LineAlignment Case StringAlignment.Near RT = R.Top Case StringAlignment.Center RT = R.Top + R.Height / 2 - hj.Height / 2 Case StringAlignment.Far RT = R.Bottom - hj.Height End Select Dim RL As Integer Select Case ss.Alignment Case StringAlignment.Near RL = R.Left Case StringAlignment.Center RL = R.Left + R.Width / 2 - hj.Width / 2 Case StringAlignment.Far RL = R.Right - hj.Width End Select TextRect = New Rectangle(RL, RT, hj.Width, hj.Height) End Sub When you call this override of DrawString you specify the rectangle that the text is to appear in and how the text is to be formatted within that rectangle, but not the position of the text. I'm just querying whether I need the Select Cases stuff at the end or whether there's a simpler way to calculate TextRect.
  13. Is it my computer or is Visual Studio just a bit slow to respond? When I load it or unload it there is a period of about 30 seconds or so while my computer seems to be accessing the hard drive. It can take a similar length of time to build an application which is only 1MB in size before I can run it. My computer has a 1.8 GHz processor. Is there anything I can do to speed it up?
  14. I'm drawing some text with the Graphics object DrawString function, a Rectangle and a StringFormat object. I'd like to know where the text appears. The MeasureString function will give me the size of the text, but not its location. Do I have to work out its location based on the Rectangle and each possible value of the StringFormat's Alignment and LineAlignment properties, or is there an easier way?
  15. OK, wizzo.
  16. OK, I shall leave it as it is. But it's helpful to have your opinion on this.
  17. I have a simple form with a toolbar and a PrintPreview Control. When I add the PrintPreviewControl at design time and set the Dock to Fill, it fills the space available nicely. But I want to add the control at run time, because that seems to be the only way to refresh the PrintDocument that it contains without reloading the form. However when I do this and set the Dock to Fill, the PrintPreview control extends up underneath the toolbar so is partly obscured. How can I fix this?
  18. Still there in .net 2005. You can set the EnableMetric property of the PageSetUpDialog to True, and that helps. But then you get oversized margins initially, and maybe you then get the opposite problem on a computer which uses imperial measurements.
  19. How can you copy the contents of the PrintDocument which a PrintPreviewDialog contains to the Clipboard?
  20. Fine, thanks
  21. No I didn't know this. Shame you only told me on Friday evening - I would have got you to write code for password protecting files with encryption, had I known! Anyway, thanks for this free code. It's better than my idea since mine was a bit cryptic and there was no way of being certain that the LateHandler would always handle the event last.
  22. If an error occurs in a procedure then the execution of the code looks up the call stack to find the first error handling procedure. That's fine. But when you're debugging, it would be better if execution just stopped at the error, so that you can see what's causing it. If your error is a long way down a chain it could be very hard to track down where exactly it's occurring. If there's no error handling, execution does stop at the error, so it's tempting to do away with error handling in your code. Is there any way to run your application in the debugger so that execution does stop at the error, in spite of their being error handling code applicable?
×
×
  • Create New...