473,651 Members | 2,917 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Print Flex Grid

28 New Member
Hi!

Can anyone tell me how can i print a flex grid?
I created a button print below the flex grid.What code should i write in order to print?
and how can i can i change the colour and the font of some specific cells?
For example in my flex grid i would like to change the colour in the column(2,1) until (2,10) also in the (4,1) until (4,10), (6,1)until(6,10 ).


Also can someone help me to write the code below using a for loop
frmResult.flgPr intingResults.s et_ColWidth(0, 2800)
frmResult.flgPr intingResults.s et_ColWidth(2, 2800)
frmResult.flgPr intingResults.s et_ColWidth(4, 2800)
frmResult.flgPr intingResults.s et_ColWidth(6, 2800)
frmResult.flgPr intingResults.s et_ColWidth(8, 2800)

thnks
Mar 30 '07 #1
1 2280
cmrhema
375 Contributor
Actually I got this when I was searching for printing a grid long time back. But I did not try it. Check out and let me know

Private Sub PrintFlexGrid(B yVal ptr As Object, ByVal flx As _
MSFlexGrid, ByVal xmin As Single, ByVal ymin As Single)
Const GAP = 60

Dim xmax As Single
Dim ymax As Single
Dim X As Single
Dim c As Integer
Dim r As Integer

With ptr.Font
.Name = flxData.Font.Na me
.Size = flxData.Font.Si ze
End With

With flxData
' See how wide the whole thing is.
xmax = xmin + GAP
For c = 0 To .Cols - 1
xmax = xmax + .ColWidth(c) + 2 * GAP
Next c

' Print each row.
ptr.CurrentY = ymin
For r = 0 To .Rows - 1
' Draw a line above this row.
If r > 0 Then ptr.Line (xmin, _
ptr.CurrentY)-(xmax, ptr.CurrentY)
ptr.CurrentY = ptr.CurrentY + GAP

' Print the entries on this row.
X = xmin + GAP
For c = 0 To .Cols - 1
ptr.CurrentX = X
ptr.Print BoundedText(ptr , .TextMatrix(r, _
c), .ColWidth(c));
X = X + .ColWidth(c) + 2 * GAP
Next c
ptr.CurrentY = ptr.CurrentY + GAP

' Move to the next line.
ptr.Print
Next r
ymax = ptr.CurrentY

' Draw a box around everything.
ptr.Line (xmin, ymin)-(xmax, ymax), , B

' Draw lines between the columns.
X = xmin
For c = 0 To .Cols - 2
X = X + .ColWidth(c) + 2 * GAP
ptr.Line (X, ymin)-(X, ymax)
Next c
End With
End Sub

' Truncate the string so it fits within the width.
Private Function BoundedText(ByV al ptr As Object, ByVal txt _
As String, ByVal max_wid As Single) As String
Do While ptr.TextWidth(t xt) > max_wid
txt = Left$(txt, Len(txt) - 1)
Loop
BoundedText = txt
End Function
Mar 30 '07 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

6
2902
by: Brian Holbrook | last post by:
I am new to VB .Net. Is there anything close to what a flex grid was in VB 6.0? By this I mean being able to manipulate and add text data that is not in a database. I would be taking data from a text box and adding it or updating data that already exists in the grid. Again I am using VB .Net in a Smart Device application. Any direction on this would be a great help. Thanks, Brian
2
13995
by: Qumer Mumtaz | last post by:
H How to us MS Flex Grid in C#.I mean how to add columns and rows at run time and how to assign values to the columns and rows ? Any help in this regard will be appriciated Plz reply sooon......... Thanx
0
1043
by: ChitraCK | last post by:
Hi, I have a flex grid with the size that it can show the user 4 rows at a time. When there exceeds more than 4 rows it asutomatically puts the vertical scroll bar. On click of scroll bar to see the next set of records ,the values are wiped off. Basically i have 4 columns one is text and rest 3 are check boxes. The text column is able to retain the value but not the checkboxes. Please suggest me on this Thanks
9
10744
by: Vincent | last post by:
I am trying to create a function that is called on the Flex Grid's MouseDown event. However, this event is not listed in the properties for this object. I tried to manually create the prototype for this event as: Private Sub flGrid_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single) End Sub This only gives me an error. I read on one posting that you should
1
2319
by: Sero96 | last post by:
I am working on a project in vb.net and i want to know how to use flex grids to display information. Now want i want to put into the project is the example here: http://en.wikipedia.org/wiki/World_of_Warcraft If you scroll down to characters and information is there in a table. i want to put that exact information into a flex grid in vb.net Can anyone help me as soon as possible on this please
10
6710
by: Jules Winfield | last post by:
Guys, I've been designing applications for the financial services industry using MSFT technologies for many years (Win32 API, MFC, and now .NET WinForms). All applications are Internet-based, with a "thick client" which makes calls to my grid of servers via a socket or remoting connection. Customers are pleased with my work but it seems that over the past twelve months or so, those same customers have expressed a strong demand to...
3
1875
by: charvi | last post by:
hi I am new to vs flex grid.now after entering the data to flex grid which contains four columns how to save the entered data to a table my table is in ms access thankx in regards
1
1543
by: charvi | last post by:
hi now i want to add all the names from table to combo column in flex grid.whr is the syntax now my flex grid column 3 acta as combo box how can i code pls help
1
2594
by: Bills | last post by:
Hi, I am looking for a grid that supports the following requirements: Firstly, I need to bind a datatable (which I fetch from a database) to the grid. I then need to be able to add columns (incidentally, a large number, roughly 500-600) to the grid, and highlight a range of columns for given row(s). I was using another third party grid which was taking care of my requirements, but it is incredibly slow performance-wise. The grid takes...
0
8357
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8803
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
8465
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8581
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7298
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5612
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4144
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4285
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1910
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.