Click here to Skip to main content
14,421,641 members
   

C#

 
GeneralRe: DrawString with opacity option not print properly Pin
OriginalGriff29-Nov-19 22:41
communityengineerOriginalGriff29-Nov-19 22:41 
GeneralRe: DrawString with opacity option not print properly Pin
Le@rner29-Nov-19 23:06
MemberLe@rner29-Nov-19 23:06 
GeneralRe: DrawString with opacity option not print properly Pin
OriginalGriff29-Nov-19 23:33
communityengineerOriginalGriff29-Nov-19 23:33 
GeneralRe: DrawString with opacity option not print properly Pin
OriginalGriff29-Nov-19 23:39
communityengineerOriginalGriff29-Nov-19 23:39 
GeneralRe: DrawString with opacity option not print properly Pin
Le@rner30-Nov-19 0:20
MemberLe@rner30-Nov-19 0:20 
GeneralRe: DrawString with opacity option not print properly Pin
OriginalGriff30-Nov-19 0:23
communityengineerOriginalGriff30-Nov-19 0:23 
GeneralRe: DrawString with opacity option not print properly Pin
OriginalGriff30-Nov-19 0:29
communityengineerOriginalGriff30-Nov-19 0:29 
GeneralRe: DrawString with opacity option not print properly Pin
Le@rner30-Nov-19 0:44
MemberLe@rner30-Nov-19 0:44 
private void Pd_PrintPage(object sender, PrintPageEventArgs pe)
        {

            string watermarkText = "Your Name © 2015, All Rights Reserved";
            Font watermarkFont = new Font("Microsoft Sans Serif", 18, FontStyle.Bold);

            int X = 0;
            int Y = 0;

            RectangleF rect2 = panel2.ClientRectangle;

            float image_draw_wd = panel2.Width;

            float image_draw_ht = panel2.Height;

            Brush myBrush = new SolidBrush(Color.FromArgb(128, Color.Blue));

            StringFormat stringFormat = new StringFormat();
            stringFormat.Alignment = StringAlignment.Center;
            stringFormat.FormatFlags = StringFormatFlags.LineLimit;
            stringFormat.Trimming = StringTrimming.Word;


            SizeF sz = pe.Graphics.MeasureString(watermarkText, watermarkFont, (int)image_draw_wd, stringFormat);


            double angle = 0;
            double angleRadians = Math.Atan2(image_draw_ht, image_draw_wd);
            angle = angleRadians * 180.0 / Math.PI;

            pe.Graphics.TranslateTransform((rect2.Location.X + rect2.Width / 2), (rect2.Location.Y + rect2.Height / 2));
            pe.Graphics.RotateTransform((float)angle);// + flip180Image);
            pe.Graphics.TranslateTransform(-(rect2.Location.X + rect2.Width / 2), -(rect2.Location.Y + rect2.Height / 2));


            X = 10;
            X = (int)(panel2.Width - sz.Width) / 2;
            Y = 10;
            Y = (int)(panel2.Height - sz.Height) / 2;

            RectangleF dr_rect = new RectangleF(new Point(X, Y), new Size((int)image_draw_wd, ((int)sz.Height) + 10));

            pe.Graphics.DrawString(watermarkText, watermarkFont, myBrush, dr_rect, stringFormat);
        }



preview , pdf n all looks same n fine why its not print on actual printer

my model is
HP deskjet gt 5811
GeneralRe: DrawString with opacity option not print properly Pin
OriginalGriff30-Nov-19 0:55
communityengineerOriginalGriff30-Nov-19 0:55 
GeneralRe: DrawString with opacity option not print properly Pin
Le@rner30-Nov-19 1:03
MemberLe@rner30-Nov-19 1:03 
GeneralRe: DrawString with opacity option not print properly Pin
OriginalGriff30-Nov-19 1:11
communityengineerOriginalGriff30-Nov-19 1:11 
QuestionDialogue box disappears when I search in the combo box Pin
Member 1326263928-Nov-19 18:43
MemberMember 1326263928-Nov-19 18:43 
AnswerRe: Dialogue box disappears when I search in the combo box Pin
Dave Kreskowiak28-Nov-19 19:46
mveDave Kreskowiak28-Nov-19 19:46 
Questionhow to check if value exists in database from textbox c# Pin
Member 1464425125-Nov-19 4:10
MemberMember 1464425125-Nov-19 4:10 
AnswerRe: how to check if value exists in database from textbox c# Pin
Pete O'Hanlon25-Nov-19 4:29
communityengineerPete O'Hanlon25-Nov-19 4:29 
GeneralRe: how to check if value exists in database from textbox c# Pin
F-ES Sitecore26-Nov-19 6:11
mveF-ES Sitecore26-Nov-19 6:11 
GeneralRe: how to check if value exists in database from textbox c# Pin
Pete O'Hanlon27-Nov-19 0:23
communityengineerPete O'Hanlon27-Nov-19 0:23 
AnswerRe: how to check if value exists in database from textbox c# Pin
Richard MacCutchan25-Nov-19 4:39
communityengineerRichard MacCutchan25-Nov-19 4:39 
AnswerRe: how to check if value exists in database from textbox c# Pin
OriginalGriff25-Nov-19 4:52
communityengineerOriginalGriff25-Nov-19 4:52 
AnswerRe: how to check if value exists in database from textbox c# Pin
#realJSOP25-Nov-19 10:23
mva#realJSOP25-Nov-19 10:23 
AnswerRe: how to check if value exists in database from textbox c# Pin
hailu worku26-Nov-19 3:59
Memberhailu worku26-Nov-19 3:59 
GeneralRe: how to check if value exists in database from textbox c# Pin
Pete O'Hanlon26-Nov-19 4:28
communityengineerPete O'Hanlon26-Nov-19 4:28 
SuggestionRe: how to check if value exists in database from textbox c# Pin
Eddy Vluggen26-Nov-19 7:15
mveEddy Vluggen26-Nov-19 7:15 
AnswerRe: how to check if value exists in database from textbox c# Pin
#realJSOP27-Nov-19 1:55
mva#realJSOP27-Nov-19 1:55 
AnswerRe: how to check if value exists in database from textbox c# Pin
Gerry Schmitz27-Nov-19 8:15
mveGerry Schmitz27-Nov-19 8:15 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.