Jump to content
Xtreme .Net Talk

a_jam_sandwich

Avatar/Signature
  • Posts

    371
  • Joined

  • Last visited

Everything posted by a_jam_sandwich

  1. Im wondering do i have to create 3 controls i.e 1. New tabpage with my new look 2. The collection class to hold the tabpages class Im creating 3. The Tab control that uses the collection If so how ? Andy
  2. still trying to figure this out would it be better to create a new control based on collection on my Tab pages ? if so how... Please help this is now bugging me Cheers Andy
  3. Does noone have any idea? Could it be somthing to do with the IntPtr's ?
  4. well ive just been having a mess around and ... Protected Overrides Sub onPaint(ByVal pevent As System.Windows.Forms.PaintEventArgs) Dim GradiantBrush As Brush GradiantBrush = New Drawing2D.LinearGradientBrush(New Point(0, 0), New Point(Me.Width, Me.Height), Color.White, Color.LightGray) pevent.Graphics.FillRectangle(GradiantBrush, ClientRectangle) ControlPaint.DrawBorder3D(pevent.Graphics, ClientRectangle, Border3DStyle.Etched) End Sub In the Tabpage class OnPaint and makes a nice gradiant but only on the Tabpage, buttons still exist etc so I have no idea what to add modify etc. Anyone know of a tutorial for creating a custom Tab Control? Andy
  5. Right im trying to create my own control that inherits the Tab Control. Basically I think the one that comes with .NET is naff. I don't want to see the tabs and change the overall style of how it looks. How do I do about this? As from what i can see and im probley wrong overriding the OnPaint doesn't change the look at all, from what I can see the Tab Control is just a container and the pages are the drawn part. I have no idea what I need to change mess or brake to get this working any suggestions would be greatly appreciated Andy
  6. I know very well how to create relational data and it does do that already for the quoting system. This is just a fact file free text relating to the Clients Financial situations hence why it so big. I think i will go the route of having multiple tables all relating to the CLIENT ID test if for speed if it ok all the better Thank you all for your help Andy
  7. Yup it a fact finder for a mortgage company so each row is individual to that Client and 95% is entered text yes Access and single user
  8. Lots and lots of text & memo fields
  9. i tend to agree from a point of view of how many commands but what is the performance hit for such sized tables?
  10. No one row per Client no info is duplicated
  11. Quicky I have a form with nearly 500 fields on it. a (FACT FIND DOC) At the moment i feel I have 2 opions. 1. Save all fields in to one massive table (Sortof Unmanagable) and use one update query 2. Have the fields split into 9 Tables from 9 pages and have 9 update querys Anyone with ideas would be appreciated Andy
  12. too true :) good un
  13. i know what correcting my post LOL :)
  14. write a user control the inherits the Command Button then add the property 'value'. When the click event happens altinate this value between true and false
  15. Any help would be greatly accepted Andy
  16. Help adapted C not working for RTB printing Complies. Put on form & error; the user control could not be loaded. Ensure that the library containing the control has been built ... namespace de.cortex.text.util { using System; using System.Drawing.Printing; using System.Runtime.InteropServices; using System.Windows.Forms; // <doc> // <desc> // RichTextPrintDocument prints the content of a RichTextBox // control as RTF formatted text to a printer. // // Usage: // RichTextBox rtb = new RichTextBox(); // ... define content of rich text box control // RichTextPrintDocument pd = new RichTextPrintDocument(rtb); // ... define default page settings // ... show standard or custom print dialog // if (dlgResult == DialogResult.OK) // pd.Print(); // </desc> // </doc> public class RichTextPrintDocument : PrintDocument { // internal data structures needed for EM_FORMATRANGE message // send to RichTextBox control windows handle via SendMessage() // The windows message handling is based on code posted by // Martin Müller on 08.Feb.2002 in his RichTextBoxEx class. [ StructLayout( LayoutKind.Sequential )] private struct RECT { public int left; public int top; public int right; public int bottom; } [ StructLayout( LayoutKind.Sequential )] private struct CHARRANGE { public int cpMin; public int cpMax; } [ StructLayout( LayoutKind.Sequential )] private struct FORMATRANGE { public IntPtr hdc; public IntPtr hdcTarget; public RECT rc; public RECT rcPage; public CHARRANGE chrg; } [DllImport("user32.dll", CharSet=CharSet.Auto)] private static extern IntPtr SendMessage(IntPtr hWnd, int msg, IntPtr wParam, IntPtr lParam); private const int WM_USER = 0x400; private const int EM_FORMATRANGE = WM_USER+57; private RichTextBox richTextBox = null; private int textLength; private int firstChar; public RichTextPrintDocument(RichTextBox richTextBox) : base () { this.richTextBox = richTextBox; this.textLength = richTextBox.TextLength; this.firstChar = 0; // start at the beginning of text } // Override the OnPrintPage to provide the document printing logic protected override void OnPrintPage(PrintPageEventArgs ev) { base.OnPrintPage(ev); // calculate and render as much text as will fit on the page // and remember the last character printed for the next page firstChar = FormatRange (ev, firstChar, textLength); if (firstChar < textLength) ev.HasMorePages = true; else ev.HasMorePages = false; } // Override OnEndPrint to perform clean up after printing protected override void OnEndPrint(PrintEventArgs ev) { base.OnBeginPrint(ev); FormatRangeDone(); } /// <summary> /// Convert between 1/100 inch (unit used by the .NET framework) and /// twips (1/1440 inch, used by Win32 API calls) /// </summary> /// <param name="n">Value in 1/100 inch</param> /// <returns>Value in twips</returns> private int HundredthInchToTwips(int n) { return (int)(n*14.4); } /// <summary> /// Calculate and render the contents of the RichTextBox for a printing /// page /// </summary> /// <param name="e">The PrintPageEventArgs object from the PrintPage /// event</param> /// <param name="charFrom">Index of first character to be printed</param> /// <param name="charTo">Index of last character to be printed</param> /// <returns>(Index of last character that fitted on the page) + 1</returns> private int FormatRange(PrintPageEventArgs ev, int charFrom, int charTo) { // build content of FORMATRANGE struct CHARRANGE cr; cr.cpMin=charFrom; cr.cpMax=charTo; RECT rc; rc.top = HundredthInchToTwips(ev.MarginBounds.Top); rc.bottom = HundredthInchToTwips(ev.MarginBounds.Bottom); rc.left = HundredthInchToTwips(ev.MarginBounds.Left); rc.right = HundredthInchToTwips(ev.MarginBounds.Right); RECT rcPage; rcPage.top = HundredthInchToTwips(ev.PageBounds.Top); rcPage.bottom = HundredthInchToTwips(ev.PageBounds.Bottom); rcPage.left = HundredthInchToTwips(ev.PageBounds.Left); rcPage.right = HundredthInchToTwips(ev.PageBounds.Right); IntPtr hdc = ev.Graphics.GetHdc(); FORMATRANGE fr; fr.chrg = cr; fr.hdc = hdc; fr.hdcTarget = hdc; fr.rc = rc; fr.rcPage = rcPage; // build SendMessage arguments IntPtr res; IntPtr wpar = new IntPtr(1); IntPtr lpar = Marshal.AllocCoTaskMem( Marshal.SizeOf( fr ) ); Marshal.StructureToPtr(fr, lpar, false); // let richTextBox control format its content for printing device res = SendMessage(richTextBox.Handle, EM_FORMATRANGE, wpar, lpar); // clean-up resources Marshal.FreeCoTaskMem(lpar); ev.Graphics.ReleaseHdc(hdc); return res.ToInt32(); } /// <summary> /// Clean-up method after the print job is finished to release cached /// information /// </summary> private void FormatRangeDone() { IntPtr wpar = new IntPtr(0); IntPtr lpar = new IntPtr(0); SendMessage(richTextBox.Handle, EM_FORMATRANGE, wpar, lpar); } } } Tried to covert to Imports System Imports System.Drawing.Printing Imports System.Runtime.InteropServices Imports System.Windows.Forms Public Class printRTF Inherits PrintDocument Private Structure RECT Public Left As Integer Public Top As Integer Public Right As Integer Public Bottom As Integer End Structure Private Structure CHARRANGE Public cpMin As Integer Public cpMax As Integer End Structure Private Structure sFORMATRANGE Public hdc As IntPtr Public hdcTarget As IntPtr Public rc As RECT Public rcPage As RECT Public chrg As CHARRANGE End Structure Private Declare Function SendMessage Lib "user32.dll" Alias "SendMessage" (ByVal hWnd As IntPtr, ByVal msg As Integer, ByVal wParam As IntPtr, ByVal lParam As IntPtr) As IntPtr Private Const WM_USER As Integer = 1024 Private Const EM_FORMATRANGE As Integer = WM_USER + 57 Private richTextBox As richTextBox Private textLength As Integer Private firstChar As Integer #Region " Windows Form Designer generated code " Public Sub New() MyBase.New() 'This call is required by the Windows Form Designer. InitializeComponent() 'Add any initialization after the InitializeComponent() call End Sub 'UserControl overrides dispose to clean up the component list. Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean) If disposing Then If Not (components Is Nothing) Then components.Dispose() End If End If MyBase.Dispose(disposing) End Sub 'Required by the Windows Form Designer Private components As System.ComponentModel.IContainer 'NOTE: The following procedure is required by the Windows Form Designer 'It can be modified using the Windows Form Designer. 'Do not modify it using the code editor. <System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent() components = New System.ComponentModel.Container() End Sub #End Region Public Function RichTextPrintDocument(ByVal tRichTextbox As richTextBox) richTextBox = tRichTextbox textLength = tRichTextbox.TextLength firstChar = 0 End Function Protected Overrides Sub OnPrintPage(ByVal e As System.Drawing.Printing.PrintPageEventArgs) MyBase.OnPrintPage(e) firstChar = FormatRange(e, firstChar, textLength) If (firstChar < textLength) Then e.HasMorePages = True Else e.HasMorePages = False End If End Sub Protected Overrides Sub OnEndPrint(ByVal e As System.Drawing.Printing.PrintEventArgs) MyBase.OnBeginPrint(e) FormatRangeDone() End Sub Private Function HundredthInchToTwips(ByVal n As Integer) As Integer Return CInt(n * 14.4) End Function Private Function FormatRange(ByVal e As PrintPageEventArgs, ByVal charFrom As Integer, ByVal charTo As Integer) As Integer Dim cr As CHARRANGE cr.cpMin = charFrom cr.cpMax = charTo Dim rc As RECT rc.Top = HundredthInchToTwips(e.MarginBounds.Top) rc.Bottom = HundredthInchToTwips(e.MarginBounds.Bottom) rc.Left = HundredthInchToTwips(e.MarginBounds.Left) rc.Right = HundredthInchToTwips(e.MarginBounds.Right) Dim rcPage As RECT rcPage.Top = HundredthInchToTwips(e.PageBounds.Top) rcPage.Bottom = HundredthInchToTwips(e.PageBounds.Bottom) rcPage.Left = HundredthInchToTwips(e.PageBounds.Left) rcPage.Right = HundredthInchToTwips(e.PageBounds.Right) Dim hdc As IntPtr = e.Graphics.GetHdc() Dim fr As sFORMATRANGE fr.chrg = cr fr.hdc = hdc fr.hdcTarget = hdc fr.rc = rc fr.rcPage = rcPage Dim res As IntPtr Dim wpar As IntPtr = New IntPtr(1) Dim lpar As IntPtr = Marshal.AllocCoTaskMem(Marshal.SizeOf(fr)) Marshal.StructureToPtr(fr, lpar, False) res = SendMessage(richTextBox.Handle, EM_FORMATRANGE, wpar, lpar) Marshal.FreeCoTaskMem(lpar) e.Graphics.ReleaseHdc(hdc) Return res.ToInt32() End Function Private Function FormatRangeDone() Dim wpar As IntPtr = New IntPtr(0) Dim lpar As IntPtr = New IntPtr(0) SendMessage(richTextBox.Handle, EM_FORMATRANGE, wpar, lpar) End Function End Class
  17. Imports System Imports System.Collections Imports System.ComponentModel Imports System.Drawing Imports System.Drawing.Drawing2D Imports System.Data Imports System.Windows.Forms Public Class HoverButton : Inherits System.Windows.Forms.UserControl Private isHover As Boolean = False Private _offImage As Bitmap Private _OnImage As Bitmap Private _DisabledImage As Bitmap ' declare Off screen image and Offscreen graphics Private OffScreenImage As Image Private gOffScreen As Graphics #Region " Windows Form Designer generated code " Public Sub New() MyBase.New() 'This call is required by the Windows Form Designer. InitializeComponent() 'Add any initialization after the InitializeComponent() call End Sub 'UserControl overrides dispose to clean up the component list. Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean) If disposing Then If Not (components Is Nothing) Then components.Dispose() End If End If MyBase.Dispose(disposing) End Sub 'Required by the Windows Form Designer Private components As System.ComponentModel.IContainer 'NOTE: The following procedure is required by the Windows Form Designer 'It can be modified using the Windows Form Designer. 'Do not modify it using the code editor. <System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent() ' 'HoverButton ' Me.Name = "HoverButton" Me.Size = New System.Drawing.Size(64, 64) End Sub #End Region Public Property offImage() As Image Get Return _offImage End Get Set(ByVal Value As Image) _offImage = Value Invalidate() End Set End Property Public Property onImage() As Image Get Return _OnImage End Get Set(ByVal Value As Image) _OnImage = Value Invalidate() End Set End Property Public Property disabledImage() As Image Get Return _DisabledImage End Get Set(ByVal Value As Image) _DisabledImage = Value Invalidate() End Set End Property Protected Overrides Sub OnPaint(ByVal e As PaintEventArgs) If (_offImage Is Nothing) Or (_OnImage Is Nothing) Then Exit Sub Dim g As Graphics = e.Graphics g.Clear(Me.BackColor) If Me.Enabled = True Then If isHover = True Then g.DrawImage(_OnImage, 0, 0, ClientRectangle.Width, ClientRectangle.Height) Else g.DrawImage(_offImage, 0, 0, ClientRectangle.Width, ClientRectangle.Height) End If Else g.DrawImage(_DisabledImage, 0, 0, ClientRectangle.Width, ClientRectangle.Height) End If End Sub Protected Overrides Sub OnMouseLeave(ByVal e As EventArgs) Me.isHover = False Me.Refresh() MyBase.OnMouseLeave(New EventArgs()) End Sub Protected Overrides Sub OnMouseEnter(ByVal e As EventArgs) Me.isHover = True Me.Refresh() MyBase.OnMouseEnter(New EventArgs()) End Sub A hover button control for anyone who wants it 3 states On, Off, Disabled maybe you may want to back buffer if so post and ill add Andy
  18. As you said above i have tried all and none work as soon as i find out ill let you all know Thanks anyway
  19. Live Updater Here the program comments welcome :) Andy updater.net.zip
  20. right ive fixed it by not going though the folder as above instead creating a patch list and then copying and deleting specific files Ill have the update for public realease soon very easy to use and customable Andy
  21. This is rediculus delete the file and copy using above installer appears on next run of program. Do it manually using delete and rename in widows no problem andy ideas this is the last thing in project
  22. right the problem only arises after this code Public Function SearchDirectories(ByVal objDirectoryInfo As System.IO.DirectoryInfo) As Boolean Dim bolReturn As Boolean = False For Each objDirectoryInfo In objDirectoryInfo.GetDirectories bolReturn = True If objDirectoryInfo.Exists = True And objDirectoryInfo.Name <> "System Volume Information" And objDirectoryInfo.Name <> "RECYCLER" Then If SearchDirectories(objDirectoryInfo) = False And SearchFiles(objDirectoryInfo) = False Then End If End If Next Return bolReturn End Function Public Function SearchFiles(ByVal objDirectoryInfo As System.IO.DirectoryInfo) As Boolean Dim objFileInfo As System.IO.FileInfo Dim bolReturn As Boolean = False For Each objFileInfo In objDirectoryInfo.GetFiles 'bolReturn = True 'If InStr(objFileInfo.Name, "_") > 0 Then 'objFileInfo.CopyTo(Replace(objFileInfo.FullName, "_", ""), True) 'objFileInfo.Delete() 'End If Next Return bolReturn End Function Public Sub CheckDirectories() Dim objDirectoryInfo As System.IO.DirectoryInfo objDirectoryInfo = New System.IO.DirectoryInfo(Application.StartupPath) If objDirectoryInfo.Exists = True Then SearchFiles(objDirectoryInfo) SearchDirectories(objDirectoryInfo) Else MessageBox.Show("Your chosen directory is not existing!", Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Error) End If End Sub Notice the copy, delete code used to rename the downloaded files from 'filename.exe_' to 'filename.exe' commented out that was my first thought but now i have no idea Andy This is getting rediculess now it happens at this point Try Application.DoEvents() Dim pUpdaterInfo As New ProcessStartInfo() pUpdaterInfo.FileName = Application.StartupPath & "\" & "downloadProgress.exe" Dim pUpdater As Process = Process.Start(pUpdaterInfo) pUpdater.WaitForInputIdle() pUpdater.WaitForExit() pUpdater.Close() Application.DoEvents() 'CheckDirectories() Application.Exit() Catch MsgBox(Err.Description) Application.Exit() End Try All the above is a stop gap between the Updater and the main program So I can update both the program and the installer
  23. Not what I thought :( HELP
  24. Right looking into it seams to be somthing abount Strong Names in the setup checking the integraty of the files changes give invalid integraty i.e. the setup starts again When found out how to solve will post Andy
×
×
  • Create New...