我使用以下代码添加了自定义字体:
PrivateFontCollection pfc = new PrivateFontCollection();
pfc.AddFontFile("C:\\Path To\\YourFont.ttf");
label1.Font = new System.Drawing.Font(pfc.Families[0], 16, FontStyle.Regular);
Run Code Online (Sandbox Code Playgroud)
我在资源中添加了字体文件.如何addFontFile从资源中添加?
我正在动态加载图像FlowLayoutPanel.我需要这个面板自动调整尺寸,但只能垂直调整.
这是可能的,如果是这样,我该如何实现它?
我正在尝试旋转图像..我有一个pictureBox 369x276.但是当我旋转时,这个尺寸减小了.
pictureBox sizeMode是PictureBoxSizeMode.StretchImage
这是我的代码:
Bitmap oldBitmap = (Bitmap)pictureBox1.Image;
float angle = 90;
var newBitmap = new Bitmap(oldBitmap.Width, oldBitmap.Height);
var graphics = Graphics.FromImage(newBitmap);
graphics.TranslateTransform((float)oldBitmap.Width / 2, (float)oldBitmap.Height / 2);
graphics.RotateTransform(angle);
graphics.TranslateTransform(-(float)oldBitmap.Width / 2, -(float)oldBitmap.Height / 2);
graphics.DrawImage(oldBitmap, new Point(0, 0));
pictureBox1.Image = newBitmap;
Run Code Online (Sandbox Code Playgroud) 可以使用自定义字体更改C#中的标签字体.EX.:我需要将字体更改为Bookman旧样式,并且在Visual Studio中没有此字体.
有可能加吗?怎么样?
我需要在"id ="之后添加字符串@"d"
示例=
url = @"id=63488320543140151742289377"
Run Code Online (Sandbox Code Playgroud)
需要是
url = @"id=d63488320543140151742289377"
Run Code Online (Sandbox Code Playgroud)
我试过这个:
NSRange range = [url rangeOfString:@"id="];
[url stringByReplacingCharactersInRange:range withString:@"id=d"];
Run Code Online (Sandbox Code Playgroud)
但不行
我在 FlowlayoutPanel 中拖放图片框但事件返回表单中的位置......我需要在 FlowLayoutPanel 中的这个位置(图片框在 FlowLayoutPanel 中并且正在拖放那里)
public Form1()
{
InitializeComponent();
flowLayoutPanel1.AllowDrop = true;
}
private void pictureBox_MouseDown(object sender, MouseEventArgs e)
{
if (e.Button == MouseButtons.Left)
{
picBox = (PictureBox)sender;
if (picBox.Image != null)
{
var dragImage = new Bitmap((Bitmap)picBox.Image, picBox.Size);
IntPtr icon = dragImage.GetHicon();
Cursor.Current = new Cursor(icon);
DoDragDrop(picBox.Image, DragDropEffects.Copy);
}
}
}
void Form1_DragEnter(object sender, DragEventArgs e)
{
if (e.Data.GetDataPresent(typeof(Bitmap)))
e.Effect = DragDropEffects.Copy;
}
// Occurs when the user releases the mouse over the drop target
void Form1_DragDrop(object …Run Code Online (Sandbox Code Playgroud) 我在flowLayout面板上有2个pictureBox,需要将pictureBox1移动到pictureBox2的位置,将pictureBox2移动到pictureBox1的位置
编辑:
我试过但是pictureBoxes不动......我用MessageBox来检查位置......位置是对的,但是他们不换位置(位置没有改变......)
MessageBox.Show("PixBoxMover x " + picBoxMover.Location.X + "y " + picBoxMover.Location.Y);
MessageBox.Show("picBoxMovendo x " + picBox.Location.X + "y " + picBox.Location.Y);
Point temp = picBox.Location;
picBox.Location = picBoxMover.Location;
picBoxMover.Location = temp;
MessageBox.Show("PixBoxMover x " + picBoxMover.Location.X + "y " + picBoxMover.Location.Y);
MessageBox.Show("picBoxMovendo x " + picBox.Location.X + "y " + picBox.Location.Y);
Run Code Online (Sandbox Code Playgroud) 我正在尝试从面板中保存位图,但保存的图像是在程序的栏中...
如何使用指定的面板保存图像?
这是我的代码:
Bitmap bitmap = new Bitmap(panel1.Width, panel1.Height);
this.DrawToBitmap(bitmap, panel1.ClientRectangle);
bitmap.Save("C:\\" + pagAtual + ".bmp", ImageFormat.Bmp);
Run Code Online (Sandbox Code Playgroud) 我正在尝试将字符串转换为日期:
Calendar calendar = Calendar.getInstance();
calendar.setTimeInMillis(System.currentTimeMillis());
Date dataEvento = null;
SimpleDateFormat dateFormat = new SimpleDateFormat("dd/MM/yyyy");
dataEvento = (Date)dateFormat.parse("28/08/2010"); //the app crash here
Run Code Online (Sandbox Code Playgroud)
logcat的:
03-06 10:06:19.867: E/AndroidRuntime(426): FATAL EXCEPTION: main
03-06 10:06:19.867: E/AndroidRuntime(426): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.ladessa.jccb/com.ladessa.jccb.MainActivity}: java.lang.ClassCastException: java.util.Date
03-06 10:06:19.867: E/AndroidRuntime(426): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2663)
03-06 10:06:19.867: E/AndroidRuntime(426): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2679)
03-06 10:06:19.867: E/AndroidRuntime(426): at android.app.ActivityThread.access$2300(ActivityThread.java:125)
03-06 10:06:19.867: E/AndroidRuntime(426): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2033)
03-06 10:06:19.867: E/AndroidRuntime(426): at android.os.Handler.dispatchMessage(Handler.java:99)
03-06 10:06:19.867: E/AndroidRuntime(426): at android.os.Looper.loop(Looper.java:123) 03-06 10:06:19.867: E/AndroidRuntime(426): at android.app.ActivityThread.main(ActivityThread.java:4627)
03-06 10:06:19.867: E/AndroidRuntime(426): at java.lang.reflect.Method.invokeNative(Native …Run Code Online (Sandbox Code Playgroud) 我正在尝试将我的位图保存在.pdf文件中.它不起作用.我没有收到错误,但它没有打开保存.pdf文件的对话框.
这是我的代码:
PdfDocument doc = new PdfDocument();
for (int iCnt = 0; iCnt < nPaginasPDF; iCnt++)
{
doc.Pages.Add(new PdfPage());
XGraphics xgr = XGraphics.FromPdfPage(doc.Pages[iCnt]);
XImage img = XImage.FromFile("C:\\" + (iCnt+1) + ".bmp"); (In this directory have these image files)
xgr.DrawImage(img, panel1.ClientRectangle);
}
using (var Stream = saveFileDialog1.OpenFile())
{
doc.Save(Stream);
}
doc.Close();
Run Code Online (Sandbox Code Playgroud) 我正在尝试计算百分比......我需要从列中总结所有值(它已经可以)但我需要将结果除以行数...
select sum(voto) from tablename where id = numberHere
Run Code Online (Sandbox Code Playgroud) 我正在尝试将我的应用程序提交到AppStore,但我收到了这个消息:
您的应用包含非公开API使用情况.请查看错误,更正错误,然后重新提交申请.
The app contais or inherits from non-public classes in Payload/iPark.app/City-6AEFBE8F8D9CC569.o: City
Run Code Online (Sandbox Code Playgroud)
我只使用谷歌地图API