请发表友善的回复…
发表回复
cdutzz 2007-05-16
- 打赏
- 举报
在winform里用textbox,想让内容跟一些其他阅读软件一样,可以调整每行的显示间距
Macosx 2007-05-16
- 打赏
- 举报
如果在web 参考 line-height 的用法
如果是WinForm中还有没有想到 可能需要用RichTextBox并且使用RTF
如果是WinForm中还有没有想到 可能需要用RichTextBox并且使用RTF
alldj 2007-05-16
- 打赏
- 举报
重写textbox控件,有一定难度,建议用第三方控件。
dreign 2007-05-16
- 打赏
- 举报
帮顶,winform,还是webform?
懒牛科技 2007-05-16
- 打赏
- 举报
楼主可能是用多行的textbox吧
没有尝试过,可以给textbox的样式表试试!
没有尝试过,可以给textbox的样式表试试!
ustbwuyi 2007-05-16
- 打赏
- 举报
行间距?不解用意,too...
hertcloud 2007-05-16
- 打赏
- 举报
不解 楼主 用意?
winform 的话 设计 状态 就可以确定
web 的话 用表格 确定.
winform 的话 设计 状态 就可以确定
web 的话 用表格 确定.
cdutzz 2007-05-16
- 打赏
- 举报
然后还有个问题,richtextbox,要先执行玩selectall()后,焦点会跑到别的地方去,怎么让richtextbox执行完selectall()后焦点不变化?
cdutzz 2007-05-16
- 打赏
- 举报
附带产生了些问题
private struct PARAFORMAT2{
public int cbSize;
public uint dwMask;
public short wNumbering;
public short wReserved;
public int dxStartIndent;
public int dxRightIndent;
public int dxOffset;
public short wAlignment;
public short cTabCount;
[MarshalAs( UnmanagedType.ByValArray, SizeConst = 32 )]
public int[] rgxTabs;
public int dySpaceBefore;
public int dySpaceAfter;
public int dyLineSpacing;
public short sStyle;
public byte bLineSpacingRule;
public byte bOutlineLevel;
public short wShadingWeight;
public short wShadingStyle;
public short wNumberingStart;
public short wNumberingStyle;
public short wNumberingTab;
public short wBorderSpace;
public short wBorderWidth;
public short wBorders;}
具体每个字段的含义是什么?
private struct PARAFORMAT2{
public int cbSize;
public uint dwMask;
public short wNumbering;
public short wReserved;
public int dxStartIndent;
public int dxRightIndent;
public int dxOffset;
public short wAlignment;
public short cTabCount;
[MarshalAs( UnmanagedType.ByValArray, SizeConst = 32 )]
public int[] rgxTabs;
public int dySpaceBefore;
public int dySpaceAfter;
public int dyLineSpacing;
public short sStyle;
public byte bLineSpacingRule;
public byte bOutlineLevel;
public short wShadingWeight;
public short wShadingStyle;
public short wNumberingStart;
public short wNumberingStyle;
public short wNumberingTab;
public short wBorderSpace;
public short wBorderWidth;
public short wBorders;}
具体每个字段的含义是什么?
王集鹄 2007-05-16
- 打赏
- 举报
有交流才有进步,楼主总结得还不错
cdutzz 2007-05-16
- 打赏
- 举报
对于textbox该方法无效
对于richtextbox,要先执行selectall(),才能改变所有内容行间距,谢谢zswang
对于richtextbox,要先执行selectall(),才能改变所有内容行间距,谢谢zswang
cdutzz 2007-05-16
- 打赏
- 举报
谢谢zswang给的答案,但是没有完全解决问题
1.只能改变richtextbox的行间距,上述方法对textbox无效
2.而且改变行间距的时候,只改变了鼠标焦点所在的几行,没有把所有内容的行间距改变,如何解决
zswang,我会在结稿的时候答谢你的,呵呵
1.只能改变richtextbox的行间距,上述方法对textbox无效
2.而且改变行间距的时候,只改变了鼠标焦点所在的几行,没有把所有内容的行间距改变,如何解决
zswang,我会在结稿的时候答谢你的,呵呵
shinaterry 2007-05-16
- 打赏
- 举报
mark...
王集鹄 2007-05-16
- 打赏
- 举报
from
http://www.labblog.com/user1/hljria/200752144138.html
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Runtime.InteropServices;
namespace WindowsApplication2
{
public partial class Form1 : Form
{
public const int WM_USER = 0x0400;
public const int EM_GETPARAFORMAT = WM_USER + 61;
public const int EM_SETPARAFORMAT = WM_USER + 71;
public const long MAX_TAB_STOPS = 32;
public const uint PFM_LINESPACING = 0x00000100;
[StructLayout( LayoutKind.Sequential )]
private struct PARAFORMAT2{
public int cbSize;
public uint dwMask;
public short wNumbering;
public short wReserved;
public int dxStartIndent;
public int dxRightIndent;
public int dxOffset;
public short wAlignment;
public short cTabCount;
[MarshalAs( UnmanagedType.ByValArray, SizeConst = 32 )]
public int[] rgxTabs;
public int dySpaceBefore;
public int dySpaceAfter;
public int dyLineSpacing;
public short sStyle;
public byte bLineSpacingRule;
public byte bOutlineLevel;
public short wShadingWeight;
public short wShadingStyle;
public short wNumberingStart;
public short wNumberingStyle;
public short wNumberingTab;
public short wBorderSpace;
public short wBorderWidth;
public short wBorders;}
public Form1()
{
InitializeComponent();
}
[DllImport( "user32", CharSet = CharSet.Auto )]
private static extern IntPtr SendMessage( HandleRef hWnd, int msg,int wParam, ref PARAFORMAT2 lParam );
private void Form1_Load(object sender, EventArgs e)
{
}
private void button1_Click(object sender, EventArgs e)
{
PARAFORMAT2 fmt = new PARAFORMAT2();
fmt.cbSize = Marshal.SizeOf(fmt);
fmt.bLineSpacingRule = 4;
fmt.dyLineSpacing = 500;//((int)richTextBox1.Font.Size) * 20 * ((int)ud.Value);
fmt.dwMask = PFM_LINESPACING;
SendMessage( new HandleRef(this.richTextBox1, richTextBox1.Handle ), EM_SETPARAFORMAT, 0, ref fmt );
}
}
}
http://www.labblog.com/user1/hljria/200752144138.html
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Runtime.InteropServices;
namespace WindowsApplication2
{
public partial class Form1 : Form
{
public const int WM_USER = 0x0400;
public const int EM_GETPARAFORMAT = WM_USER + 61;
public const int EM_SETPARAFORMAT = WM_USER + 71;
public const long MAX_TAB_STOPS = 32;
public const uint PFM_LINESPACING = 0x00000100;
[StructLayout( LayoutKind.Sequential )]
private struct PARAFORMAT2{
public int cbSize;
public uint dwMask;
public short wNumbering;
public short wReserved;
public int dxStartIndent;
public int dxRightIndent;
public int dxOffset;
public short wAlignment;
public short cTabCount;
[MarshalAs( UnmanagedType.ByValArray, SizeConst = 32 )]
public int[] rgxTabs;
public int dySpaceBefore;
public int dySpaceAfter;
public int dyLineSpacing;
public short sStyle;
public byte bLineSpacingRule;
public byte bOutlineLevel;
public short wShadingWeight;
public short wShadingStyle;
public short wNumberingStart;
public short wNumberingStyle;
public short wNumberingTab;
public short wBorderSpace;
public short wBorderWidth;
public short wBorders;}
public Form1()
{
InitializeComponent();
}
[DllImport( "user32", CharSet = CharSet.Auto )]
private static extern IntPtr SendMessage( HandleRef hWnd, int msg,int wParam, ref PARAFORMAT2 lParam );
private void Form1_Load(object sender, EventArgs e)
{
}
private void button1_Click(object sender, EventArgs e)
{
PARAFORMAT2 fmt = new PARAFORMAT2();
fmt.cbSize = Marshal.SizeOf(fmt);
fmt.bLineSpacingRule = 4;
fmt.dyLineSpacing = 500;//((int)richTextBox1.Font.Size) * 20 * ((int)ud.Value);
fmt.dwMask = PFM_LINESPACING;
SendMessage( new HandleRef(this.richTextBox1, richTextBox1.Handle ), EM_SETPARAFORMAT, 0, ref fmt );
}
}
}