
Humble Seeker
Members-
Posts
10 -
Joined
-
Last visited
Content Type
Profiles
Forums
Blogs
Events
Articles
Resources
Downloads
Gallery
Everything posted by Humble Seeker
-
I'm using SourceSafe 2005 and VS.net 2005. When ever I commit a file to SourceSafe and try and do a compare in vs.net or view in SourceSafe I'm told that the file is a binary. But if I open the file it's normal text. Does anyone know whats going on? and one step better know a solution so when I commit it as text it stays as text. Any help is greatly appreciated.
-
I'm currently building a small little toy, it logs which files have been updated in a directory and copies them to an archiving directory. The code is simple and works, I now want to take it to the next level of automatically zipping up the archive files and sub-directories. Does anyone know of code in Visual Basic .Net that will perform the zip, or a free simple DLL I can include into the project. So far all I've found is DLL for $300, which as this is a play thing of mine I don't want to spend yet. Any suggestions?
-
Row Selection in InDesign done with VB
Humble Seeker replied to Humble Seeker's topic in Interoperation / Office Integration
I figured it out. I got it to work using the following code. Private Sub bulletChange(ByVal tableObject) Dim firstInstance As Integer = 0 Dim mySelection = mInDesign.Selection Dim mTableCell For Each Row In tableObject.Rows If Row.Cells.Item(1).Texts.item(1).pointsize = 8 Then For Each Cell In Row.Cells ' a = l, b = m, c = l+ If Cell.Texts.item(1).TextContents.length < 3 And Cell.Texts.item(1).TextContents.length > 0 Then Select Case Cell.Texts.item(1).TextContents Case "l+" Cell.Texts.item(1).TextContents = "c" If firstInstance = 0 Then firstInstance = Cell.index End If Case "l" Cell.Texts.item(1).TextContents = "a" If firstInstance = 0 Then firstInstance = Cell.index End If Case "m" Cell.Texts.item(1).TextContents = "b" If firstInstance = 0 Then firstInstance = Cell.index End If End Select End If Next If firstInstance > 0 Then mTableCell = tableObject.Cells.ItemByRange(tableObject.cells.item(firstInstance), tableObject.cells.item(Cell.index)) mInDesign.Selection = mTableCell mySelection = mInDesign.Selection mySelection.Item(1).VerticalJustification = InDesign.idVerticalJustification.idTop mySelection.Item(1).texts.item(1).AppliedFont = mFont firstInstance = 0 End If End If statusOfFormat.CurrentProgressBar.PerformStep() Next End Sub Probably of no use to anyone else, but.... -
I'm using Visual Basic .Net to create an automated function for Adobe InDesign 2.0.2 The problem I'm having is that I wish to select every cell in a row, except the first one, and then apply a specific font to it. Source Code below: Private Sub bulletChange(ByVal tableObject) For Each Row In tableObject.Rows If Row.Cells.Item(1).Texts.item(1).pointsize = 8 Then For Each Cell In Row.Cells ' a = l, b = m, c = l+ If Cell.Texts.item(1).TextContents.length < 3 And Cell.Texts.item(1).TextContents.length > 0 Then Select Case Cell.Texts.item(1).TextContents Case "l+" Cell.Texts.item(1).TextContents = "c" Case "l" Cell.Texts.item(1).TextContents = "a" Case "m" Cell.Texts.item(1).TextContents = "b" End Select Cell.Texts.item(1).AppliedFont = mFont End If Next End If statusOfFormat.CurrentProgressBar.PerformStep() Next End Sub I've got this far. I can select the cells individually and apply the font, but it's too slow for the purpose I need of it. Anyone got any ideas how I can do this? Thanks for taking the time to look.
-
Does anyone know how to print from an Embedded IE in an application with background colour on, even though in IE it is off. Any solution work arounds are greatly appreciated.
-
Have a play round with this code Option Explicit On Option Strict On '********************************************************************************** ' PrintForm Class ' ' Purpose: Print active window ' ' Dependencies: ' ' Author: Øyvind Rustan - Compositae, 27.05.2002 ' http://www.compositae.no ' Revision: ' '********************************************************************************** Imports System.Windows Imports System.Drawing Public Class PrintForm '------------------------------------------------------------------------------ ' New ' Constructor '------------------------------------------------------------------------------ Public Sub New() End Sub '------------------------------------------------------------------------------ ' Print ' Print active window (form) '------------------------------------------------------------------------------ Public Sub Print() Try '-- Keys Alt+PrintScreen copies active window to clipboard Forms.SendKeys.SendWait("%{PRTSC}") '-- Create print document and printing handler Dim pd As New Printing.PrintDocument() AddHandler pd.PrintPage, AddressOf pd_PrintPage '-- Setup document pd.DocumentName = "PrintScreen" With pd.DefaultPageSettings .Landscape = False '-- Reduce margins to accomodate larger pictures .Margins.Left -= .Margins.Left \ 3 .Margins.Top -= .Margins.Top \ 3 .Margins.Right -= .Margins.Right \ 3 .Margins.Bottom -= .Margins.Bottom \ 3 End With '-- Print document pd.Print() Catch ex As Exception Throw ex End Try End Sub '------------------------------------------------------------------------------ ' pd_PrintPage ' PrintPage handler '------------------------------------------------------------------------------ Private Sub pd_PrintPage(ByVal sender As Object, ByVal ev As Printing.PrintPageEventArgs) Try '-- Get PrintScreen bitmap from clipboard Dim iData As IDataObject = Clipboard.GetDataObject() If iData.GetDataPresent(DataFormats.Bitmap) Then Dim bm As Bitmap = CType(iData.GetData(DataFormats.Bitmap), Bitmap) '-- Set size of destination rectangle (printer) Dim rDest As New RectangleF(ev.MarginBounds.Left, ev.MarginBounds.Top, 0, 0) If bm.Width < ev.MarginBounds.Width Then '-- Set to bitmap size if bitmap is smaller than paper rDest.Width = bm.Width rDest.Height = bm.Height Else '-- Set to paper size if bitmap is larger than paper '-- Scale height to retain proportions rDest.Width = ev.MarginBounds.Width rDest.Height = CType(rDest.Width * (bm.Height / bm.Width), Single) End If '-- Draw bitmap ev.Graphics.DrawImage(bm, rDest, bm.GetBounds(GraphicsUnit.Pixel), GraphicsUnit.Pixel) '-- Draw timestamp Dim printFont As Font = New Font("Arial", 10, FontStyle.Regular) ev.Graphics.DrawString(Now.ToString, printFont, Brushes.Black, rDest.Left, rDest.Top + rDest.Height + printFont.GetHeight(ev.Graphics)) Else '-- No bitmap, cancel printing ev.Cancel = True End If Catch ex As Exception '-- Cancel printing ev.Cancel = True Throw ex Finally '-- Print only on page ev.HasMorePages = False End Try End Sub End Class
-
Have a try playing around with this code, I got it off the net for a project I was working on Option Explicit On Option Strict On '********************************************************************************** ' PrintForm Class ' ' Purpose: Print active window ' ' Dependencies: ' ' Author: Øyvind Rustan - Compositae, 27.05.2002 ' http://www.compositae.no ' Revision: ' '********************************************************************************** Imports System.Windows Imports System.Drawing Public Class PrintForm '------------------------------------------------------------------------------ ' New ' Constructor '------------------------------------------------------------------------------ Public Sub New() End Sub '------------------------------------------------------------------------------ ' Print ' Print active window (form) '------------------------------------------------------------------------------ Public Sub Print() Try '-- Keys Alt+PrintScreen copies active window to clipboard Forms.SendKeys.SendWait("%{PRTSC}") '-- Create print document and printing handler Dim pd As New Printing.PrintDocument() AddHandler pd.PrintPage, AddressOf pd_PrintPage '-- Setup document pd.DocumentName = "PrintScreen" With pd.DefaultPageSettings .Landscape = False '-- Reduce margins to accomodate larger pictures .Margins.Left -= .Margins.Left \ 3 .Margins.Top -= .Margins.Top \ 3 .Margins.Right -= .Margins.Right \ 3 .Margins.Bottom -= .Margins.Bottom \ 3 End With '-- Print document pd.Print() Catch ex As Exception Throw ex End Try End Sub '------------------------------------------------------------------------------ ' pd_PrintPage ' PrintPage handler '------------------------------------------------------------------------------ Private Sub pd_PrintPage(ByVal sender As Object, ByVal ev As Printing.PrintPageEventArgs) Try '-- Get PrintScreen bitmap from clipboard Dim iData As IDataObject = Clipboard.GetDataObject() If iData.GetDataPresent(DataFormats.Bitmap) Then Dim bm As Bitmap = CType(iData.GetData(DataFormats.Bitmap), Bitmap) '-- Set size of destination rectangle (printer) Dim rDest As New RectangleF(ev.MarginBounds.Left, ev.MarginBounds.Top, 0, 0) If bm.Width < ev.MarginBounds.Width Then '-- Set to bitmap size if bitmap is smaller than paper rDest.Width = bm.Width rDest.Height = bm.Height Else '-- Set to paper size if bitmap is larger than paper '-- Scale height to retain proportions rDest.Width = ev.MarginBounds.Width rDest.Height = CType(rDest.Width * (bm.Height / bm.Width), Single) End If '-- Draw bitmap ev.Graphics.DrawImage(bm, rDest, bm.GetBounds(GraphicsUnit.Pixel), GraphicsUnit.Pixel) '-- Draw timestamp Dim printFont As Font = New Font("Arial", 10, FontStyle.Regular) ev.Graphics.DrawString(Now.ToString, printFont, Brushes.Black, rDest.Left, rDest.Top + rDest.Height + printFont.GetHeight(ev.Graphics)) Else '-- No bitmap, cancel printing ev.Cancel = True End If Catch ex As Exception '-- Cancel printing ev.Cancel = True Throw ex Finally '-- Print only on page ev.HasMorePages = False End Try End Sub End Class
-
Printing Entire Contents of a Form
Humble Seeker replied to liquidspaces's topic in Graphics and Multimedia
This code isn't mine, I found it on the web. It seems to do what you want. I've been tinkering with it for a project. Option Explicit On Option Strict On '********************************************************************************** ' PrintForm Class ' ' Purpose: Print active window ' ' Dependencies: ' ' Author: Øyvind Rustan - Compositae, 27.05.2002 ' http://www.compositae.no ' Revision: ' '********************************************************************************** Imports System.Windows Imports System.Drawing Public Class PrintForm '------------------------------------------------------------------------------ ' New ' Constructor '------------------------------------------------------------------------------ Public Sub New() End Sub '------------------------------------------------------------------------------ ' Print ' Print active window (form) '------------------------------------------------------------------------------ Public Sub Print() Try '-- Keys Alt+PrintScreen copies active window to clipboard Forms.SendKeys.SendWait("%{PRTSC}") '-- Create print document and printing handler Dim pd As New Printing.PrintDocument() AddHandler pd.PrintPage, AddressOf pd_PrintPage '-- Setup document pd.DocumentName = "PrintScreen" With pd.DefaultPageSettings .Landscape = False '-- Reduce margins to accomodate larger pictures .Margins.Left -= .Margins.Left \ 3 .Margins.Top -= .Margins.Top \ 3 .Margins.Right -= .Margins.Right \ 3 .Margins.Bottom -= .Margins.Bottom \ 3 End With '-- Print document pd.Print() Catch ex As Exception Throw ex End Try End Sub '------------------------------------------------------------------------------ ' pd_PrintPage ' PrintPage handler '------------------------------------------------------------------------------ Private Sub pd_PrintPage(ByVal sender As Object, ByVal ev As Printing.PrintPageEventArgs) Try '-- Get PrintScreen bitmap from clipboard Dim iData As IDataObject = Clipboard.GetDataObject() If iData.GetDataPresent(DataFormats.Bitmap) Then Dim bm As Bitmap = CType(iData.GetData(DataFormats.Bitmap), Bitmap) '-- Set size of destination rectangle (printer) Dim rDest As New RectangleF(ev.MarginBounds.Left, ev.MarginBounds.Top, 0, 0) If bm.Width < ev.MarginBounds.Width Then '-- Set to bitmap size if bitmap is smaller than paper rDest.Width = bm.Width rDest.Height = bm.Height Else '-- Set to paper size if bitmap is larger than paper '-- Scale height to retain proportions rDest.Width = ev.MarginBounds.Width rDest.Height = CType(rDest.Width * (bm.Height / bm.Width), Single) End If '-- Draw bitmap ev.Graphics.DrawImage(bm, rDest, bm.GetBounds(GraphicsUnit.Pixel), GraphicsUnit.Pixel) '-- Draw timestamp Dim printFont As Font = New Font("Arial", 10, FontStyle.Regular) ev.Graphics.DrawString(Now.ToString, printFont, Brushes.Black, rDest.Left, rDest.Top + rDest.Height + printFont.GetHeight(ev.Graphics)) Else '-- No bitmap, cancel printing ev.Cancel = True End If Catch ex As Exception '-- Cancel printing ev.Cancel = True Throw ex Finally '-- Print only on page ev.HasMorePages = False End Try End Sub End Class -
Try AxWebBrowser1.ExecWB(SHDocVw.OLECMDID.OLECMDID_PRINT, SHDocVw.OLECMDEXECOPT.OLECMDEXECOPT_PROMPTUSER) AxWebBrowser1 being the name of the Web Browser Control
-
Right I've got a slightly sticky problem. I need to print out from the web browser control (wbc) with bakground colour. The problem starts that IE is usually set to not print with background colours off. is there a way I can tell the WBC to print out it's contents with the background colour on? Here is my attempt so far, its all done in .net. Imports System.Windows Imports System.Drawing Public Class Form1 Inherits System.Windows.Forms.Form #Region " Windows Form Designer generated code " Public Sub New() MyBase.New() InitializeComponent() End Sub 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 Private components As System.ComponentModel.IContainer Friend WithEvents AxWebBrowser1 As AxSHDocVw.AxWebBrowser Friend WithEvents btnExit As System.Windows.Forms.Button Friend WithEvents btnPrint As System.Windows.Forms.Button Friend WithEvents PrintDocument1 As System.Drawing.Printing.PrintDocument Friend WithEvents lblPageTitle As System.Windows.Forms.Label Friend WithEvents optMinimize As System.Windows.Forms.Button Friend WithEvents Splitter1 As System.Windows.Forms.Splitter <System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent() Dim resources As System.Resources.ResourceManager = New System.Resources.ResourceManager(GetType(Form1)) Me.AxWebBrowser1 = New AxSHDocVw.AxWebBrowser() Me.btnExit = New System.Windows.Forms.Button() Me.btnPrint = New System.Windows.Forms.Button() Me.PrintDocument1 = New System.Drawing.Printing.PrintDocument() Me.lblPageTitle = New System.Windows.Forms.Label() Me.optMinimize = New System.Windows.Forms.Button() Me.Splitter1 = New System.Windows.Forms.Splitter() CType(Me.AxWebBrowser1, System.ComponentModel.ISupportInitialize).BeginInit() Me.SuspendLayout() Me.AxWebBrowser1.Enabled = True Me.AxWebBrowser1.Location = New System.Drawing.Point(0, 16) Me.AxWebBrowser1.OcxState = CType(resources.GetObject("AxWebBrowser1.OcxState"), System.Windows.Forms.AxHost.State) Me.AxWebBrowser1.Size = New System.Drawing.Size(848, 632) Me.AxWebBrowser1.TabIndex = 0 Me.btnExit.BackColor = System.Drawing.Color.FromArgb(CType(192, Byte), CType(0, Byte), CType(0, Byte)) Me.btnExit.FlatStyle = System.Windows.Forms.FlatStyle.Popup Me.btnExit.Font = New System.Drawing.Font("Microsoft Sans Serif", 8.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte)) Me.btnExit.ForeColor = System.Drawing.Color.White Me.btnExit.Location = New System.Drawing.Point(824, 0) Me.btnExit.Name = "btnExit" Me.btnExit.Size = New System.Drawing.Size(24, 16) Me.btnExit.TabIndex = 1 Me.btnExit.Text = "X" Me.btnPrint.BackColor = System.Drawing.Color.FromArgb(CType(192, Byte), CType(0, Byte), CType(0, Byte)) Me.btnPrint.FlatStyle = System.Windows.Forms.FlatStyle.Popup Me.btnPrint.Font = New System.Drawing.Font("Microsoft Sans Serif", 8.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte)) Me.btnPrint.ForeColor = System.Drawing.Color.White Me.btnPrint.Name = "btnPrint" Me.btnPrint.Size = New System.Drawing.Size(64, 24) Me.btnPrint.TabIndex = 2 Me.btnPrint.Text = "Print" Me.lblPageTitle.BackColor = System.Drawing.Color.Transparent Me.lblPageTitle.Font = New System.Drawing.Font("Microsoft Sans Serif", 8.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte)) Me.lblPageTitle.ForeColor = System.Drawing.Color.White Me.lblPageTitle.Location = New System.Drawing.Point(80, 0) Me.lblPageTitle.Name = "lblPageTitle" Me.lblPageTitle.Size = New System.Drawing.Size(680, 16) Me.lblPageTitle.TabIndex = 3 Me.optMinimize.BackColor = System.Drawing.Color.FromArgb(CType(192, Byte), CType(0, Byte), CType(0, Byte)) Me.optMinimize.FlatStyle = System.Windows.Forms.FlatStyle.Popup Me.optMinimize.Font = New System.Drawing.Font("Microsoft Sans Serif", 8.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte)) Me.optMinimize.ForeColor = System.Drawing.Color.White Me.optMinimize.Location = New System.Drawing.Point(792, 0) Me.optMinimize.Name = "optMinimize" Me.optMinimize.Size = New System.Drawing.Size(24, 16) Me.optMinimize.TabIndex = 4 Me.optMinimize.Text = "--" Me.Splitter1.Name = "Splitter1" Me.Splitter1.Size = New System.Drawing.Size(3, 638) Me.Splitter1.TabIndex = 5 Me.Splitter1.TabStop = False Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13) Me.BackColor = System.Drawing.Color.Maroon Me.ClientSize = New System.Drawing.Size(848, 638) Me.Controls.AddRange(New System.Windows.Forms.Control() {Me.Splitter1, Me.optMinimize, Me.lblPageTitle, Me.btnPrint, Me.btnExit, Me.AxWebBrowser1}) Me.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None Me.Name = "Form1" Me.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen Me.Text = "Form1" CType(Me.AxWebBrowser1, System.ComponentModel.ISupportInitialize).EndInit() Me.ResumeLayout(False) End Sub #End Region Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load AxWebBrowser1.Navigate("http://www.bbc.co.uk") lblPageTitle.Text() = AxWebBrowser1.Name.ToString End Sub Private Sub btnExit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnExit.Click Application.Exit() End Sub Private Sub btnPrint_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnPrint.Click AxWebBrowser1.ExecWB(SHDocVw.OLECMDID.OLECMDID_SELECTALL, SHDocVw.OLECMDEXECOPT.OLECMDEXECOPT_DONTPROMPTUSER) AxWebBrowser1.ExecWB(SHDocVw.OLECMDID.OLECMDID_COPY, SHDocVw.OLECMDEXECOPT.OLECMDEXECOPT_DONTPROMPTUSER) Print() End Sub Public Sub Print() Try Forms.SendKeys.SendWait("%{PRTSC}") Dim pd As New Printing.PrintDocument() AddHandler pd.PrintPage, AddressOf pd_PrintPage pd.DocumentName = "PrintScreen" With pd.DefaultPageSettings .Landscape = False '-- Reduce margins to accomodate larger pictures .Margins.Left -= .Margins.Left \ 3 .Margins.Top -= .Margins.Top \ 3 .Margins.Right -= .Margins.Right \ 3 .Margins.Bottom -= .Margins.Bottom \ 3 End With '-- Print document pd.Print() Catch ex As Exception Throw ex End Try End Sub Private Sub pd_PrintPage(ByVal sender As Object, ByVal ev As Printing.PrintPageEventArgs) Try '-- Get PrintScreen bitmap from clipboard Dim iData As IDataObject = Clipboard.GetDataObject If iData.GetDataPresent(DataFormats.Bitmap) Then Dim bm As Bitmap = CType(iData.GetData(DataFormats.Bitmap), Bitmap) '-- Set size of destination rectangle (printer) Dim rDest As New RectangleF(ev.MarginBounds.Left, ev.MarginBounds.Top, 0, 0) If bm.Width < ev.MarginBounds.Width Then '-- Set to bitmap size if bitmap is smaller than paper rDest.Width = bm.Width rDest.Height = bm.Height Else '-- Set to paper size if bitmap is larger than paper '-- Scale height to retain proportions rDest.Width = ev.MarginBounds.Width rDest.Height = CType(rDest.Width * (bm.Height / bm.Width), Single) End If '-- Draw bitmap ev.Graphics.DrawImage(bm, rDest, bm.GetBounds(GraphicsUnit.Pixel), GraphicsUnit.Pixel) '-- Draw timestamp Dim printFont As Font = New Font("Arial", 10, FontStyle.Regular) ev.Graphics.DrawString("End of job", printFont, Brushes.Black, rDest.Left, rDest.Top + rDest.Height + printFont.GetHeight(ev.Graphics)) Else '-- No bitmap, cancel printing ev.Cancel = True End If Catch ex As Exception '-- Cancel printing ev.Cancel = True Throw ex Finally '-- Print only on page ev.HasMorePages = False End Try End Sub Private Sub optMinimize_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles optMinimize.Click On Error Resume Next AxWebBrowser1.ExecWB(SHDocVw.OLECMDID.OLECMDID_PRINT, SHDocVw.OLECMDEXECOPT.OLECMDEXECOPT_PROMPTUSER) End Sub End Class Long I know. As you can see I do have two forms of print on here already, on takes a screen shot of the form (giving me background colouring, but on part of the page) the second print out the page like IE (full, but no background colours) Any suggestions?