Search results

  1. JohnH

    Forms controls sizing issue

    Use this to calculate within client area of form: Form.ClientSize Property (System.Windows.Forms) Why not add Left+Right also, then you need no code to center it on resize.
  2. JohnH

    Appointment Calendar for a month on one form

    Use FillRectangle for background color. Wrap/align is done with StringFormat parameter, note that you need to specify a rectangle and not just a point. https://docs.microsoft.com/en-us/dotnet/api/system.drawing.graphics.drawstring?view=netframework-4.8
  3. JohnH

    Appointment Calendar for a month on one form

    You start out using e.CellBounds and also use this to draw a rectangle in each cell, then you change to some other coordinates for text. What if you continue to use e.CellBounds also when drawing text?
  4. JohnH

    Appointment Calendar for a month on one form

    Ohh, I'm reading too fast again 🤨
  5. JohnH

    Appointment Calendar for a month on one form

    You have comment out e.Handled. https://docs.microsoft.com/en-us/dotnet/api/system.windows.forms.datagridviewcellpaintingeventargs?view=netframework-4.8
  6. JohnH

    How to bind TextBox.Text property to a List (Of Type)?

    I only tested changing the property of each item in the list as OP asked about. Adding/removing items with navigator is not a problem with list/textbox binding, since that changes current item in bindingsource, but you should use BindingList if you change underlying list directly. Yes, it will...
  7. JohnH

    How to bind TextBox.Text property to a List (Of Type)?

    A List works fine with INotifyPropertyChanged for simple textbox binding, but if you bind to a DataGridView you need a BindingList. And where the NameChanged event works for textbox binding, a DataGridView requires INotifyPropertyChanged.
  8. JohnH

    How to bind TextBox.Text property to a List (Of Type)?

    Implement INotifyPropertyChanged Interface (System.ComponentModel) in the type that has the bound property.
  9. JohnH

    Draw lines around a group of cells in column in a datagridivew

    A quick sample that draws two cells as one: Dim c1 = Me.DataGridView1.Item(1, 2) Dim sampletext = "this is a longer sample string spanning cell and then some" Dim style = c1.InheritedStyle Dim r1 = Me.DataGridView1.GetCellDisplayRectangle(1, 2, False) Dim r2 =...
  10. JohnH

    Answered Use my Renderer and select one of the ProfessionalColorTables color sets

    I had a play with this and came up with a perhaps peculiar solution :rolleyes: What I did was to get the source code for ProfessionalColorTable with .Net Reflector (ILSpy could also be used) and use some regex to extract the overridable properties, those that return the color to use, and output...
  11. JohnH

    Answered Use my Renderer and select one of the ProfessionalColorTables color sets

    I don't think so. ProfessionalColorTable uses shared properties of ProfessionalColors class, which depends on system color scheme setting, and since it is shared it is probably used by the "whole framework". Each time a color property is read it goes through its method FromKnownColor, which...
  12. JohnH

    Question mark it answered

    There is likely a postcount limit before new users can edit previous posts.
  13. JohnH

    Question Retrieving Current Windows 10 Power Plan

    As you can see yourself Win32_PowerPlan class has the Activate method. No idea why yours errors out, it works fine here. Yes, you can use powercnf also, here's an example getting the guids automatically: Dim plan = CType(ComboBoxPlans.SelectedItem, ROOT.CIMV2.POWER.Win32.Powerplan) Dim guid =...
  14. JohnH

    What's the equivalent of Web.Services.Discovery for a REST service?

    From what I read around it doesn't exist. Read about rest/wdsl/wadl.
  15. JohnH

    Question Retrieving Current Windows 10 Power Plan

    This is rather complicated to code in VB with Power Management Functions - Win32 apps It can also be done with WMI and Win32_PowerPlan class (Windows) Still lots of management code unless you generate a class with Mgmtclassgen.exe (Management Strongly Typed Class Generator) I've attached a...
  16. JohnH

    Question Date-Time Format

    I can see each ListItem has both a Value and a Text, should be obvious which to put where. DropDownList Class (System.Web.UI.WebControls)
  17. JohnH

    Question Printdocument next page with labels

    You need to use: PrintPageEventArgs.HasMorePages Property (System.Drawing.Printing) Example with calculations for font/line height see: PrintDocument Class (System.Drawing.Printing) Use a variable outside the event handler to keep track of row index to print each page.
  18. JohnH

    Question mark it answered

    You can edit first post and change thread prefix to answered/resolved.
  19. JohnH

    Question How to extract colors from ProfessionalColorTable

    For Each key In dict.Keys Dim name = System.Enum.GetName(key.GetType, key) Dim value = dict(key) Next or Dim names = System.Enum.GetNames(typeArgs(0))
Top Bottom