Click here to Skip to main content
15,891,567 members

Comments by strogg (Top 57 by date)

strogg 16-Nov-14 9:40am View    
Go to data directory, open the file 'pg_hba.conf' and add the line
-----
# IPv4 local connections:
host all all 192.168.1.10/24 md5
-----
where 192.168.1.10 is the remote ip from which you will access postgres server. Or you can use
---
host all all 0.0.0.0/0 md5
---
which should allow all ip addresses to connect.
Replacing 'md5' in the line with 'trust' will allow users to connect without a password. Restart server and try.
Don't forget to add these lines to 'postgresql.conf' file
---
listen_address = '*'
port = 5432
---
If you omit port, it should default to 5432. Turn firewall off while testing. It's better you test on a local network. If you're trying to access it through the internet, you must forward the port you use through the router as well. Hope this helps
strogg 14-Nov-14 13:58pm View    
On your server, go to your data directory, open postgresql.conf and uncomment the line listen_address (remove #) - set it to: listen_address = '*'
Restart your pgsql server. make sure your server's firewall is allowing port 5432. Temporarily turn off your firewall to test if you like.
strogg 26-Nov-13 13:18pm View    
By auto-size you mean to auto size the rich text box before capturing? It's not a good idea since the contents may exceed the screen area & you won't get the full image.
There is another more complicated way to render the contents into an image. Take a look for the answer to this question here.
http://www.codeproject.com/Questions/469035/Csharp-RTF-text-to-bitmap-image-Any-easy-way-aroun
Another article about displaying print preview & print:
http://www.codeproject.com/Articles/42823/RichTextBoxDocument
strogg 29-Oct-13 7:01am View    
Make sure that the control is visible on the screen. I tested the code by placing a PictureBox next to it and assigning the bitmap to the picture box (pictureBox1.Image = bmp;) on a button click. It works for me. I'm getting all the contents.

Paste the below code into a file named Rtf.cs and compile it with
%windir%\Microsoft.NET\Framework\v3.5\csc /t:winexe Rtf.cs
at the command prompt and try

using System;
using System.Data;
using System.Drawing;
using System.Windows.Forms;

public class Rtf
{
public static void Main()
{
Form frm = new Form();
frm.Width = 400;
frm.Height = 300;

RichTextBox rt = new RichTextBox();
rt.Width = 175; rt.Height = 100;
rt.Location = new Point(10, 10);
frm.Controls.Add(rt);

PictureBox p = new PictureBox();
p.Width = 175; p.Height = 100;
p.Location = new Point(200, 10);
frm.Controls.Add(p);

Button b = new Button();
b.Width = 175; b.Height = 23;
b.Location = new Point(10, 120);
b.Text = "Try!";
b.Click += (s, ea) =>
{
rt.Update();
Bitmap bmp = new Bitmap(rt.Width, rt.Height);
using (Graphics g = Graphics.FromImage(bmp))
{
g.CopyFromScreen(rt.PointToScreen(Point.Empty), Point.Empty, rt.Size);
}
p.Image = bmp;
};
frm.Controls.Add(b);

frm.ShowDialog();
}
}
strogg 29-Oct-13 6:59am View    
Deleted
Make sure that the control is visible on the screen. I tested the code by placing a PictureBox next to it and assigning the bitmap to the picture box (pictureBox1.Image = bmp;) on a button click. It works for me. I'm getting all the contents.

Paste the below code into a file named Rtf.cs and compile it with
%windir%\Microsoft.NET\Framework\v3.5\csc /t:winexe Rtf.cs
at the command prompt and try

using System;
using System.Data;
using System.Drawing;
using System.Windows.Forms;

public class Rtf
{
public static void Main()
{
Form frm = new Form();
frm.Width = 400;
frm.Height = 300;

RichTextBox rt = new RichTextBox();
rt.Width = 175; rt.Height = 100;
rt.Location = new Point(10, 10);
frm.Controls.Add(rt);

PictureBox p = new PictureBox();
p.Width = 175; p.Height = 100;
p.Location = new Point(200, 10);
frm.Controls.Add(p);

Button b = new Button();
b.Width = 175; b.Height = 23;
b.Location = new Point(10, 120);
b.Text = "Try!";
b.Click += (s, ea) =>
{
rt.Update();
Bitmap bmp = new Bitmap(rt.Width, rt.Height);
using (Graphics g = Graphics.FromImage(bmp))
{
g.CopyFromScreen(rt.PointToScreen(Point.Empty), Point.Empty, rt.Size);
}
p.Image = bmp;
};
frm.Controls.Add(b);

frm.ShowDialog();
}
}