473,790 Members | 2,534 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Problems with printing right aligned text.

Hello!

I am using a thirdparty gridcontrol which has a bug in it. It consists of
that when setting a column to be right aligned it doesn't work as it should.
The column gets rightaligned, but only for text that has the same length.
The longer the text in each cell is, the longer to the left the text is
being printed. (Take a look at this file to see what it looks like:
http://www.lowrad.net/files/grid_bug.jpg)

I contacted the support about this, but they said the solution was to
override the PaintForeground method for the cell class. I did that, and
experienced the exact same bug as with the original PaintForeground method.
Unfortunately I don't have the sourcecode for the gridcontrol, but this is
my code:

protected override void PaintForeground (Xceed.Grid.Gri dPaintEventArgs e)
{
if (this.Horizonta lAlignment == Xceed.Grid.Hori zontalAlignment .Right)
{
string text = System.Convert. ToString(this.V alue);
System.Drawing. SolidBrush brush = new
System.Drawing. SolidBrush(this .ForeColor);
System.Drawing. StringFormat format = new
System.Drawing. StringFormat();
format.Alignmen t = System.Drawing. StringAlignment .Far;

e.Graphics.Draw String(text,thi s.Font,brush,e. ClientRectangle ,format);
}
else
{
base.PaintForeg round(e);
}
}

Now, it suprised me that the exact same problem happened since I thought
printing the text with DrawString should do it. My question now is how the
DrawString method determines where to print the text? In my eyes it must be
using the e.ClientRectang le object and the format object combined...
Therefore I started looking at the clientrectangle 's size and location each
time the PaintForeground method was called, to see if they changed. But they
don't and that's where I'm stuck. How come the alignment doesn't work? What
else than the size and location of the rectangle is used when printing text
aligned to the right?

I'm VERY thankful for help here.

/David.
Nov 15 '05 #1
0 1604

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
3664
by: Andres Mas Torrecillas | last post by:
Hi! I'm having a little trouble with an IFRAME added in an HTML page. IFRAME has a fixed size and it contains another HTML page, which only has some text paragraphs and a pair of images aligned left and right (with 'style="float: {left | right}"'). There's no tables or anything with a fixed size. Problem is that in browsers like Opera 7, the IFRAME shows perfectly and just vertical scroll bar is showed (that's what I want). But on...
3
2383
by: eternalD3 | last post by:
Hi, I have a problem to get this working on Opera 7.x+. This does not need to work on older Opera browsers There are problems on rendering the sub-level navigation. It aligns right on Firefox and IE 6. Sometimes there are also some problems on IE 5 or IE 5.5. I would like the navigation to work like this:
0
964
by: Jonathan | last post by:
I am trying to learn how to print with VB.net but the book I'm using has lots of mistakes. Here is the code which is almost directly copied from the book I'm using: Imports System.Drawing Imports System.Drawing.Drawing2D Imports System.Drawing.Printing Public Class PrintClass
8
4079
by: Harry Haller | last post by:
The right arrow in IE is displayed aligned to the bottom of the line. Is there any way I can display it aligned vertially in the middle? Example: <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <style type="text/css"><!-- sub {vertical-align: text-bottom; font-size: smaller}
5
10154
by: Patrick De Ridder | last post by:
How can I turn what I want to print 90 degrees using the logic below? Please tell me the code with which to make the modification. Many thanks, Patrick. using System.ComponentModel; using System.Drawing; using System.Drawing.Printing; using System.IO;
19
2028
by: JB | last post by:
Hi All, Why doesn't this work in Firefox but is perfect in IE6? In IE6, the text is on the same line but in Firefox, the left aligned text is on the line above the right aligned text. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html>
3
7878
by: Sjef Janssen | last post by:
Is it possible to have a box (div) which sets a background-color and which contains (on the same line) text which is left aligned and text which is right aligned. (as in a table: two td's left one left aligned, right one right aligned). Thanxs!!
8
2578
by: joemacbusiness | last post by:
Hi All, How do I format printed data in python? I could not find this in the Python Reference Manual: http://docs.python.org/ref/print.html Nor could I find it in Matloff's great tutorial: http://heather.cs.ucdavis.edu/~matloff/Python/PythonIntro.pdf For example, how do I turn this:
6
1752
by: Liam Gibbs | last post by:
Hello everyone, I'm trying to program a church web site and I'm having a number of problems with the layout. The html is at http://www.altmarvel.net/Liam/index.html and the css is at http://www.altmarvel.net/Liam/OCOC.css. Anyway, the problems are these: 1. The Search stuff underneath the menu and to the right should be
0
10200
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10142
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
9986
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
9021
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...
1
7529
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6769
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
5422
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...
1
4093
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2909
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.